aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2010-07-22 17:19:46 -0500
committerMark Hatle <mark.hatle@windriver.com>2010-07-22 17:19:46 -0500
commit6b895ad60363f13ba2785e7473c4613d89dc2c12 (patch)
tree466e467cd8f5e7c3b2fac7ce85646637e22e47fc
parentcabd0d8040fa221214257a0a181ea0d1b5490fbb (diff)
parent14ea05558ee0ed60d13e6681100c116e92593489 (diff)
downloadprelink-cross-6b895ad60363f13ba2785e7473c4613d89dc2c12.tar.gz
prelink-cross-6b895ad60363f13ba2785e7473c4613d89dc2c12.tar.bz2
prelink-cross-6b895ad60363f13ba2785e7473c4613d89dc2c12.zip
Merge branch 'prelink_20061201' into cross_prelink
Conflicts: src/data.c trunk/src/dso.c trunk/src/prelink.h trunk/testsuite/reloc5.c trunk/testsuite/shuffle2.c Updated versioning in: trunk/src/execstack.c trunk/src/ld-libs.c trunk/src/main.c * src/arch-arm.c: remove read_une32, write_ne32, buf_write_ne32, buf_read_une32 * src/dso-readonly.c: sync to changes in src/dso.c
-rw-r--r--ChangeLog3
-rw-r--r--testsuite/filter1.c17
-rw-r--r--testsuite/filter1.h12
-rwxr-xr-xtestsuite/filter1.sh16
-rw-r--r--testsuite/filter1filter.c13
-rw-r--r--testsuite/filter1lib1.c13
-rw-r--r--testsuite/filter1lib2.c8
-rwxr-xr-xtestsuite/filter2.sh16
-rw-r--r--testsuite/lib00.C10
-rw-r--r--testsuite/lib02.h11
-rw-r--r--testsuite/lib021.c16
-rw-r--r--testsuite/lib022.c6
-rw-r--r--testsuite/lib031.c4
-rw-r--r--testsuite/lib032.c8
-rw-r--r--testsuite/prelink.conf1
-rw-r--r--testsuite/test00.C3
-rwxr-xr-xtestsuite/test00.sh14
-rwxr-xr-xtestsuite/test01.sh13
-rw-r--r--testsuite/test02.c11
-rwxr-xr-xtestsuite/test02.sh11
-rw-r--r--testsuite/test03.c10
-rwxr-xr-xtestsuite/test03.sh13
-rw-r--r--trunk/AUTHORS (renamed from AUTHORS)0
-rw-r--r--trunk/COPYING (renamed from COPYING)0
-rw-r--r--trunk/ChangeLog114
-rw-r--r--trunk/ChangeLog.cross (renamed from ChangeLog.cross)7
-rw-r--r--trunk/INSTALL (renamed from INSTALL)0
-rw-r--r--trunk/Makefile.am (renamed from Makefile.am)0
-rw-r--r--trunk/Makefile.in (renamed from Makefile.in)0
-rw-r--r--trunk/NEWS (renamed from NEWS)0
-rw-r--r--trunk/README (renamed from README)0
-rw-r--r--trunk/THANKS (renamed from THANKS)0
-rw-r--r--trunk/TODO (renamed from TODO)0
-rw-r--r--trunk/aclocal.m4 (renamed from aclocal.m4)0
-rwxr-xr-xtrunk/config.guess (renamed from config.guess)0
-rw-r--r--trunk/config.h.in (renamed from config.h.in)0
-rwxr-xr-xtrunk/config.sub (renamed from config.sub)0
-rwxr-xr-xtrunk/configure (renamed from configure)0
-rw-r--r--trunk/configure.in (renamed from configure.in)0
-rwxr-xr-xtrunk/depcomp (renamed from depcomp)0
-rw-r--r--trunk/doc/Makefile.am (renamed from doc/Makefile.am)0
-rw-r--r--trunk/doc/Makefile.in (renamed from doc/Makefile.in)0
-rw-r--r--trunk/doc/basemove.fig (renamed from doc/basemove.fig)0
-rw-r--r--trunk/doc/bss.fig (renamed from doc/bss.fig)0
-rw-r--r--trunk/doc/dso1.fig (renamed from doc/dso1.fig)0
-rw-r--r--trunk/doc/dso2.fig (renamed from doc/dso2.fig)0
-rw-r--r--trunk/doc/dso3.fig (renamed from doc/dso3.fig)0
-rw-r--r--trunk/doc/execstack.8 (renamed from doc/execstack.8)0
-rw-r--r--trunk/doc/gap.fig (renamed from doc/gap.fig)0
-rw-r--r--trunk/doc/glossary.conf (renamed from doc/glossary.conf)0
-rw-r--r--trunk/doc/lineno.sty (renamed from doc/lineno.sty)0
-rw-r--r--trunk/doc/linuxtag.sty (renamed from doc/linuxtag.sty)0
-rw-r--r--trunk/doc/newseg.fig (renamed from doc/newseg.fig)0
-rw-r--r--trunk/doc/prelink.8 (renamed from doc/prelink.8)0
-rw-r--r--trunk/doc/prelink.conf (renamed from doc/prelink.conf)0
-rw-r--r--trunk/doc/prelink.pdf (renamed from doc/prelink.pdf)bin539486 -> 539486 bytes
-rw-r--r--trunk/doc/prelink.tex (renamed from doc/prelink.tex)0
-rw-r--r--trunk/doc/prelinklisting.sty (renamed from doc/prelinklisting.sty)0
-rw-r--r--trunk/gelf/Makefile.am (renamed from gelf/Makefile.am)0
-rw-r--r--trunk/gelf/Makefile.in (renamed from gelf/Makefile.in)0
-rw-r--r--trunk/gelf/gelf.c (renamed from gelf/gelf.c)0
-rw-r--r--trunk/gelf/gelf.h (renamed from gelf/gelf.h)0
-rw-r--r--trunk/gelfx/Makefile.am (renamed from gelfx/Makefile.am)0
-rw-r--r--trunk/gelfx/Makefile.in (renamed from gelfx/Makefile.in)0
-rw-r--r--trunk/gelfx/gelfx.h (renamed from gelfx/gelfx.h)0
-rw-r--r--trunk/gelfx32/Makefile.am (renamed from gelfx32/Makefile.am)0
-rw-r--r--trunk/gelfx32/Makefile.in (renamed from gelfx32/Makefile.in)0
-rw-r--r--trunk/gelfx32/gelfx.h (renamed from gelfx32/gelfx.h)0
-rwxr-xr-xtrunk/install-sh (renamed from install-sh)0
-rwxr-xr-xtrunk/ltconfig (renamed from ltconfig)0
-rw-r--r--trunk/ltmain.sh (renamed from ltmain.sh)0
-rw-r--r--trunk/m4/Makefile.am (renamed from m4/Makefile.am)0
-rw-r--r--trunk/m4/Makefile.in (renamed from m4/Makefile.in)0
-rw-r--r--trunk/m4/libelf.m4 (renamed from m4/libelf.m4)0
-rwxr-xr-xtrunk/missing (renamed from missing)0
-rwxr-xr-xtrunk/mkinstalldirs (renamed from mkinstalldirs)0
-rw-r--r--trunk/patches/Makefile.am (renamed from patches/Makefile.am)0
-rw-r--r--trunk/patches/Makefile.in (renamed from patches/Makefile.in)0
-rw-r--r--trunk/patches/libelf-0.7.0-hash.patch (renamed from patches/libelf-0.7.0-hash.patch)0
-rw-r--r--trunk/patches/libelf-0.7.0.patch (renamed from patches/libelf-0.7.0.patch)0
-rw-r--r--trunk/patches/linux-2.4.10.patch (renamed from patches/linux-2.4.10.patch)0
-rw-r--r--trunk/src/Makefile.am (renamed from src/Makefile.am)2
-rw-r--r--trunk/src/Makefile.in (renamed from src/Makefile.in)15
-rw-r--r--trunk/src/arch-alpha.c (renamed from src/arch-alpha.c)5
-rw-r--r--trunk/src/arch-arm.c (renamed from src/arch-arm.c)40
-rw-r--r--trunk/src/arch-cris.c (renamed from src/arch-cris.c)4
-rw-r--r--trunk/src/arch-i386.c (renamed from src/arch-i386.c)4
-rw-r--r--trunk/src/arch-ia64.c (renamed from src/arch-ia64.c)4
-rw-r--r--trunk/src/arch-mips.c1031
-rw-r--r--trunk/src/arch-ppc.c (renamed from src/arch-ppc.c)3
-rw-r--r--trunk/src/arch-ppc64.c (renamed from src/arch-ppc64.c)0
-rw-r--r--trunk/src/arch-s390.c (renamed from src/arch-s390.c)4
-rw-r--r--trunk/src/arch-s390x.c (renamed from src/arch-s390x.c)4
-rw-r--r--trunk/src/arch-sh.c (renamed from src/arch-sh.c)31
-rw-r--r--trunk/src/arch-sparc.c (renamed from src/arch-sparc.c)2
-rw-r--r--trunk/src/arch-sparc64.c (renamed from src/arch-sparc64.c)2
-rw-r--r--trunk/src/arch-x86_64.c (renamed from src/arch-x86_64.c)4
-rw-r--r--trunk/src/cache.c (renamed from src/cache.c)0
-rw-r--r--trunk/src/canonicalize.c (renamed from src/canonicalize.c)0
-rw-r--r--trunk/src/checksum.c (renamed from src/checksum.c)0
-rw-r--r--trunk/src/conflict.c (renamed from src/conflict.c)4
-rw-r--r--trunk/src/crc32.c (renamed from src/crc32.c)0
-rw-r--r--trunk/src/cxx.c (renamed from src/cxx.c)0
-rw-r--r--trunk/src/data.c (renamed from src/data.c)127
-rw-r--r--trunk/src/doit.c (renamed from src/doit.c)0
-rw-r--r--trunk/src/dso-readonly.c (renamed from src/dso-readonly.c)75
-rw-r--r--trunk/src/dso.c (renamed from src/dso.c)73
-rw-r--r--trunk/src/dwarf2.c (renamed from src/dwarf2.c)11
-rw-r--r--trunk/src/dwarf2.h (renamed from src/dwarf2.h)0
-rw-r--r--trunk/src/elf.h (renamed from src/elf.h)0
-rw-r--r--trunk/src/exec.c (renamed from src/exec.c)0
-rw-r--r--trunk/src/execle_open.c (renamed from src/execle_open.c)0
-rw-r--r--trunk/src/execstack.c (renamed from src/execstack.c)2
-rw-r--r--trunk/src/fptr.c (renamed from src/fptr.c)0
-rw-r--r--trunk/src/fptr.h (renamed from src/fptr.h)0
-rw-r--r--trunk/src/gather.c (renamed from src/gather.c)0
-rw-r--r--trunk/src/get.c (renamed from src/get.c)0
-rw-r--r--trunk/src/hashtab.c (renamed from src/hashtab.c)0
-rw-r--r--trunk/src/hashtab.h (renamed from src/hashtab.h)0
-rw-r--r--trunk/src/layout.c (renamed from src/layout.c)0
-rw-r--r--trunk/src/layout.h (renamed from src/layout.h)0
-rw-r--r--trunk/src/ld-do-lookup.h (renamed from src/ld-do-lookup.h)0
-rw-r--r--trunk/src/ld-libs.c (renamed from src/ld-libs.c)2
-rw-r--r--trunk/src/ld-libs.h (renamed from src/ld-libs.h)0
-rw-r--r--trunk/src/ld-lookup.c (renamed from src/ld-lookup.c)0
-rw-r--r--trunk/src/ld-lookup64.c (renamed from src/ld-lookup64.c)0
-rw-r--r--trunk/src/main.c (renamed from src/main.c)2
-rw-r--r--trunk/src/makecrc.c (renamed from src/makecrc.c)0
-rw-r--r--trunk/src/md5.c (renamed from src/md5.c)0
-rw-r--r--trunk/src/md5.h (renamed from src/md5.h)0
-rw-r--r--trunk/src/mdebug.c (renamed from src/mdebug.c)0
-rw-r--r--trunk/src/prelink.c (renamed from src/prelink.c)11
-rw-r--r--trunk/src/prelink.h (renamed from src/prelink.h)81
-rw-r--r--trunk/src/prelinktab.h (renamed from src/prelinktab.h)0
-rw-r--r--trunk/src/reloc.c (renamed from src/reloc.c)0
-rw-r--r--trunk/src/reloc.h (renamed from src/reloc.h)0
-rw-r--r--trunk/src/sha.c (renamed from src/sha.c)0
-rw-r--r--trunk/src/sha.h (renamed from src/sha.h)0
-rw-r--r--trunk/src/space.c (renamed from src/space.c)16
-rw-r--r--trunk/src/space.h (renamed from src/space.h)0
-rw-r--r--trunk/src/stabs.c (renamed from src/stabs.c)0
-rw-r--r--trunk/src/undo.c (renamed from src/undo.c)0
-rw-r--r--trunk/src/undoall.c (renamed from src/undoall.c)0
-rw-r--r--trunk/src/verify.c (renamed from src/verify.c)12
-rw-r--r--trunk/src/wrap-file.c (renamed from src/wrap-file.c)0
-rw-r--r--trunk/stamp-h.in (renamed from stamp-h.in)0
-rw-r--r--trunk/testsuite/Makefile.am (renamed from testsuite/Makefile.am)0
-rw-r--r--trunk/testsuite/Makefile.in (renamed from testsuite/Makefile.in)0
-rw-r--r--trunk/testsuite/cxx1.C (renamed from testsuite/cxx1.C)0
-rw-r--r--trunk/testsuite/cxx1.h (renamed from testsuite/cxx1.h)0
-rwxr-xr-xtrunk/testsuite/cxx1.sh (renamed from testsuite/cxx1.sh)0
-rw-r--r--trunk/testsuite/cxx1lib1.C (renamed from testsuite/cxx1lib1.C)0
-rw-r--r--trunk/testsuite/cxx1lib2.C (renamed from testsuite/cxx1lib2.C)0
-rwxr-xr-xtrunk/testsuite/cycle1.sh (renamed from testsuite/cycle1.sh)0
-rwxr-xr-xtrunk/testsuite/cycle2.sh (renamed from testsuite/cycle2.sh)0
-rw-r--r--trunk/testsuite/deps1.c (renamed from testsuite/deps1.c)0
-rw-r--r--trunk/testsuite/deps1.h (renamed from testsuite/deps1.h)0
-rwxr-xr-xtrunk/testsuite/deps1.sh (renamed from testsuite/deps1.sh)0
-rw-r--r--trunk/testsuite/deps1lib1.c (renamed from testsuite/deps1lib1.c)0
-rw-r--r--trunk/testsuite/deps1lib2.c (renamed from testsuite/deps1lib2.c)0
-rwxr-xr-xtrunk/testsuite/deps2.sh (renamed from testsuite/deps2.sh)0
-rw-r--r--trunk/testsuite/deps2lib1.c (renamed from testsuite/deps2lib1.c)0
-rwxr-xr-xtrunk/testsuite/functions.sh (renamed from testsuite/functions.sh)0
-rw-r--r--trunk/testsuite/layout.C (renamed from testsuite/layout.C)0
-rwxr-xr-xtrunk/testsuite/layout1.sh (renamed from testsuite/layout1.sh)0
-rwxr-xr-xtrunk/testsuite/layout2.sh (renamed from testsuite/layout2.sh)0
-rw-r--r--trunk/testsuite/layoutlib.C (renamed from testsuite/layoutlib.C)0
-rwxr-xr-xtrunk/testsuite/movelibs.sh (renamed from testsuite/movelibs.sh)0
-rw-r--r--trunk/testsuite/quick1.c (renamed from testsuite/quick1.c)0
-rwxr-xr-xtrunk/testsuite/quick1.sh (renamed from testsuite/quick1.sh)0
-rw-r--r--trunk/testsuite/quick1lib1.c (renamed from testsuite/quick1lib1.c)0
-rw-r--r--trunk/testsuite/quick1lib2.c (renamed from testsuite/quick1lib2.c)0
-rw-r--r--trunk/testsuite/quick1lib3.c (renamed from testsuite/quick1lib3.c)0
-rw-r--r--trunk/testsuite/quick1lib4.c (renamed from testsuite/quick1lib4.c)0
-rwxr-xr-xtrunk/testsuite/quick2.sh (renamed from testsuite/quick2.sh)0
-rwxr-xr-xtrunk/testsuite/quick3.sh (renamed from testsuite/quick3.sh)0
-rw-r--r--trunk/testsuite/reloc1.c (renamed from testsuite/reloc1.c)0
-rw-r--r--trunk/testsuite/reloc1.h (renamed from testsuite/reloc1.h)0
-rwxr-xr-xtrunk/testsuite/reloc1.sh (renamed from testsuite/reloc1.sh)0
-rw-r--r--trunk/testsuite/reloc10.c (renamed from testsuite/reloc10.c)0
-rwxr-xr-xtrunk/testsuite/reloc10.sh (renamed from testsuite/reloc10.sh)0
-rw-r--r--trunk/testsuite/reloc10lib1.c (renamed from testsuite/reloc10lib1.c)0
-rw-r--r--trunk/testsuite/reloc10lib2.c (renamed from testsuite/reloc10lib2.c)0
-rw-r--r--trunk/testsuite/reloc10lib3.c (renamed from testsuite/reloc10lib3.c)0
-rw-r--r--trunk/testsuite/reloc10lib4.c (renamed from testsuite/reloc10lib4.c)0
-rw-r--r--trunk/testsuite/reloc10lib5.c (renamed from testsuite/reloc10lib5.c)0
-rw-r--r--trunk/testsuite/reloc11.c (renamed from testsuite/reloc11.c)0
-rwxr-xr-xtrunk/testsuite/reloc11.sh (renamed from testsuite/reloc11.sh)0
-rw-r--r--trunk/testsuite/reloc11lib2.c (renamed from testsuite/reloc11lib2.c)0
-rw-r--r--trunk/testsuite/reloc11lib3.c (renamed from testsuite/reloc11lib3.c)0
-rw-r--r--trunk/testsuite/reloc1lib1.c (renamed from testsuite/reloc1lib1.c)0
-rw-r--r--trunk/testsuite/reloc1lib2.c (renamed from testsuite/reloc1lib2.c)0
-rw-r--r--trunk/testsuite/reloc2.c (renamed from testsuite/reloc2.c)0
-rwxr-xr-xtrunk/testsuite/reloc2.sh (renamed from testsuite/reloc2.sh)2
-rw-r--r--trunk/testsuite/reloc2lib1.c (renamed from testsuite/reloc2lib1.c)0
-rw-r--r--trunk/testsuite/reloc2lib2.c (renamed from testsuite/reloc2lib2.c)0
-rw-r--r--trunk/testsuite/reloc3.c (renamed from testsuite/reloc3.c)0
-rwxr-xr-xtrunk/testsuite/reloc3.sh (renamed from testsuite/reloc3.sh)0
-rw-r--r--trunk/testsuite/reloc3lib1.c (renamed from testsuite/reloc3lib1.c)0
-rw-r--r--trunk/testsuite/reloc4.c (renamed from testsuite/reloc4.c)0
-rwxr-xr-xtrunk/testsuite/reloc4.sh (renamed from testsuite/reloc4.sh)12
-rw-r--r--trunk/testsuite/reloc4lib1.c (renamed from testsuite/reloc4lib1.c)0
-rw-r--r--trunk/testsuite/reloc4lib2.c (renamed from testsuite/reloc4lib2.c)0
-rw-r--r--trunk/testsuite/reloc4lib3.c (renamed from testsuite/reloc4lib3.c)0
-rw-r--r--trunk/testsuite/reloc5.c (renamed from testsuite/reloc5.c)6
-rwxr-xr-xtrunk/testsuite/reloc5.sh (renamed from testsuite/reloc5.sh)0
-rwxr-xr-xtrunk/testsuite/reloc6.sh (renamed from testsuite/reloc6.sh)0
-rw-r--r--trunk/testsuite/reloc7.c (renamed from testsuite/reloc7.c)0
-rwxr-xr-xtrunk/testsuite/reloc7.sh (renamed from testsuite/reloc7.sh)0
-rwxr-xr-xtrunk/testsuite/reloc8.sh (renamed from testsuite/reloc8.sh)0
-rwxr-xr-xtrunk/testsuite/reloc9.sh (renamed from testsuite/reloc9.sh)0
-rwxr-xr-xtrunk/testsuite/shuffle1.sh (renamed from testsuite/shuffle1.sh)0
-rw-r--r--trunk/testsuite/shuffle2.c (renamed from testsuite/shuffle2.c)8
-rwxr-xr-xtrunk/testsuite/shuffle2.sh (renamed from testsuite/shuffle2.sh)0
-rwxr-xr-xtrunk/testsuite/shuffle3.sh (renamed from testsuite/shuffle3.sh)0
-rwxr-xr-xtrunk/testsuite/shuffle4.sh (renamed from testsuite/shuffle4.sh)0
-rwxr-xr-xtrunk/testsuite/shuffle5.sh (renamed from testsuite/shuffle5.sh)0
-rwxr-xr-xtrunk/testsuite/shuffle6.sh (renamed from testsuite/shuffle6.sh)0
-rw-r--r--trunk/testsuite/shuffle6lib1.c (renamed from testsuite/shuffle6lib1.c)0
-rw-r--r--trunk/testsuite/shuffle6lib2.c (renamed from testsuite/shuffle6lib2.c)0
-rwxr-xr-xtrunk/testsuite/shuffle7.sh (renamed from testsuite/shuffle7.sh)0
-rw-r--r--trunk/testsuite/shuffle8.c (renamed from testsuite/shuffle8.c)0
-rwxr-xr-xtrunk/testsuite/shuffle8.sh (renamed from testsuite/shuffle8.sh)0
-rw-r--r--trunk/testsuite/tls1.c (renamed from testsuite/tls1.c)0
-rw-r--r--trunk/testsuite/tls1.h (renamed from testsuite/tls1.h)0
-rwxr-xr-xtrunk/testsuite/tls1.sh (renamed from testsuite/tls1.sh)0
-rw-r--r--trunk/testsuite/tls1lib1.c (renamed from testsuite/tls1lib1.c)0
-rw-r--r--trunk/testsuite/tls1lib2.c (renamed from testsuite/tls1lib2.c)0
-rw-r--r--trunk/testsuite/tls2.c (renamed from testsuite/tls2.c)0
-rwxr-xr-xtrunk/testsuite/tls2.sh (renamed from testsuite/tls2.sh)0
-rw-r--r--trunk/testsuite/tls2lib1.c (renamed from testsuite/tls2lib1.c)0
-rwxr-xr-xtrunk/testsuite/tls3.sh (renamed from testsuite/tls3.sh)2
-rw-r--r--trunk/testsuite/tls3lib2.c (renamed from testsuite/tls3lib2.c)0
-rw-r--r--trunk/testsuite/tls4.c (renamed from testsuite/tls4.c)0
-rwxr-xr-xtrunk/testsuite/tls4.sh (renamed from testsuite/tls4.sh)0
-rw-r--r--trunk/testsuite/tls4lib1.c (renamed from testsuite/tls4lib1.c)0
-rw-r--r--trunk/testsuite/tls4lib2.c (renamed from testsuite/tls4lib2.c)0
-rwxr-xr-xtrunk/testsuite/tls5.sh (renamed from testsuite/tls5.sh)0
-rw-r--r--trunk/testsuite/tls5lib1.c (renamed from testsuite/tls5lib1.c)0
-rwxr-xr-xtrunk/testsuite/tls6.sh (renamed from testsuite/tls6.sh)0
-rw-r--r--trunk/testsuite/tls6lib1.c (renamed from testsuite/tls6lib1.c)0
-rw-r--r--trunk/testsuite/tls7.c (renamed from testsuite/tls7.c)0
-rwxr-xr-xtrunk/testsuite/tls7.sh (renamed from testsuite/tls7.sh)0
-rwxr-xr-xtrunk/testsuite/undo1.sh (renamed from testsuite/undo1.sh)0
-rwxr-xr-xtrunk/testsuite/undosyslibs.sh (renamed from testsuite/undosyslibs.sh)0
245 files changed, 1550 insertions, 401 deletions
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index 36b79ab..0000000
--- a/ChangeLog
+++ /dev/null
@@ -1,3 +0,0 @@
-2001-05-24 Jakub Jelinek <jakub@redhat.com>
-
- * The beginning.
diff --git a/testsuite/filter1.c b/testsuite/filter1.c
deleted file mode 100644
index e6b186c..0000000
--- a/testsuite/filter1.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "filter1.h"
-#include <stdlib.h>
-
-int main()
-{
- if (f1 () != 54 || f2 () != 54 || f3 () != 54)
- abort ();
- if (foo1.a != 1 || *foo1.b != 24 || *foo1.c != 30)
- abort ();
- if (foo2.a != 2 || *foo2.b != 24 || *foo2.c != 30)
- abort ();
- if (pfoo1p->a != 1 || *pfoo1p->b != 24 || *pfoo1p->c != 30)
- abort ();
- if (pfoo2p->a != 2 || *pfoo2p->b != 24 || *pfoo2p->c != 30)
- abort ();
- exit (0);
-}
diff --git a/testsuite/filter1.h b/testsuite/filter1.h
deleted file mode 100644
index 8d41041..0000000
--- a/testsuite/filter1.h
+++ /dev/null
@@ -1,12 +0,0 @@
-struct A
- {
- char a;
- int *b;
- int *c;
- };
-
-extern struct A foo1, foo2;
-extern struct A *pfoo1p, *pfoo2p;
-extern int bar, baz;
-
-extern int f1 (void), f2 (void), f3 (void);
diff --git a/testsuite/filter1.sh b/testsuite/filter1.sh
deleted file mode 100755
index f70cd77..0000000
--- a/testsuite/filter1.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-# This test relies on current GNU libc DT_FILTER/DT_AUXILIARY handling
-#
-rm -f filter1 filter1lib*.so filter1.log
-rm -f prelink.cache
-$CC -shared -O2 -fpic -o filter1filter.so $srcdir/filter1filter.c
-$CC -shared -O2 -fpic -o filter1lib1.so $srcdir/filter1lib1.c -Wl,-F,filter1filter.so filter1filter.so
-$CC -shared -O2 -fpic -o filter1lib2.so $srcdir/filter1lib2.c filter1lib1.so
-$CCLINK -o filter1 $srcdir/filter1.c -Wl,--rpath-link,. filter1lib2.so
-echo $PRELINK -vm ./filter1 > filter1.log
-$PRELINK -vm ./filter1 >> filter1.log 2>&1 || exit 1
-grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` filter1.log && exit 2
-LD_LIBRARY_PATH=. ./filter1 || exit 3
-readelf -a ./filter1 >> filter1.log 2>&1 || exit 4
-# So that it is not prelinked again
-chmod -x ./filter1
diff --git a/testsuite/filter1filter.c b/testsuite/filter1filter.c
deleted file mode 100644
index f612517..0000000
--- a/testsuite/filter1filter.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "filter1.h"
-
-int bar = 24;
-int baz = 22;
-
-struct A foo2 = { 2, &bar, &baz };
-static struct A pfoo2 = { 2, &bar, &baz };
-struct A *pfoo2p = &pfoo2;
-
-int f2 (void)
-{
- return bar + baz;
-}
diff --git a/testsuite/filter1lib1.c b/testsuite/filter1lib1.c
deleted file mode 100644
index 9cee3d1..0000000
--- a/testsuite/filter1lib1.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "filter1.h"
-
-int bar = 26;
-int baz = 28;
-
-struct A foo1 = { 1, &bar, &baz };
-static struct A pfoo1 = { 1, &bar, &baz };
-struct A *pfoo1p = &pfoo1;
-
-int f1 (void)
-{
- return bar + baz;
-}
diff --git a/testsuite/filter1lib2.c b/testsuite/filter1lib2.c
deleted file mode 100644
index e8b520f..0000000
--- a/testsuite/filter1lib2.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "filter1.h"
-
-int baz = 30;
-
-int f3 (void)
-{
- return bar + baz;
-}
diff --git a/testsuite/filter2.sh b/testsuite/filter2.sh
deleted file mode 100755
index c5611b5..0000000
--- a/testsuite/filter2.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-# This test relies on current GNU libc DT_FILTER/DT_AUXILIARY handling
-#
-rm -f filter2 filter2lib*.so filter2.log
-rm -f prelink.cache
-$CC -shared -O2 -fpic -o filter2filter.so $srcdir/filter1filter.c
-$CC -shared -O2 -fpic -o filter2lib1.so $srcdir/filter1lib1.c -Wl,-F,filter2filter.so -Wl,-f,filter2missingfilter.so filter2filter.so
-$CC -shared -O2 -fpic -o filter2lib2.so $srcdir/filter1lib2.c filter2lib1.so
-$CCLINK -o filter2 $srcdir/filter1.c -Wl,--rpath-link,. filter2lib2.so
-echo $PRELINK -vm ./filter2 > filter2.log
-$PRELINK -vm ./filter2 >> filter2.log 2>&1 || exit 1
-grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` filter2.log && exit 2
-LD_LIBRARY_PATH=. ./filter2 || exit 3
-readelf -a ./filter2 >> filter2.log 2>&1 || exit 4
-# So that it is not prelinked again
-chmod -x ./filter2
diff --git a/testsuite/lib00.C b/testsuite/lib00.C
deleted file mode 100644
index 8162515..0000000
--- a/testsuite/lib00.C
+++ /dev/null
@@ -1,10 +0,0 @@
-struct A
- {
- virtual int a();
- int b;
- };
-
-int A::a()
-{
- return 10;
-}
diff --git a/testsuite/lib02.h b/testsuite/lib02.h
deleted file mode 100644
index 1712ea5..0000000
--- a/testsuite/lib02.h
+++ /dev/null
@@ -1,11 +0,0 @@
-struct A
- {
- char a;
- struct A *b;
- int *c;
- };
-
-extern struct A foo;
-extern int bar;
-extern int f1 (void);
-extern int f2 (void);
diff --git a/testsuite/lib021.c b/testsuite/lib021.c
deleted file mode 100644
index 23ea896..0000000
--- a/testsuite/lib021.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "lib02.h"
-
-int bar = 26;
-int baz = 28;
-
-struct A foo = { 1, &foo, &bar };
-
-int f1 (void)
-{
- return 1;
-}
-
-int f2 (void)
-{
- return f1 () + 1;
-}
diff --git a/testsuite/lib022.c b/testsuite/lib022.c
deleted file mode 100644
index 33dada0..0000000
--- a/testsuite/lib022.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib02.h"
-
-int f1 (void)
-{
- return 11;
-}
diff --git a/testsuite/lib031.c b/testsuite/lib031.c
deleted file mode 100644
index 3551704..0000000
--- a/testsuite/lib031.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int f1 (int dummy)
-{
- return 1;
-}
diff --git a/testsuite/lib032.c b/testsuite/lib032.c
deleted file mode 100644
index 68b3dbc..0000000
--- a/testsuite/lib032.c
+++ /dev/null
@@ -1,8 +0,0 @@
-extern int f1 (int dummy);
-
-int f2 (int add)
-{
- if (add)
- return f1 (0) + 26;
- return f1 (0);
-}
diff --git a/testsuite/prelink.conf b/testsuite/prelink.conf
deleted file mode 100644
index 544a3f5..0000000
--- a/testsuite/prelink.conf
+++ /dev/null
@@ -1 +0,0 @@
-/usr/src/prelink/testsuite
diff --git a/testsuite/test00.C b/testsuite/test00.C
deleted file mode 100644
index 5047a34..0000000
--- a/testsuite/test00.C
+++ /dev/null
@@ -1,3 +0,0 @@
-int main()
-{
-}
diff --git a/testsuite/test00.sh b/testsuite/test00.sh
deleted file mode 100755
index 8c54dd6..0000000
--- a/testsuite/test00.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-rm -f prelink.cache
-rm -f test00 lib00*.so test00.log
-i=10
-while [ $i -lt 74 ]; do
- $CXX -shared -fpic -o lib00$i.so $srcdir/lib00.C
- i=`expr $i + 1`
-done
-$CXXLINK -o test00 $srcdir/test00.C lib00*.so
-echo $PRELINK -vR ./test00 > test00.log
-$PRELINK -vR ./test00 >> test00.log 2>&1 || exit 1
-LD_LIBRARY_PATH=. ./test00 || exit 2
-# So that it is not prelinked again
-chmod -x ./test00
diff --git a/testsuite/test01.sh b/testsuite/test01.sh
deleted file mode 100755
index 4f83c5c..0000000
--- a/testsuite/test01.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-rm -f test01 lib01*.so test01.log
-i=1
-while [ $i -lt 6 ]; do
- $CXX -shared -fpic -o lib01$i.so $srcdir/lib00.C
- i=`expr $i + 1`
-done
-$CXXLINK -o test01 $srcdir/test00.C lib01*.so
-echo $PRELINK -vR ./test01 > test01.log
-$PRELINK -vR ./test01 >> test01.log 2>&1 || exit 1
-LD_LIBRARY_PATH=. ./test01 || exit 2
-# So that it is not prelinked again
-chmod -x ./test01
diff --git a/testsuite/test02.c b/testsuite/test02.c
deleted file mode 100644
index 15fe414..0000000
--- a/testsuite/test02.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "lib02.h"
-#include <stdlib.h>
-
-int main()
-{
- if (foo.a != 1 || foo.b != &foo || foo.c != &bar || bar != 26)
- abort ();
- if (f1 () != 11 || f2 () != 12)
- abort ();
- exit (0);
-}
diff --git a/testsuite/test02.sh b/testsuite/test02.sh
deleted file mode 100755
index c0b7105..0000000
--- a/testsuite/test02.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-rm -f test02 lib02*.so test02.log
-rm -f prelink.cache
-$CC -shared -O2 -fpic -o lib021.so $srcdir/lib021.c
-$CC -shared -O2 -fpic -o lib022.so $srcdir/lib022.c lib021.so
-$CCLINK -o test02 $srcdir/test02.c -Wl,--rpath-link,. lib022.so
-echo $PRELINK -vm ./test02 > test02.log
-$PRELINK -vm ./test02 >> test02.log 2>&1 || exit 1
-LD_LIBRARY_PATH=. ./test02 || exit 2
-# So that it is not prelinked again
-chmod -x ./test02
diff --git a/testsuite/test03.c b/testsuite/test03.c
deleted file mode 100644
index 92445db..0000000
--- a/testsuite/test03.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdlib.h>
-
-extern int f2 (int add);
-
-int main()
-{
- if (f2 (1) != 27 || f2 (0) != 1)
- abort ();
- exit (0);
-}
diff --git a/testsuite/test03.sh b/testsuite/test03.sh
deleted file mode 100755
index 68a05f1..0000000
--- a/testsuite/test03.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-case "`uname -m`" in
- ia64) exit 77;; # Does not support non-pic shared libs
-esac
-rm -f test03 lib03*.so test03.log
-$CC -shared -O2 -o lib031.so $srcdir/lib031.c
-$CC -shared -O2 -o lib032.so $srcdir/lib032.c lib031.so
-$CCLINK -o test03 $srcdir/test03.c -Wl,--rpath-link,. lib032.so
-echo $PRELINK -vm ./test03 > test03.log
-$PRELINK -vm ./test03 >> test03.log 2>&1 || exit 1
-LD_LIBRARY_PATH=. ./test03 || exit 2
-# So that it is not prelinked again
-chmod -x ./test03
diff --git a/AUTHORS b/trunk/AUTHORS
index 96a4141..96a4141 100644
--- a/AUTHORS
+++ b/trunk/AUTHORS
diff --git a/COPYING b/trunk/COPYING
index eeb586b..eeb586b 100644
--- a/COPYING
+++ b/trunk/COPYING
diff --git a/trunk/ChangeLog b/trunk/ChangeLog
new file mode 100644
index 0000000..9e2961f
--- /dev/null
+++ b/trunk/ChangeLog
@@ -0,0 +1,114 @@
+2006-12-01 Jakub Jelinek <jakub@redhat.com>
+
+ * src/verify.c (prelink_verify): Unlink ent->filename in case of
+ failures between closing the unprelinked dso and unlinking
+ ent->filename.
+
+2006-10-27 Jakub Jelinek <jakub@redhat.com>
+
+ * src/prelink.h (READWRITEPROTOSIZE): Undef after use.
+
+2006-10-24 Richard Sandiford <richard@codesourcery.com>
+
+ * testsuite/tls3.sh: Use -fpic for MIPS too.
+ * testsuite/reloc2.sh: Likewise.
+
+ * testsuite/reloc4.sh: Use -mxgot when compiling for MIPS targets.
+ * testsuite/reloc5.c (main): Make the printed inline asm globalize
+ testzero.
+
+ * testsuite/shuffle2.c (testzero): Globalize asm definition.
+
+ * src/Makefile.am (arch_SOURCES): Add arch-mips.c
+ * src/Makefile.in: Regenerate.
+ * src/arch-mips.c: New file.
+
+ * src/prelink.h (DT_MIPS_RLD_VERSION): Define.
+ (DT_MIPS_TIME_STAMP): Likewise.
+ (DT_MIPS_ICHECKSUM): Likewise.
+ (DT_MIPS_IVERSION): Likewise.
+ (DT_MIPS_FLAGS): Likewise.
+ (DT_MIPS_BASE_ADDRESS): Likewise.
+ (DT_MIPS_CONFLICT): Likewise.
+ (DT_MIPS_LIBLIST): Likewise.
+ (DT_MIPS_LOCAL_GOTNO): Likewise.
+ (DT_MIPS_CONFLICTNO): Likewise.
+ (DT_MIPS_LIBLISTNO): Likewise.
+ (DT_MIPS_SYMTABNO): Likewise.
+ (DT_MIPS_UNREFEXTNO): Likewise.
+ (DT_MIPS_GOTSYM): Likewise.
+ (DT_MIPS_HIPAGENO): Likewise.
+ (DT_MIPS_RLD_MAP): Likewise.
+ (R_MIPS_TLS_DTPMOD): Likewise.
+ (R_MIPS_TLS_DTPREL): Likewise.
+ (R_MIPS_TLS_TPREL): Likewise.
+ (R_MIPS_GLOB_DAT): Likewise.
+ (DSO): Add info_DT_MIPS_LOCAL_GOTNO, info_DT_MIPS_GOTSYM,
+ and info_DT_MIPS_SYMTABNO.
+
+ * src/dso.c (read_dynamic): Initialize the new DSO fields.
+ (adjust_symbol_p): Handle stub values on MIPS.
+ * src/prelink.c (prelink_prepare): Handle SHT_DYNAMIC and
+ SHT_MIPS_REGINFO on MIPS.
+ * src/space.c (find_readonly_space): Don't place the new section
+ in the PT_PHDR segment.
+
+ * src/prelink.h (data_iterator): New structure.
+ (init_data_iterator): Declare.
+ (get_data_from_iterator): Likewise.
+ (get_sym_from_iterator): Likewise.
+ * src/data.c (init_data_iterator): New function.
+ (get_data_from_iterator): Likewise.
+ (get_sym_from_iterator): Likewise.
+
+ * src/prelink.h (READWRITEPROTOSIZE): New macro. Instantiate
+ READWRITEPROTO for big and little endian. Add prototypes for
+ native-endian functions (buf_read_uneNN, read_uneNN, buf_write_neNN
+ and write_neNN). Replace uses of READWRITEPROTO with uses of
+ this macro.
+ * src/data.c (BUFREADUNE, READUNE, WRITENE, BUFWRITENE): New macros.
+ (READWRITESIZE): New macro. Instantiate READWRITE for big and
+ little endian. Instantiate BUFREADUNE, READUNE, WRITENE
+ and BUFWRITENE. Replace uses of READWRITE with uses of this macro.
+ * src/arch-sh.c (read_une32, write_ne32, buf_write_ne32): Delete.
+
+ * src/prelink.h (PLArch): Add an arch_prelink_conflict callback.
+ * src/conflict.c (prelink_build_conflicts): If defined, call it
+ for each dependency.
+
+ * src/prelink.h (PLArch): Make the arch_prelink callback take
+ a "struct prelink_info *" argument, not a "DSO *" argument.
+ * src/prelink.c (prelink): Adjust call accordingly.
+ * src/arch-alpha.c (alpha_arch_prelink): Adjust definition accordingly.
+ * src/arch-arm.c (arm_arch_prelink): Likewise.
+ * src/arch-cris.c (cris_arch_prelink): Likewise.
+ * src/arch-i386.c (i386_arch_prelink): Likewise.
+ * src/arch-ia64.c (ia64_arch_prelink): Likewise.
+ * src/arch-ppc.c (ppc_arch_prelink): Likewise.
+ * src/arch-s390.c (s390_arch_prelink): Likewise
+ * src/arch-s390x.c (s390x_arch_prelink): Likewise
+ * src/arch-sh.c (sh_arch_prelink): Likewise.
+ * src/arch-sparc64.c (sparc64_arch_prelink): Likewise.
+ * src/arch-sparc.c (sparc_arch_prelink): Likewise
+ * src/arch-x86_64.c (x86_64_arch_prelink): Likewise.
+
+ * src/prelink.h (PLArch): Add an arch_adjust callback.
+ * src/dso.c (adjust_dso): Use it, if defined.
+
+ * src/prelink.h (adjust_symbol_p): Declare.
+ * src/dso.c (adjust_symbol_p): New function, extracted from...
+ (adjust_symtab): ...here.
+
+2006-10-27 Jakub Jelinek <jakub@redhat.com>
+
+ * src/dwarf2.c (adjust_dwarf2_ranges): Fix adjusting if end of range
+ is at the end of some section and there is padding before the
+ following one.
+
+2006-07-28 Alexandre Oliva <aoliva@redhat.com>
+
+ * src/cache.c (deps_cmp): Avoid segfault if both a and b are NULL.
+
+2001-05-24 Jakub Jelinek <jakub@redhat.com>
+
+ * The beginning.
diff --git a/ChangeLog.cross b/trunk/ChangeLog.cross
index 61b4d24..1578fd6 100644
--- a/ChangeLog.cross
+++ b/trunk/ChangeLog.cross
@@ -1,3 +1,10 @@
+2006-12-01 Mark Hatle <mark.hatle@windriver.com>
+
+ * merge to 20061201 (r151)
+ * src/arch-arm.c: remove read_une32, write_ne32, buf_write_ne32,
+ buf_read_une32
+ * src/dso-readonly.c: sync to changes in src/dso.c
+
2006-08-18 Mark Hatle <mark.hatle@windriver.com>
* arch-arm.c: remove prelink_conflict_rela
diff --git a/INSTALL b/trunk/INSTALL
index b42a17a..b42a17a 100644
--- a/INSTALL
+++ b/trunk/INSTALL
diff --git a/Makefile.am b/trunk/Makefile.am
index 5a50830..5a50830 100644
--- a/Makefile.am
+++ b/trunk/Makefile.am
diff --git a/Makefile.in b/trunk/Makefile.in
index 22ab2b4..22ab2b4 100644
--- a/Makefile.in
+++ b/trunk/Makefile.in
diff --git a/NEWS b/trunk/NEWS
index c36e768..c36e768 100644
--- a/NEWS
+++ b/trunk/NEWS
diff --git a/README b/trunk/README
index b6dc3ba..b6dc3ba 100644
--- a/README
+++ b/trunk/README
diff --git a/THANKS b/trunk/THANKS
index 9f42254..9f42254 100644
--- a/THANKS
+++ b/trunk/THANKS
diff --git a/TODO b/trunk/TODO
index 0a3d072..0a3d072 100644
--- a/TODO
+++ b/trunk/TODO
diff --git a/aclocal.m4 b/trunk/aclocal.m4
index a357ef7..a357ef7 100644
--- a/aclocal.m4
+++ b/trunk/aclocal.m4
diff --git a/config.guess b/trunk/config.guess
index f1657bb..f1657bb 100755
--- a/config.guess
+++ b/trunk/config.guess
diff --git a/config.h.in b/trunk/config.h.in
index a6c7dcc..a6c7dcc 100644
--- a/config.h.in
+++ b/trunk/config.h.in
diff --git a/config.sub b/trunk/config.sub
index 1dea9b7..1dea9b7 100755
--- a/config.sub
+++ b/trunk/config.sub
diff --git a/configure b/trunk/configure
index 9f2a746..9f2a746 100755
--- a/configure
+++ b/trunk/configure
diff --git a/configure.in b/trunk/configure.in
index 396f3ac..396f3ac 100644
--- a/configure.in
+++ b/trunk/configure.in
diff --git a/depcomp b/trunk/depcomp
index 368e3be..368e3be 100755
--- a/depcomp
+++ b/trunk/depcomp
diff --git a/doc/Makefile.am b/trunk/doc/Makefile.am
index 45f4757..45f4757 100644
--- a/doc/Makefile.am
+++ b/trunk/doc/Makefile.am
diff --git a/doc/Makefile.in b/trunk/doc/Makefile.in
index 678002b..678002b 100644
--- a/doc/Makefile.in
+++ b/trunk/doc/Makefile.in
diff --git a/doc/basemove.fig b/trunk/doc/basemove.fig
index 6fb1c02..6fb1c02 100644
--- a/doc/basemove.fig
+++ b/trunk/doc/basemove.fig
diff --git a/doc/bss.fig b/trunk/doc/bss.fig
index 2c9325f..2c9325f 100644
--- a/doc/bss.fig
+++ b/trunk/doc/bss.fig
diff --git a/doc/dso1.fig b/trunk/doc/dso1.fig
index 0bd75f3..0bd75f3 100644
--- a/doc/dso1.fig
+++ b/trunk/doc/dso1.fig
diff --git a/doc/dso2.fig b/trunk/doc/dso2.fig
index 73d0a14..73d0a14 100644
--- a/doc/dso2.fig
+++ b/trunk/doc/dso2.fig
diff --git a/doc/dso3.fig b/trunk/doc/dso3.fig
index ffdb9de..ffdb9de 100644
--- a/doc/dso3.fig
+++ b/trunk/doc/dso3.fig
diff --git a/doc/execstack.8 b/trunk/doc/execstack.8
index e0e95fa..e0e95fa 100644
--- a/doc/execstack.8
+++ b/trunk/doc/execstack.8
diff --git a/doc/gap.fig b/trunk/doc/gap.fig
index ced67c9..ced67c9 100644
--- a/doc/gap.fig
+++ b/trunk/doc/gap.fig
diff --git a/doc/glossary.conf b/trunk/doc/glossary.conf
index 477b529..477b529 100644
--- a/doc/glossary.conf
+++ b/trunk/doc/glossary.conf
diff --git a/doc/lineno.sty b/trunk/doc/lineno.sty
index 0805bcc..0805bcc 100644
--- a/doc/lineno.sty
+++ b/trunk/doc/lineno.sty
diff --git a/doc/linuxtag.sty b/trunk/doc/linuxtag.sty
index 3820886..3820886 100644
--- a/doc/linuxtag.sty
+++ b/trunk/doc/linuxtag.sty
diff --git a/doc/newseg.fig b/trunk/doc/newseg.fig
index 4a2f7ea..4a2f7ea 100644
--- a/doc/newseg.fig
+++ b/trunk/doc/newseg.fig
diff --git a/doc/prelink.8 b/trunk/doc/prelink.8
index c43b08a..c43b08a 100644
--- a/doc/prelink.8
+++ b/trunk/doc/prelink.8
diff --git a/doc/prelink.conf b/trunk/doc/prelink.conf
index 0b0e8ca..0b0e8ca 100644
--- a/doc/prelink.conf
+++ b/trunk/doc/prelink.conf
diff --git a/doc/prelink.pdf b/trunk/doc/prelink.pdf
index 0783007..0783007 100644
--- a/doc/prelink.pdf
+++ b/trunk/doc/prelink.pdf
Binary files differ
diff --git a/doc/prelink.tex b/trunk/doc/prelink.tex
index 5075030..5075030 100644
--- a/doc/prelink.tex
+++ b/trunk/doc/prelink.tex
diff --git a/doc/prelinklisting.sty b/trunk/doc/prelinklisting.sty
index f0aff06..f0aff06 100644
--- a/doc/prelinklisting.sty
+++ b/trunk/doc/prelinklisting.sty
diff --git a/gelf/Makefile.am b/trunk/gelf/Makefile.am
index f6320fa..f6320fa 100644
--- a/gelf/Makefile.am
+++ b/trunk/gelf/Makefile.am
diff --git a/gelf/Makefile.in b/trunk/gelf/Makefile.in
index 05f9925..05f9925 100644
--- a/gelf/Makefile.in
+++ b/trunk/gelf/Makefile.in
diff --git a/gelf/gelf.c b/trunk/gelf/gelf.c
index 915cf5b..915cf5b 100644
--- a/gelf/gelf.c
+++ b/trunk/gelf/gelf.c
diff --git a/gelf/gelf.h b/trunk/gelf/gelf.h
index 6b76a15..6b76a15 100644
--- a/gelf/gelf.h
+++ b/trunk/gelf/gelf.h
diff --git a/gelfx/Makefile.am b/trunk/gelfx/Makefile.am
index ae51b93..ae51b93 100644
--- a/gelfx/Makefile.am
+++ b/trunk/gelfx/Makefile.am
diff --git a/gelfx/Makefile.in b/trunk/gelfx/Makefile.in
index 692bbea..692bbea 100644
--- a/gelfx/Makefile.in
+++ b/trunk/gelfx/Makefile.in
diff --git a/gelfx/gelfx.h b/trunk/gelfx/gelfx.h
index c011a57..c011a57 100644
--- a/gelfx/gelfx.h
+++ b/trunk/gelfx/gelfx.h
diff --git a/gelfx32/Makefile.am b/trunk/gelfx32/Makefile.am
index ae51b93..ae51b93 100644
--- a/gelfx32/Makefile.am
+++ b/trunk/gelfx32/Makefile.am
diff --git a/gelfx32/Makefile.in b/trunk/gelfx32/Makefile.in
index 4f6898a..4f6898a 100644
--- a/gelfx32/Makefile.in
+++ b/trunk/gelfx32/Makefile.in
diff --git a/gelfx32/gelfx.h b/trunk/gelfx32/gelfx.h
index 7668a84..7668a84 100644
--- a/gelfx32/gelfx.h
+++ b/trunk/gelfx32/gelfx.h
diff --git a/install-sh b/trunk/install-sh
index 398a88e..398a88e 100755
--- a/install-sh
+++ b/trunk/install-sh
diff --git a/ltconfig b/trunk/ltconfig
index c14d83c..c14d83c 100755
--- a/ltconfig
+++ b/trunk/ltconfig
diff --git a/ltmain.sh b/trunk/ltmain.sh
index c8c38c2..c8c38c2 100644
--- a/ltmain.sh
+++ b/trunk/ltmain.sh
diff --git a/m4/Makefile.am b/trunk/m4/Makefile.am
index d9fab43..d9fab43 100644
--- a/m4/Makefile.am
+++ b/trunk/m4/Makefile.am
diff --git a/m4/Makefile.in b/trunk/m4/Makefile.in
index e7a76bf..e7a76bf 100644
--- a/m4/Makefile.in
+++ b/trunk/m4/Makefile.in
diff --git a/m4/libelf.m4 b/trunk/m4/libelf.m4
index 7e80a5d..7e80a5d 100644
--- a/m4/libelf.m4
+++ b/trunk/m4/libelf.m4
diff --git a/missing b/trunk/missing
index dd58370..dd58370 100755
--- a/missing
+++ b/trunk/missing
diff --git a/mkinstalldirs b/trunk/mkinstalldirs
index f9c37af..f9c37af 100755
--- a/mkinstalldirs
+++ b/trunk/mkinstalldirs
diff --git a/patches/Makefile.am b/trunk/patches/Makefile.am
index efe5d40..efe5d40 100644
--- a/patches/Makefile.am
+++ b/trunk/patches/Makefile.am
diff --git a/patches/Makefile.in b/trunk/patches/Makefile.in
index 8412943..8412943 100644
--- a/patches/Makefile.in
+++ b/trunk/patches/Makefile.in
diff --git a/patches/libelf-0.7.0-hash.patch b/trunk/patches/libelf-0.7.0-hash.patch
index 7fcf7f3..7fcf7f3 100644
--- a/patches/libelf-0.7.0-hash.patch
+++ b/trunk/patches/libelf-0.7.0-hash.patch
diff --git a/patches/libelf-0.7.0.patch b/trunk/patches/libelf-0.7.0.patch
index 1e9e57a..1e9e57a 100644
--- a/patches/libelf-0.7.0.patch
+++ b/trunk/patches/libelf-0.7.0.patch
diff --git a/patches/linux-2.4.10.patch b/trunk/patches/linux-2.4.10.patch
index dbd6702..dbd6702 100644
--- a/patches/linux-2.4.10.patch
+++ b/trunk/patches/linux-2.4.10.patch
diff --git a/src/Makefile.am b/trunk/src/Makefile.am
index d5675ab..6981801 100644
--- a/src/Makefile.am
+++ b/trunk/src/Makefile.am
@@ -11,7 +11,7 @@ sbin_PROGRAMS = prelink prelink-rtld
bin_PROGRAMS = execstack
arch_SOURCES = arch-i386.c arch-alpha.c arch-ppc.c arch-ppc64.c \
- arch-sparc.c arch-sparc64.c arch-x86_64.c \
+ arch-sparc.c arch-sparc64.c arch-x86_64.c arch-mips.c \
arch-s390.c arch-s390x.c arch-arm.c arch-sh.c arch-ia64.c
common_SOURCES = checksum.c data.c dso.c dwarf2.c dwarf2.h fptr.c fptr.h \
hashtab.c hashtab.h mdebug.c prelink.h stabs.c crc32.c \
diff --git a/src/Makefile.in b/trunk/src/Makefile.in
index 908f76c..7dbe941 100644
--- a/src/Makefile.in
+++ b/trunk/src/Makefile.in
@@ -106,7 +106,7 @@ sbin_PROGRAMS = prelink
bin_PROGRAMS = execstack
arch_SOURCES = arch-i386.c arch-alpha.c arch-ppc.c arch-ppc64.c \
- arch-sparc.c arch-sparc64.c arch-x86_64.c \
+ arch-sparc.c arch-sparc64.c arch-x86_64.c arch-mips.c \
arch-s390.c arch-s390x.c arch-arm.c arch-sh.c arch-ia64.c
common_SOURCES = checksum.c data.c dso.c dwarf2.c dwarf2.h fptr.c fptr.h \
@@ -138,8 +138,8 @@ am__objects_1 = checksum.$(OBJEXT) data.$(OBJEXT) dso.$(OBJEXT) \
am__objects_2 = arch-i386.$(OBJEXT) arch-alpha.$(OBJEXT) \
arch-ppc.$(OBJEXT) arch-ppc64.$(OBJEXT) arch-sparc.$(OBJEXT) \
arch-sparc64.$(OBJEXT) arch-x86_64.$(OBJEXT) \
- arch-s390.$(OBJEXT) arch-s390x.$(OBJEXT) arch-arm.$(OBJEXT) \
- arch-sh.$(OBJEXT) arch-ia64.$(OBJEXT)
+ arch-mips.$(OBJEXT) arch-s390.$(OBJEXT) arch-s390x.$(OBJEXT) \
+ arch-arm.$(OBJEXT) arch-sh.$(OBJEXT) arch-ia64.$(OBJEXT)
am_execstack_OBJECTS = execstack.$(OBJEXT) $(am__objects_1) \
$(am__objects_2)
execstack_OBJECTS = $(am_execstack_OBJECTS)
@@ -163,10 +163,10 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/arch-alpha.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/arch-arm.Po ./$(DEPDIR)/arch-i386.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/arch-ia64.Po ./$(DEPDIR)/arch-ppc.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/arch-ppc64.Po ./$(DEPDIR)/arch-s390.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/arch-s390x.Po ./$(DEPDIR)/arch-sh.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/arch-sparc.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/arch-ia64.Po ./$(DEPDIR)/arch-mips.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/arch-ppc.Po ./$(DEPDIR)/arch-ppc64.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/arch-s390.Po ./$(DEPDIR)/arch-s390x.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/arch-sh.Po ./$(DEPDIR)/arch-sparc.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/arch-sparc64.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/arch-x86_64.Po ./$(DEPDIR)/cache.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/canonicalize.Po ./$(DEPDIR)/checksum.Po \
@@ -279,6 +279,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-arm.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-i386.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-ia64.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-mips.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-ppc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-ppc64.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-s390.Po@am__quote@
diff --git a/src/arch-alpha.c b/trunk/src/arch-alpha.c
index 4b74aaa..51182ed 100644
--- a/src/arch-alpha.c
+++ b/trunk/src/arch-alpha.c
@@ -367,9 +367,12 @@ alpha_need_rel_to_rela (DSO *dso, int first, int last)
}
static int
-alpha_arch_prelink (DSO *dso)
+alpha_arch_prelink (struct prelink_info *info)
{
+ DSO *dso;
+
/* Correct sh_entsize on .plt sections. */
+ dso = info->dso;
if (dso->info[DT_PLTGOT])
{
int sec = addr_to_sec (dso, dso->info[DT_PLTGOT] + 16);
diff --git a/src/arch-arm.c b/trunk/src/arch-arm.c
index 607d428..12b8f3d 100644
--- a/src/arch-arm.c
+++ b/trunk/src/arch-arm.c
@@ -34,42 +34,6 @@
#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */
#endif
-static inline uint32_t
-read_une32 (DSO *dso, GElf_Addr addr)
-{
- if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
- return read_ule32 (dso, addr);
- else
- return read_ube32 (dso, addr);
-}
-
-static inline void
-write_ne32 (DSO *dso, GElf_Addr addr, uint32_t value)
-{
- if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
- write_le32 (dso, addr, value);
- else
- write_be32 (dso, addr, value);
-}
-
-static inline void
-buf_write_ne32 (DSO *dso, unsigned char *buf, uint32_t value)
-{
- if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
- buf_write_le32 (buf, value);
- else
- buf_write_be32 (buf, value);
-}
-
-static inline uint32_t
-buf_read_une32 (DSO *dso, unsigned char *data)
-{
- if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
- return buf_read_ule32 (data);
- else
- return buf_read_ube32 (data);
-}
-
static int
arm_adjust_dyn (DSO *dso, int n, GElf_Dyn *dyn, GElf_Addr start,
GElf_Addr adjust)
@@ -696,10 +660,12 @@ arm_need_rel_to_rela (DSO *dso, int first, int last)
}
static int
-arm_arch_prelink (DSO *dso)
+arm_arch_prelink (struct prelink_info *info)
{
+ DSO *dso;
int i;
+ dso = info->dso;
if (dso->info[DT_PLTGOT])
{
/* Write address of .plt into got[1].
diff --git a/src/arch-cris.c b/trunk/src/arch-cris.c
index dd45ff9..6b56016 100644
--- a/src/arch-cris.c
+++ b/trunk/src/arch-cris.c
@@ -309,10 +309,12 @@ cris_need_rel_to_rela (DSO *dso, int first, int last)
}
static int
-cris_arch_prelink (DSO *dso)
+cris_arch_prelink (struct prelink_info *info)
{
+ DSO *dso;
int i;
+ dso = info->dso;
if (dso->info[DT_PLTGOT])
{
/* Write address of .plt + 28 into got[1].
diff --git a/src/arch-i386.c b/trunk/src/arch-i386.c
index 3302211..d5211b2 100644
--- a/src/arch-i386.c
+++ b/trunk/src/arch-i386.c
@@ -599,10 +599,12 @@ i386_need_rel_to_rela (DSO *dso, int first, int last)
}
static int
-i386_arch_prelink (DSO *dso)
+i386_arch_prelink (struct prelink_info *info)
{
+ DSO *dso;
int i;
+ dso = info->dso;
if (dso->info[DT_PLTGOT])
{
/* Write address of .plt + 0x16 into got[1].
diff --git a/src/arch-ia64.c b/trunk/src/arch-ia64.c
index 958bf7c..0be672c 100644
--- a/src/arch-ia64.c
+++ b/trunk/src/arch-ia64.c
@@ -418,14 +418,16 @@ ia64_create_opd (struct prelink_info *info, int first, int last, int plt)
}
static int
-ia64_arch_prelink (DSO *dso)
+ia64_arch_prelink (struct prelink_info *info)
{
+ DSO *dso;
int plt = -1, got = -1, i;
const char *name;
/* Write address of .plt + 0x30 into .got[1].
.plt + 0x30 is what .IA_64.pltoff[0] contains unless prelinking. */
+ dso = info->dso;
for (i = 1; i < dso->ehdr.e_shnum; i++)
if (dso->shdr[i].sh_type == SHT_PROGBITS)
{
diff --git a/trunk/src/arch-mips.c b/trunk/src/arch-mips.c
new file mode 100644
index 0000000..f5a2361
--- /dev/null
+++ b/trunk/src/arch-mips.c
@@ -0,0 +1,1031 @@
+/* Copyright (C) 2006 CodeSourcery
+ Written by Richard Sandiford <richard@codesourcery.com>, 2006
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* GENERAL NOTES
+
+ The psABI defines R_MIPS_REL32 as A - EA + S, where the value of EA
+ depends on the symbol index. If the index is less than DT_MIPS_GOTSYM,
+ EA is the symbol's st_value "plus displacement". If the index is greater
+ than or equal to DT_MIPS_GOTSYM, EA is the original value of the
+ associated GOT entry.
+
+ However, glibc's dynamic linker implements a different definition.
+ If the index is less than DT_MIPS_GOTSYM, the dynamic linker adds the
+ symbol's st_value and the base address to the addend. If the index
+ is greater than or equal to DT_MIPS_GOTSYM, the dynamic linker adds
+ the final symbol value to the addend.
+
+ MIPS GOTs are divided into three parts:
+
+ - Reserved entries (of which GNU objects have 2)
+ - Local entries
+ - Global entries
+
+ DT_MIPS_LOCAL_GOTNO gives the total number of reserved and local
+ entries. The local entries all hold virtual addresses and the
+ dynamic linker will add the base address to each one.
+
+ Unlike most other architectures, the MIPS ABI does not use
+ relocations to initialize the global GOT entries. Instead, global
+ GOT entry X is mapped to dynamic symbol DT_MIPS_GOTSYM + X, and there
+ are a total of DT_MIPS_SYMTABNO - DT_MIPS_GOTSYM global GOT entries.
+
+ The interpretation of a global GOT entry depends on the symbol entry
+ and the initial GOT contents. The psABI lists the following cases:
+
+ st_shndx st_type st_value initial GOT value
+ -------- ------- -------- -----------------
+ A: SHN_UNDEF STT_FUNC 0 st_value (== 0) / QS
+ B: SHN_UNDEF STT_FUNC stub address st_value / QS
+ C: SHN_UNDEF all others 0 st_value (== 0) / QS
+ D: SHN_COMMON any alignment 0 / QS
+ E: all others STT_FUNC value st_value / stub address
+ F: all others all others value st_value
+
+ (wording slightly modified from the psABI table). Here, QS denotes
+ Quickstart values.
+
+ The dynamic linker treats each case as follows:
+
+ - [A, B when not binding lazily, C, D, E when not binding lazily, F]
+ Resolve the symbol and store its value in the GOT.
+
+ - [B when binding lazily] Set the GOT entry to the st_value plus
+ the base address.
+
+ - [E when binding lazily] If the GOT entry is different from the st_value,
+ add the base addreess to the GOT entry. Otherwise resolve the symbol
+ and store its value in the GOT (as for A, C, etc).
+
+ As the table shows, we can install Quickstart values for types A-D.
+ Installing Quickstart values for type F should be a no-op, because the
+ GOT should already hold the desired value. Installing Quickstart values
+ for type E would either be a no-op (if the GOT entry already contains
+ st_value) or would lose the address of the lazy binding stub. */
+
+#include <config.h>
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <locale.h>
+#include <error.h>
+#include <argp.h>
+#include <stdlib.h>
+
+#include "prelink.h"
+#include "layout.h"
+
+/* The thread pointer points 0x7000 past the first static TLS block. */
+#define TLS_TP_OFFSET 0x7000
+
+/* Dynamic thread vector pointers point 0x8000 past the start of each
+ TLS block. */
+#define TLS_DTV_OFFSET 0x8000
+
+/* The number of reserved entries at the beginning of the GOT.
+ The dynamic linker points entry 0 to the resolver function
+ and entry 1 to the link_map. */
+#define RESERVED_GOTNO 2
+
+/* A structure for iterating over local GOT entries. */
+struct mips_local_got_iterator {
+ /* The DSO containing the GOT. */
+ DSO *dso;
+
+ /* The size of a GOT entry. */
+ GElf_Word entry_size;
+
+ /* The index of the current GOT entry. */
+ GElf_Word got_index;
+
+ /* A pointer to the current GOT entry. */
+ unsigned char *got_entry;
+
+ /* True if we failed to read an entry correctly. */
+ int failed;
+
+ /* Used internally to obtain GOT_ENTRY. */
+ struct data_iterator got_iterator;
+};
+
+/* Set up LGI to iterate over DSO's local GOT. The caller should use
+ mips_get_local_got_entry to read the first entry. */
+
+static inline void
+mips_init_local_got_iterator (struct mips_local_got_iterator *lgi, DSO *dso)
+{
+ lgi->dso = dso;
+ lgi->entry_size = gelf_fsize (dso->elf, ELF_T_WORD, 1, EV_CURRENT);
+ lgi->got_index = RESERVED_GOTNO - 1;
+ lgi->failed = 0;
+ init_data_iterator (&lgi->got_iterator, dso,
+ dso->info[DT_PLTGOT]
+ + (lgi->got_index + 1) * lgi->entry_size);
+}
+
+/* Return true if LGI has not reached the end of the GOT and if the next
+ entry can be accessed. When returning true, use LGI's fields to
+ describe the next entry. */
+
+static inline int
+mips_get_local_got_entry (struct mips_local_got_iterator *lgi)
+{
+ lgi->got_index++;
+ if (lgi->got_index >= lgi->dso->info_DT_MIPS_LOCAL_GOTNO)
+ return 0;
+
+ lgi->got_entry = get_data_from_iterator (&lgi->got_iterator,
+ lgi->entry_size);
+ if (lgi->got_entry == NULL)
+ {
+ error (0, 0, "%s: Malformed local GOT\n", lgi->dso->filename);
+ lgi->failed = 1;
+ return 0;
+ }
+
+ return 1;
+}
+
+/* A structure for iterating over global GOT entries. */
+struct mips_global_got_iterator {
+ /* The DSO containing the GOT. */
+ DSO *dso;
+
+ /* The size of a GOT entry. */
+ GElf_Word entry_size;
+
+ /* The virtual address of the current GOT entry. */
+ GElf_Addr got_addr;
+
+ /* The index of the associated entry in the dynamic symbol table. */
+ GElf_Word sym_index;
+
+ /* A pointer to the current GOT entry. */
+ unsigned char *got_entry;
+
+ /* The symbol associated with the current GOT entry. */
+ GElf_Sym sym;
+
+ /* True if we failed to read an entry correctly. */
+ int failed;
+
+ /* Used internally to obtain GOT_ENTRY and SYM. */
+ struct data_iterator got_iterator;
+ struct data_iterator sym_iterator;
+};
+
+/* Set up GGI to iterate over DSO's global GOT. The caller should use
+ mips_get_global_got_entry to read the first entry. */
+
+static inline void
+mips_init_global_got_iterator (struct mips_global_got_iterator *ggi, DSO *dso)
+{
+ GElf_Word sym_size;
+
+ ggi->dso = dso;
+ ggi->entry_size = gelf_fsize (dso->elf, ELF_T_WORD, 1, EV_CURRENT);
+ ggi->got_addr = (dso->info[DT_PLTGOT]
+ + (dso->info_DT_MIPS_LOCAL_GOTNO - 1) * ggi->entry_size);
+ ggi->sym_index = dso->info_DT_MIPS_GOTSYM - 1;
+ ggi->failed = 0;
+
+ sym_size = gelf_fsize (dso->elf, ELF_T_SYM, 1, EV_CURRENT);
+ init_data_iterator (&ggi->got_iterator, dso,
+ ggi->got_addr + ggi->entry_size);
+ init_data_iterator (&ggi->sym_iterator, dso,
+ dso->info[DT_SYMTAB] + (ggi->sym_index + 1) * sym_size);
+}
+
+/* Return true if GGI has not reached the end of the GOT and if the next
+ entry can be accessed. When returning true, use GGI's fields to
+ describe the next entry. */
+
+static inline int
+mips_get_global_got_entry (struct mips_global_got_iterator *ggi)
+{
+ ggi->sym_index++;
+ ggi->got_addr += ggi->entry_size;
+ if (ggi->sym_index >= ggi->dso->info_DT_MIPS_SYMTABNO)
+ return 0;
+
+ ggi->got_entry = get_data_from_iterator (&ggi->got_iterator,
+ ggi->entry_size);
+ if (ggi->got_entry == NULL
+ || !get_sym_from_iterator (&ggi->sym_iterator, &ggi->sym))
+ {
+ error (0, 0, "%s: Malformed global GOT\n", ggi->dso->filename);
+ ggi->failed = 1;
+ return 0;
+ }
+
+ return 1;
+}
+
+static int
+mips_arch_adjust (DSO *dso, GElf_Addr start, GElf_Addr adjust)
+{
+ struct mips_local_got_iterator lgi;
+ struct mips_global_got_iterator ggi;
+ GElf_Addr value;
+
+ if (dso->info[DT_PLTGOT] == 0)
+ return 0;
+
+ /* Adjust every local GOT entry by ADJUST. Every adjustment moves
+ the code and data, so we do not need to check START here. */
+ mips_init_local_got_iterator (&lgi, dso);
+ while (mips_get_local_got_entry (&lgi))
+ {
+ value = buf_read_une32 (dso, lgi.got_entry);
+ buf_write_ne32 (dso, lgi.got_entry, value + adjust);
+ }
+
+ /* Adjust every global GOT entry. Referring to the table above:
+
+ For [A, B, C]: Adjust the GOT entry if it contains st_value
+ and if the symbol's value will be adjusted.
+
+ For [D]: Do nothing. SHN_COMMON entries never need adjusting.
+
+ For [E, F]: Adjust the GOT entry if it does not contain st_value
+ -- in other words, if it is a type E entry that points to a lazy
+ binding stub -- or if the symbol's value will also be adjusted. */
+ mips_init_global_got_iterator (&ggi, dso);
+ while (mips_get_global_got_entry (&ggi))
+ {
+ value = buf_read_une32 (dso, ggi.got_entry);
+ if (ggi.sym.st_shndx != SHN_COMMON
+ && value >= start
+ && (value == ggi.sym.st_value
+ ? adjust_symbol_p (dso, &ggi.sym)
+ : ggi.sym.st_shndx != SHN_UNDEF))
+ buf_write_ne32 (dso, ggi.got_entry, value + adjust);
+ }
+
+ return lgi.failed || ggi.failed;
+}
+
+static int
+mips_adjust_dyn (DSO *dso, int n, GElf_Dyn *dyn, GElf_Addr start,
+ GElf_Addr adjust)
+{
+ switch (dyn->d_tag)
+ {
+ case DT_MIPS_TIME_STAMP:
+ case DT_MIPS_ICHECKSUM:
+ case DT_MIPS_IVERSION:
+ case DT_MIPS_CONFLICT:
+ case DT_MIPS_CONFLICTNO:
+ case DT_MIPS_LIBLIST:
+ case DT_MIPS_LIBLISTNO:
+ error (0, 0, "%s: File contains QuickStart information", dso->filename);
+ return 1;
+
+ case DT_MIPS_BASE_ADDRESS:
+ case DT_MIPS_RLD_MAP:
+ case DT_MIPS_OPTIONS:
+ if (dyn->d_un.d_ptr >= start)
+ dyn->d_un.d_ptr += adjust;
+ return 1;
+
+ case DT_MIPS_LOCAL_GOTNO:
+ case DT_MIPS_UNREFEXTNO:
+ case DT_MIPS_SYMTABNO:
+ case DT_MIPS_HIPAGENO:
+ case DT_MIPS_GOTSYM:
+ /* We don't change the layout of the GOT or symbol table. */
+ return 1;
+
+ case DT_MIPS_RLD_VERSION:
+ case DT_MIPS_FLAGS:
+ /* We don't change these properties. */
+ return 1;
+ }
+ return 0;
+}
+
+/* Read the addend for a relocation in DSO. If RELA is nonnull,
+ use its r_addend, otherwise read a 32-bit in-place addend from
+ address R_OFFSET. */
+
+static inline uint32_t
+mips_read_addend (DSO *dso, GElf_Addr r_offset, GElf_Rela *rela)
+{
+ return rela ? rela->r_addend : read_une32 (dso, r_offset);
+}
+
+/* Like mips_read_addend, but change the addend to VALUE. */
+
+static inline void
+mips_write_addend (DSO *dso, GElf_Addr r_offset, GElf_Rela *rela,
+ uint32_t value)
+{
+ if (rela)
+ rela->r_addend = (int32_t) value;
+ else
+ write_ne32 (dso, r_offset, value);
+}
+
+/* There is a relocation of type R_INFO against address R_OFFSET in DSO.
+ Adjust it so that virtual addresses >= START are increased by ADJUST
+ If the relocation is in a RELA section, RELA points to the relocation,
+ otherwise it is null. */
+
+static int
+mips_adjust_reloc (DSO *dso, GElf_Addr r_offset, GElf_Xword r_info,
+ GElf_Addr start, GElf_Addr adjust, GElf_Rela *rela)
+{
+ GElf_Addr value;
+ GElf_Word r_sym;
+
+ if (GELF_R_TYPE (r_info) == R_MIPS_REL32)
+ {
+ r_sym = GELF_R_SYM (r_info);
+ if (r_sym < dso->info_DT_MIPS_GOTSYM)
+ {
+ /* glibc's dynamic linker adds the symbol's st_value and the
+ base address to the addend. It therefore treats all symbols
+ as being relative, even if they would normally be considered
+ absolute. For example, the special null symbol should always
+ have the value zero, even when the base address is nonzero,
+ but R_MIPS_REL32 relocations against the null symbol must
+ nevertheles be adjusted as if that symbol were relative.
+ The same would apply to SHN_ABS symbols too.
+
+ Thus the result of the relocation calculation must always
+ be adjusted by ADJUST. (We do not need to check START because
+ every adjustment requested by the caller will affect all
+ legitimate local relocation values.) This means that we
+ should add ADJUST to the addend if and only if the symbol's
+ value is not being adjusted.
+
+ In general, we can only check whether a symbol's value is
+ being adjusted by reading its entry in the dynamic symbol
+ table and then querying adjust_symbol_p. However, this
+ generality is fortunately not needed. Modern versions
+ of binutils will never generate R_MIPS_REL32 relocations
+ against symbols in the range [1, DT_MIPS_GOTSYM), so we
+ only need to handle relocations against the null symbol. */
+ if (r_sym != 0)
+ {
+ error (0, 0, "%s: The prelinker does not support R_MIPS_REL32"
+ " relocs against local symbols", dso->filename);
+ return 1;
+ }
+ value = mips_read_addend (dso, r_offset, rela);
+ mips_write_addend (dso, r_offset, rela, value + adjust);
+ }
+ }
+ return 0;
+}
+
+static int
+mips_adjust_rel (DSO *dso, GElf_Rel *rel, GElf_Addr start, GElf_Addr adjust)
+{
+ return mips_adjust_reloc (dso, rel->r_offset, rel->r_info,
+ start, adjust, NULL);
+}
+
+static int
+mips_adjust_rela (DSO *dso, GElf_Rela *rela, GElf_Addr start, GElf_Addr adjust)
+{
+ return mips_adjust_reloc (dso, rela->r_offset, rela->r_info,
+ start, adjust, rela);
+}
+
+/* Calculate relocation RELA as A + VALUE and store the result in DSO. */
+
+static void
+mips_prelink_32bit_reloc (DSO *dso, GElf_Rela *rela, GElf_Addr value)
+{
+ assert (rela != NULL);
+ write_ne32 (dso, rela->r_offset, value + rela->r_addend);
+}
+
+/* There is a relocation of type R_INFO against address R_OFFSET in DSO.
+ Prelink the relocation field, using INFO to look up symbol values.
+ If the relocation is in a RELA section, RELA points to the relocation,
+ otherwise it is null. */
+
+static int
+mips_prelink_reloc (struct prelink_info *info, GElf_Addr r_offset,
+ GElf_Xword r_info, GElf_Rela *rela)
+{
+ DSO *dso;
+ GElf_Addr value;
+ GElf_Word r_sym;
+ int r_type;
+
+ dso = info->dso;
+ r_sym = GELF_R_SYM (r_info);
+ r_type = GELF_R_TYPE (r_info);
+ switch (r_type)
+ {
+ case R_MIPS_NONE:
+ break;
+
+ case R_MIPS_REL32:
+ /* An in-place R_MIPS_REL32 relocation against symbol 0 needs no
+ adjustment. */
+ if (rela != NULL || GELF_R_SYM (r_info) != 0)
+ {
+ value = info->resolve (info, r_sym, r_type);
+ mips_prelink_32bit_reloc (dso, rela, value);
+ }
+ break;
+
+ case R_MIPS_GLOB_DAT:
+ write_ne32 (dso, r_offset, info->resolve (info, r_sym, r_type));
+ break;
+
+ case R_MIPS_TLS_DTPMOD32:
+ if (dso->ehdr.e_type == ET_EXEC)
+ {
+ error (0, 0, "%s: R_MIPS_TLS_DTPMOD32 reloc in executable?",
+ dso->filename);
+ return 1;
+ }
+ /* These relocations will be resolved using a conflict. We need
+ not change the field value here. */
+ break;
+
+ case R_MIPS_TLS_DTPREL32:
+ value = info->resolve (info, r_sym, r_type);
+ mips_prelink_32bit_reloc (dso, rela, value - TLS_DTV_OFFSET);
+ break;
+
+ case R_MIPS_TLS_TPREL32:
+ /* Relocations in a shared library will be resolved using a conflict.
+ We need not change the relocation field here. */
+ if (dso->ehdr.e_type == ET_EXEC)
+ {
+ value = info->resolve (info, r_sym, r_type);
+ value += info->resolvetls->offset - TLS_TP_OFFSET;
+ mips_prelink_32bit_reloc (dso, rela, value);
+ }
+ break;
+
+ default:
+ error (0, 0, "%s: Unknown MIPS relocation type %d",
+ dso->filename, (int) GELF_R_TYPE (r_info));
+ return 1;
+ }
+ return 0;
+}
+
+static int
+mips_prelink_rel (struct prelink_info *info, GElf_Rel *rel, GElf_Addr reladdr)
+{
+ DSO *dso;
+
+ /* Convert R_MIPS_REL32 relocations against global symbols into
+ R_MIPS_GLOB_DAT if the addend is zero. */
+ dso = info->dso;
+ if (GELF_R_TYPE (rel->r_info) == R_MIPS_REL32
+ && GELF_R_SYM (rel->r_info) >= dso->info_DT_MIPS_GOTSYM
+ && read_une32 (dso, rel->r_offset) == 0)
+ {
+ rel->r_info = GELF_R_INFO (GELF_R_SYM (rel->r_info), R_MIPS_GLOB_DAT);
+ write_ne32 (dso, rel->r_offset,
+ info->resolve (info, GELF_R_SYM (rel->r_info),
+ GELF_R_TYPE (rel->r_info)));
+ return 2;
+ }
+ return mips_prelink_reloc (info, rel->r_offset, rel->r_info, NULL);
+}
+
+static int
+mips_prelink_rela (struct prelink_info *info, GElf_Rela *rela,
+ GElf_Addr relaaddr)
+{
+ return mips_prelink_reloc (info, rela->r_offset, rela->r_info, rela);
+}
+
+/* CONFLICT is a conflict returned by prelink_conflict for a symbol
+ belonging to DSO. Set *TLS_OUT to the associated TLS information.
+ Return 1 on failure. */
+
+static int
+mips_get_tls (DSO *dso, struct prelink_conflict *conflict,
+ struct prelink_tls **tls_out)
+{
+ if (conflict->reloc_class != RTYPE_CLASS_TLS
+ || conflict->lookup.tls == NULL)
+ {
+ error (0, 0, "%s: R_MIPS_TLS not resolving to STT_TLS symbol",
+ dso->filename);
+ return 1;
+ }
+
+ *tls_out = conflict->lookup.tls;
+ return 0;
+}
+
+/* There is a relocation of type R_INFO against address R_OFFSET in DSO.
+ See if the relocation field must be adjusted by a conflict when DSO
+ is used in the context described by INFO. Add a conflict entry if so.
+ If the relocation is in a RELA section, RELA points to the relocation,
+ otherwise it is null. */
+
+static int
+mips_prelink_conflict_reloc (DSO *dso, struct prelink_info *info,
+ GElf_Addr r_offset, GElf_Xword r_info,
+ GElf_Rela *rela)
+{
+ GElf_Addr value;
+ struct prelink_conflict *conflict;
+ struct prelink_tls *tls;
+ GElf_Rela *entry;
+
+ conflict = prelink_conflict (info, GELF_R_SYM (r_info),
+ GELF_R_TYPE (r_info));
+ if (conflict == NULL)
+ {
+ switch (GELF_R_TYPE (r_info))
+ {
+ case R_MIPS_TLS_DTPMOD32:
+ case R_MIPS_TLS_TPREL32:
+ tls = info->curtls;
+ if (tls == NULL)
+ return 0;
+ /* A relocation against symbol 0. A shared library cannot
+ know what the final module IDs or TP-relative offsets are,
+ so the executable must always have a conflict for them. */
+ value = 0;
+ break;
+ default:
+ return 0;
+ }
+ }
+ else
+ {
+ /* DTPREL32 relocations just involve the symbol value; no other
+ TLS information is needed. Ignore conflicts created from a
+ lookup of type RTYPE_CLASS_TLS if no real conflict exists. */
+ if (GELF_R_TYPE (r_info) == R_MIPS_TLS_DTPREL32
+ && conflict->lookup.tls == conflict->conflict.tls
+ && conflict->lookupval == conflict->conflictval)
+ return 0;
+
+ value = conflict_lookup_value (conflict);
+ }
+ /* VALUE now contains the final symbol value. Change it to the
+ value we want to store at R_OFFSET. */
+ switch (GELF_R_TYPE (r_info))
+ {
+ case R_MIPS_REL32:
+ value += mips_read_addend (dso, r_offset, rela);
+ break;
+
+ case R_MIPS_GLOB_DAT:
+ break;
+
+ case R_MIPS_TLS_DTPMOD32:
+ if (conflict != NULL && mips_get_tls (dso, conflict, &tls) == 1)
+ return 1;
+ value = tls->modid;
+ break;
+
+ case R_MIPS_TLS_DTPREL32:
+ value += mips_read_addend (dso, r_offset, rela) - TLS_DTV_OFFSET;
+ break;
+
+ case R_MIPS_TLS_TPREL32:
+ if (conflict != NULL && mips_get_tls (dso, conflict, &tls) == 1)
+ return 1;
+ value += (mips_read_addend (dso, r_offset, rela)
+ + tls->offset - TLS_TP_OFFSET);
+ break;
+
+ default:
+ error (0, 0, "%s: Unknown MIPS relocation type %d", dso->filename,
+ (int) GELF_R_TYPE (r_info));
+ return 1;
+ }
+ /* Create and initialize a conflict entry. */
+ entry = prelink_conflict_add_rela (info);
+ if (entry == NULL)
+ return 1;
+ entry->r_addend = (int32_t) value;
+ entry->r_offset = r_offset;
+ entry->r_info = GELF_R_INFO (0, R_MIPS_REL32);
+ return 0;
+}
+
+static int
+mips_prelink_conflict_rel (DSO *dso, struct prelink_info *info,
+ GElf_Rel *rel, GElf_Addr reladdr)
+{
+ return mips_prelink_conflict_reloc (dso, info, rel->r_offset,
+ rel->r_info, NULL);
+}
+
+static int
+mips_prelink_conflict_rela (DSO *dso, struct prelink_info *info,
+ GElf_Rela *rela, GElf_Addr relaaddr)
+{
+ return mips_prelink_conflict_reloc (dso, info, rela->r_offset,
+ rela->r_info, rela);
+}
+
+static int
+mips_arch_prelink_conflict (DSO *dso, struct prelink_info *info)
+{
+ struct mips_global_got_iterator ggi;
+ GElf_Addr value;
+ struct prelink_conflict *conflict;
+ GElf_Rela *entry;
+
+ if (dso->info[DT_PLTGOT] == 0)
+ return 0;
+
+ /* Add a conflict for every global GOT entry that does not hold the
+ right value, either because of a conflict, or because the DSO has
+ a lazy binding stub for a symbol that it also defines. */
+ mips_init_global_got_iterator (&ggi, dso);
+ while (mips_get_global_got_entry (&ggi))
+ {
+ conflict = prelink_conflict (info, ggi.sym_index, R_MIPS_REL32);
+ if (conflict != NULL)
+ value = conflict_lookup_value (conflict);
+ else if (ggi.sym.st_shndx != SHN_UNDEF
+ && ggi.sym.st_shndx != SHN_COMMON)
+ value = ggi.sym.st_value;
+ else
+ continue;
+ if (buf_read_une32 (dso, ggi.got_entry) != value)
+ {
+ entry = prelink_conflict_add_rela (info);
+ if (entry == NULL)
+ return 1;
+ entry->r_addend = (int32_t) value;
+ entry->r_offset = ggi.got_addr;
+ entry->r_info = GELF_R_INFO (0, R_MIPS_REL32);
+ }
+ }
+
+ return ggi.failed;
+}
+
+static int
+mips_apply_conflict_rela (struct prelink_info *info, GElf_Rela *rela,
+ char *buf)
+{
+ switch (GELF_R_TYPE (rela->r_info))
+ {
+ case R_MIPS_REL32:
+ buf_write_ne32 (info->dso, buf, rela->r_addend);
+ break;
+
+ default:
+ abort ();
+ }
+ return 0;
+}
+
+/* BUF points to a 32-bit field in DSO that is subject to relocation.
+ If the relocation is in a RELA section, RELA points to the relocation,
+ otherwise it is null. Add the addend to ADJUSTMENT and install the
+ result. */
+
+static inline void
+mips_apply_adjustment (DSO *dso, GElf_Rela *rela, char *buf,
+ GElf_Addr adjustment)
+{
+ if (rela)
+ adjustment += rela->r_addend;
+ else
+ adjustment += buf_read_une32 (dso, buf);
+ buf_write_ne32 (dso, buf, adjustment);
+}
+
+static int
+mips_apply_reloc (struct prelink_info *info, GElf_Xword r_info,
+ GElf_Rela *rela, char *buf)
+{
+ DSO *dso;
+
+ dso = info->dso;
+ switch (GELF_R_TYPE (r_info))
+ {
+ case R_MIPS_NONE:
+ break;
+
+ case R_MIPS_REL32:
+ mips_apply_adjustment (dso, rela, buf,
+ info->resolve (info, GELF_R_SYM (r_info),
+ GELF_R_TYPE (r_info)));
+ break;
+
+ default:
+ return 1;
+ }
+ return 0;
+}
+
+static int
+mips_apply_rel (struct prelink_info *info, GElf_Rel *rel, char *buf)
+{
+ return mips_apply_reloc (info, rel->r_info, NULL, buf);
+}
+
+static int
+mips_apply_rela (struct prelink_info *info, GElf_Rela *rela, char *buf)
+{
+ return mips_apply_reloc (info, rela->r_info, rela, buf);
+}
+
+static int
+mips_rel_to_rela (DSO *dso, GElf_Rel *rel, GElf_Rela *rela)
+{
+ rela->r_offset = rel->r_offset;
+ rela->r_info = rel->r_info;
+ switch (GELF_R_TYPE (rel->r_info))
+ {
+ case R_MIPS_REL32:
+ case R_MIPS_TLS_DTPREL32:
+ case R_MIPS_TLS_TPREL32:
+ /* These relocations have an in-place addend. */
+ rela->r_addend = (int32_t) read_une32 (dso, rel->r_offset);
+ break;
+
+ case R_MIPS_NONE:
+ case R_MIPS_GLOB_DAT:
+ case R_MIPS_TLS_DTPMOD32:
+ /* These relocations have no addend. */
+ rela->r_addend = 0;
+ break;
+
+ default:
+ error (0, 0, "%s: Unknown MIPS relocation type %d", dso->filename,
+ (int) GELF_R_TYPE (rel->r_info));
+ return 1;
+ }
+ return 0;
+}
+
+static int
+mips_rela_to_rel (DSO *dso, GElf_Rela *rela, GElf_Rel *rel)
+{
+ rel->r_offset = rela->r_offset;
+ rel->r_info = rela->r_info;
+ switch (GELF_R_TYPE (rela->r_info))
+ {
+ case R_MIPS_NONE:
+ break;
+
+ case R_MIPS_REL32:
+ case R_MIPS_TLS_DTPREL32:
+ case R_MIPS_TLS_TPREL32:
+ /* These relocations have an in-place addend. */
+ write_ne32 (dso, rela->r_offset, rela->r_addend);
+ break;
+
+ case R_MIPS_GLOB_DAT:
+ case R_MIPS_TLS_DTPMOD32:
+ /* These relocations have no addend. */
+ write_ne32 (dso, rela->r_offset, 0);
+ break;
+
+ default:
+ error (0, 0, "%s: Unknown MIPS relocation type %d", dso->filename,
+ (int) GELF_R_TYPE (rela->r_info));
+ return 1;
+ }
+ return 0;
+}
+
+static int
+mips_need_rel_to_rela (DSO *dso, int first, int last)
+{
+ Elf_Data *data;
+ Elf_Scn *scn;
+ Elf32_Rel *rel, *relend;
+ int n;
+
+ for (n = first; n <= last; n++)
+ {
+ data = NULL;
+ scn = dso->scn[n];
+ while ((data = elf_getdata (scn, data)) != NULL)
+ {
+ rel = (Elf32_Rel *) data->d_buf;
+ relend = rel + data->d_size / sizeof (Elf32_Rel);
+ for (; rel < relend; rel++)
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_MIPS_NONE:
+ break;
+
+ case R_MIPS_REL32:
+ /* The SVR4 definition was designed to allow exactly the
+ sort of prelinking we want to do here, in combination
+ with Quickstart. Unfortunately, glibc's definition
+ makes it impossible for relocations against anything
+ other than the null symbol. We get around this for
+ zero addends by using a R_MIPS_GLOB_DAT relocation
+ instead, where R_MIPS_GLOB_DAT is a GNU extension
+ added specifically for this purpose. */
+ if (ELF32_R_SYM (rel->r_info) != 0
+ && (ELF32_R_SYM (rel->r_info) < dso->info_DT_MIPS_GOTSYM
+ || read_une32 (dso, rel->r_offset) != 0))
+ return 1;
+ break;
+
+ case R_MIPS_GLOB_DAT:
+ /* This relocation has no addend. */
+ break;
+
+ case R_MIPS_TLS_DTPMOD32:
+ /* The relocation will be resolved using a conflict. */
+ break;
+
+ case R_MIPS_TLS_DTPREL32:
+ /* We can prelink these fields, and the addend is relative
+ to the symbol value. A RELA entry is needed. */
+ return 1;
+
+ case R_MIPS_TLS_TPREL32:
+ /* Relocations in shared libraries will be resolved by a
+ conflict. Relocations in executables will not, and the
+ addend is relative to the symbol value. */
+ if (dso->ehdr.e_type == ET_EXEC)
+ return 1;
+ break;
+
+ default:
+ error (0, 0, "%s: Unknown MIPS relocation type %d",
+ dso->filename, (int) GELF_R_TYPE (rel->r_info));
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+static int
+mips_reloc_size (int reloc_type)
+{
+ return 4;
+}
+
+static int
+mips_reloc_class (int reloc_type)
+{
+ switch (reloc_type)
+ {
+ case R_MIPS_TLS_DTPMOD32:
+ case R_MIPS_TLS_DTPREL32:
+ case R_MIPS_TLS_TPREL32:
+ return RTYPE_CLASS_TLS;
+ default:
+ /* MIPS lazy resolution stubs are local to the containing object,
+ so SHN_UNDEF symbols never participate in symbol lookup. */
+ return RTYPE_CLASS_PLT;
+ }
+}
+
+static int
+mips_arch_prelink (struct prelink_info *info)
+{
+ struct mips_global_got_iterator ggi;
+ DSO *dso;
+ GElf_Addr value;
+
+ dso = info->dso;
+ if (dso->info[DT_PLTGOT] == 0)
+ return 0;
+
+ /* Install Quickstart values for all global GOT entries of type A-D
+ in the table above. */
+ mips_init_global_got_iterator (&ggi, dso);
+ while (mips_get_global_got_entry (&ggi))
+ {
+ value = info->resolve (info, ggi.sym_index, R_MIPS_REL32);
+ if (ggi.sym.st_shndx == SHN_UNDEF
+ || ggi.sym.st_shndx == SHN_COMMON)
+ buf_write_ne32 (dso, ggi.got_entry, value);
+ else
+ {
+ /* Type E and F in the table above. We cannot install Quickstart
+ values for type E, but we should never need to in executables,
+ because an executable should not use lazy binding stubs for
+ symbols it defines itself. Although we could in theory just
+ discard any such stub address, it goes against the principle
+ that prelinking should be reversible.
+
+ When type E entries occur in shared libraries, we can fix
+ them up using conflicts.
+
+ Type F entries should never need a Quickstart value -- the
+ current value should already be correct. However, the conflict
+ code will cope correctly with malformed type F entries in
+ shared libraries, so we only complain about executables here. */
+ if (dso->ehdr.e_type == ET_EXEC
+ && value != buf_read_une32 (dso, ggi.got_entry))
+ {
+ error (0, 0, "%s: The global GOT entries for defined symbols"
+ " do not match their st_values\n", dso->filename);
+ return 1;
+ }
+ }
+ }
+ return ggi.failed;
+}
+
+static int
+mips_arch_undo_prelink (DSO *dso)
+{
+ struct mips_global_got_iterator ggi;
+
+ if (dso->info[DT_PLTGOT] == 0)
+ return 0;
+
+ mips_init_global_got_iterator (&ggi, dso);
+ while (mips_get_global_got_entry (&ggi))
+ if (ggi.sym.st_shndx == SHN_UNDEF)
+ /* Types A-C in the table above. */
+ buf_write_ne32 (dso, ggi.got_entry, ggi.sym.st_value);
+ else if (ggi.sym.st_shndx == SHN_COMMON)
+ /* Type D in the table above. */
+ buf_write_ne32 (dso, ggi.got_entry, 0);
+ return ggi.failed;
+}
+
+static int
+mips_undo_prelink_rel (DSO *dso, GElf_Rel *rel, GElf_Addr reladdr)
+{
+ /* Convert R_MIPS_GLOB_DAT relocations back into R_MIPS_REL32
+ relocations. Ideally we'd have some mechanism for recording
+ these changes in the undo section, but in the absence of that,
+ it's better to assume that the original relocation was
+ R_MIPS_REL32; R_MIPS_GLOB_DAT was added specifically for the
+ prelinker and shouldn't be used in non-prelinked binaries. */
+ if (GELF_R_TYPE (rel->r_info) == R_MIPS_GLOB_DAT)
+ {
+ write_ne32 (dso, rel->r_offset, 0);
+ rel->r_info = GELF_R_INFO (GELF_R_SYM (rel->r_info), R_MIPS_REL32);
+ return 2;
+ }
+ return 0;
+}
+
+PL_ARCH = {
+ .name = "MIPS",
+ .class = ELFCLASS32,
+ .machine = EM_MIPS,
+ .max_reloc_size = 4,
+ .dynamic_linker = "/lib/ld.so.1",
+ /* MIPS does not use COPY relocs or jump slots. Pick a value outside
+ the ELF32_R_TYPE range. */
+ .R_COPY = ~0U,
+ .R_JMP_SLOT = ~0U,
+ /* R_MIPS_REL32 relocations against symbol 0 do act as relative relocs,
+ but those against other symbols don't. */
+ .R_RELATIVE = ~0U,
+ .arch_adjust = mips_arch_adjust,
+ .adjust_dyn = mips_adjust_dyn,
+ .adjust_rel = mips_adjust_rel,
+ .adjust_rela = mips_adjust_rela,
+ .prelink_rel = mips_prelink_rel,
+ .prelink_rela = mips_prelink_rela,
+ .prelink_conflict_rel = mips_prelink_conflict_rel,
+ .prelink_conflict_rela = mips_prelink_conflict_rela,
+ .arch_prelink_conflict = mips_arch_prelink_conflict,
+ .apply_conflict_rela = mips_apply_conflict_rela,
+ .apply_rel = mips_apply_rel,
+ .apply_rela = mips_apply_rela,
+ .rel_to_rela = mips_rel_to_rela,
+ .rela_to_rel = mips_rela_to_rel,
+ .need_rel_to_rela = mips_need_rel_to_rela,
+ .reloc_size = mips_reloc_size,
+ .reloc_class = mips_reloc_class,
+ .arch_prelink = mips_arch_prelink,
+ .arch_undo_prelink = mips_arch_undo_prelink,
+ .undo_prelink_rel = mips_undo_prelink_rel,
+ /* Although TASK_UNMAPPED_BASE is 0x2aaa8000, we leave some
+ area so that mmap of /etc/ld.so.cache and ld.so's malloc
+ does not take some library's VA slot.
+ Also, if this guard area isn't too small, typically
+ even dlopened libraries will get the slots they desire. */
+ .mmap_base = 0x2c000000,
+ .mmap_end = 0x3c000000,
+ .max_page_size = 0x10000,
+ .page_size = 0x1000
+};
diff --git a/src/arch-ppc.c b/trunk/src/arch-ppc.c
index 4799755..5608750 100644
--- a/src/arch-ppc.c
+++ b/trunk/src/arch-ppc.c
@@ -668,8 +668,9 @@ ppc_arch_pre_prelink (DSO *dso)
}
static int
-ppc_arch_prelink (DSO *dso)
+ppc_arch_prelink (struct prelink_info *info)
{
+ DSO *dso = info->dso;
Elf32_Addr plt = dso->info[DT_PLTGOT];
if (plt && !dynamic_info_is_set (dso, DT_PPC_GOT_BIT))
diff --git a/src/arch-ppc64.c b/trunk/src/arch-ppc64.c
index 3b12dbe..3b12dbe 100644
--- a/src/arch-ppc64.c
+++ b/trunk/src/arch-ppc64.c
diff --git a/src/arch-s390.c b/trunk/src/arch-s390.c
index 989b05f..4be0dcb 100644
--- a/src/arch-s390.c
+++ b/trunk/src/arch-s390.c
@@ -337,10 +337,12 @@ s390_need_rel_to_rela (DSO *dso, int first, int last)
}
static int
-s390_arch_prelink (DSO *dso)
+s390_arch_prelink (struct prelink_info *info)
{
+ DSO *dso;
int i;
+ dso = info->dso;
if (dso->info[DT_PLTGOT])
{
/* Write address of .plt + 0x2c into got[1].
diff --git a/src/arch-s390x.c b/trunk/src/arch-s390x.c
index 8942524..1e381c7 100644
--- a/src/arch-s390x.c
+++ b/trunk/src/arch-s390x.c
@@ -418,10 +418,12 @@ s390x_need_rel_to_rela (DSO *dso, int first, int last)
}
static int
-s390x_arch_prelink (DSO *dso)
+s390x_arch_prelink (struct prelink_info *info)
{
+ DSO *dso;
int i;
+ dso = info->dso;
if (dso->info[DT_PLTGOT])
{
/* Write address of .plt + 0x2e into got[1].
diff --git a/src/arch-sh.c b/trunk/src/arch-sh.c
index 2b3ffb7..6ddf5f6 100644
--- a/src/arch-sh.c
+++ b/trunk/src/arch-sh.c
@@ -28,33 +28,6 @@
#include "prelink.h"
-static inline uint32_t
-read_une32 (DSO *dso, GElf_Addr addr)
-{
- if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
- return read_ule32 (dso, addr);
- else
- return read_ube32 (dso, addr);
-}
-
-static inline void
-write_ne32 (DSO *dso, GElf_Addr addr, uint32_t value)
-{
- if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
- write_le32 (dso, addr, value);
- else
- write_be32 (dso, addr, value);
-}
-
-static inline void
-buf_write_ne32 (DSO *dso, unsigned char *buf, uint32_t value)
-{
- if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
- buf_write_le32 (buf, value);
- else
- buf_write_be32 (buf, value);
-}
-
static int
sh_adjust_dyn (DSO *dso, int n, GElf_Dyn *dyn, GElf_Addr start,
GElf_Addr adjust)
@@ -300,10 +273,12 @@ sh_need_rel_to_rela (DSO *dso, int first, int last)
}
static int
-sh_arch_prelink (DSO *dso)
+sh_arch_prelink (struct prelink_info *info)
{
+ DSO *dso;
int i;
+ dso = info->dso;
if (dso->info[DT_PLTGOT])
{
/* Write address of .plt + 36 into got[1].
diff --git a/src/arch-sparc.c b/trunk/src/arch-sparc.c
index cdb6bc4..98bacac 100644
--- a/src/arch-sparc.c
+++ b/trunk/src/arch-sparc.c
@@ -471,7 +471,7 @@ sparc_need_rel_to_rela (DSO *dso, int first, int last)
}
static int
-sparc_arch_prelink (DSO *dso)
+sparc_arch_prelink (struct prelink_info *info)
{
return 0;
}
diff --git a/src/arch-sparc64.c b/trunk/src/arch-sparc64.c
index 088e5b0..e673e99 100644
--- a/src/arch-sparc64.c
+++ b/trunk/src/arch-sparc64.c
@@ -524,7 +524,7 @@ sparc64_need_rel_to_rela (DSO *dso, int first, int last)
}
static int
-sparc64_arch_prelink (DSO *dso)
+sparc64_arch_prelink (struct prelink_info *info)
{
return 0;
}
diff --git a/src/arch-x86_64.c b/trunk/src/arch-x86_64.c
index 0db1a23..8079f1a 100644
--- a/src/arch-x86_64.c
+++ b/trunk/src/arch-x86_64.c
@@ -350,10 +350,12 @@ x86_64_need_rel_to_rela (DSO *dso, int first, int last)
}
static int
-x86_64_arch_prelink (DSO *dso)
+x86_64_arch_prelink (struct prelink_info *info)
{
+ DSO *dso;
int i;
+ dso = info->dso;
if (dso->info[DT_PLTGOT])
{
/* Write address of .plt + 0x16 into got[1].
diff --git a/src/cache.c b/trunk/src/cache.c
index 2a72267..2a72267 100644
--- a/src/cache.c
+++ b/trunk/src/cache.c
diff --git a/src/canonicalize.c b/trunk/src/canonicalize.c
index 79df44e..79df44e 100644
--- a/src/canonicalize.c
+++ b/trunk/src/canonicalize.c
diff --git a/src/checksum.c b/trunk/src/checksum.c
index 20a23a0..20a23a0 100644
--- a/src/checksum.c
+++ b/trunk/src/checksum.c
diff --git a/src/conflict.c b/trunk/src/conflict.c
index 8bb96b0..db36054 100644
--- a/src/conflict.c
+++ b/trunk/src/conflict.c
@@ -571,6 +571,10 @@ prelink_build_conflicts (struct prelink_info *info)
}
}
+ if (dso->arch->arch_prelink_conflict
+ && dso->arch->arch_prelink_conflict (dso, info))
+ goto error_out;
+
for (conflict = info->curconflicts; conflict;
conflict = conflict->next)
if (! conflict->used)
diff --git a/src/crc32.c b/trunk/src/crc32.c
index f36abb5..f36abb5 100644
--- a/src/crc32.c
+++ b/trunk/src/crc32.c
diff --git a/src/cxx.c b/trunk/src/cxx.c
index b3530f0..b3530f0 100644
--- a/src/cxx.c
+++ b/trunk/src/cxx.c
diff --git a/src/data.c b/trunk/src/data.c
index e4d06e1..13380da 100644
--- a/src/data.c
+++ b/trunk/src/data.c
@@ -53,7 +53,52 @@ write_##le##nn (DSO *dso, GElf_Addr addr, uint##nn##_t val) \
return 0; \
}
+#define BUFREADUNE(nn) \
+uint##nn##_t \
+buf_read_une##nn (DSO *dso, unsigned char *buf) \
+{ \
+ if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB) \
+ return buf_read_ule32 (buf); \
+ else \
+ return buf_read_ube32 (buf); \
+}
+
+#define READUNE(nn) \
+uint##nn##_t \
+read_une##nn (DSO *dso, GElf_Addr addr) \
+{ \
+ if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB) \
+ return read_ule##nn (dso, addr); \
+ else \
+ return read_ube##nn (dso, addr); \
+}
+
+#define WRITENE(nn) \
+void \
+write_ne##nn (DSO *dso, GElf_Addr addr, uint##nn##_t val) \
+{ \
+ if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB) \
+ write_le##nn (dso, addr, val); \
+ else \
+ write_be##nn (dso, addr, val); \
+}
+
+#define BUFWRITENE(nn) \
+void \
+buf_write_ne##nn (DSO *dso, unsigned char *buf, \
+ uint##nn##_t val) \
+{ \
+ if (dso->ehdr.e_ident[EI_DATA] == ELFDATA2LSB) \
+ buf_write_le##nn (buf, val); \
+ else \
+ buf_write_be##nn (buf, val); \
+}
+
#define READWRITE(le,nn) UREAD(le,nn) WRITE(le,nn)
+#define READWRITESIZE(nn) \
+ READWRITE(le,nn) READWRITE(be,nn) \
+ BUFREADUNE(nn) READUNE(nn) \
+ WRITENE(nn) BUFWRITENE(nn)
unsigned char *
get_data (DSO *dso, GElf_Addr addr, int *secp, Elf_Type *typep)
@@ -77,6 +122,79 @@ get_data (DSO *dso, GElf_Addr addr, int *secp, Elf_Type *typep)
return NULL;
}
+/* Initialize IT so that the first byte it provides is address ADDR
+ of DSO. */
+
+void
+init_data_iterator (struct data_iterator *it, DSO *dso, GElf_Addr addr)
+{
+ it->dso = dso;
+ it->data = NULL;
+ it->addr = addr;
+}
+
+/* Return a pointer to the next SIZE bytes pointed to by IT, and move
+ IT to the end of the returned block. Return null if the data could
+ not be read for some reason. */
+
+unsigned char *
+get_data_from_iterator (struct data_iterator *it, GElf_Addr size)
+{
+ unsigned char *ptr;
+
+ /* If we're at the end of a data block, move onto the next. */
+ if (it->data && it->data->d_off + it->data->d_size == it->sec_offset)
+ it->data = elf_getdata (it->dso->scn[it->sec], it->data);
+
+ if (it->data == NULL)
+ {
+ /* Find out which section contains the next byte. */
+ it->sec = addr_to_sec (it->dso, it->addr);
+ if (it->sec < 0)
+ return NULL;
+
+ /* Fast-forward to the block that contains ADDR, if any. */
+ it->sec_offset = it->addr - it->dso->shdr[it->sec].sh_addr;
+ do
+ it->data = elf_getdata (it->dso->scn[it->sec], it->data);
+ while (it->data && it->data->d_off + it->data->d_size <= it->sec_offset);
+ }
+
+ /* Make sure that all the data we want is included in this block. */
+ if (it->data == NULL
+ || it->data->d_off > it->sec_offset
+ || it->data->d_off + it->data->d_size < it->sec_offset + size)
+ return NULL;
+
+ ptr = (unsigned char *) it->data->d_buf + (it->sec_offset - it->data->d_off);
+ it->sec_offset += size;
+ it->addr += size;
+ return ptr;
+}
+
+/* Read the symbol pointed to by IT into SYM and move IT onto the
+ next symbol. Return true on success. */
+
+int
+get_sym_from_iterator (struct data_iterator *it, GElf_Sym *sym)
+{
+ GElf_Addr offset, size;
+ unsigned char *ptr;
+
+ size = gelf_fsize (it->dso->elf, ELF_T_SYM, 1, EV_CURRENT);
+ ptr = get_data_from_iterator (it, size);
+ if (ptr != NULL)
+ {
+ offset = ptr - (unsigned char *) it->data->d_buf;
+ if (offset % size == 0)
+ {
+ gelfx_getsym (it->dso->elf, it->data, offset / size, sym);
+ return 1;
+ }
+ }
+ return 0;
+}
+
inline uint8_t
buf_read_u8 (unsigned char *data)
{
@@ -194,12 +312,9 @@ buf_write_be64 (unsigned char *data, uint64_t val)
}
READWRITE(,8)
-READWRITE(le,16)
-READWRITE(be,16)
-READWRITE(le,32)
-READWRITE(be,32)
-READWRITE(le,64)
-READWRITE(be,64)
+READWRITESIZE(16)
+READWRITESIZE(32)
+READWRITESIZE(64)
const char *
strptr (DSO *dso, int sec, off_t offset)
diff --git a/src/doit.c b/trunk/src/doit.c
index 2208ece..2208ece 100644
--- a/src/doit.c
+++ b/trunk/src/doit.c
diff --git a/src/dso-readonly.c b/trunk/src/dso-readonly.c
index 9845761..8ad5865 100644
--- a/src/dso-readonly.c
+++ b/trunk/src/dso-readonly.c
@@ -107,6 +107,15 @@ read_dynamic (DSO *dso)
dso->info_DT_GNU_HASH = dyn.d_un.d_val;
dso->info_set_mask |= (1ULL << DT_GNU_HASH_BIT);
}
+ if (dso->ehdr.e_machine == EM_MIPS)
+ {
+ if (dyn.d_tag == DT_MIPS_LOCAL_GOTNO)
+ dso->info_DT_MIPS_LOCAL_GOTNO = dyn.d_un.d_val;
+ else if (dyn.d_tag == DT_MIPS_GOTSYM)
+ dso->info_DT_MIPS_GOTSYM = dyn.d_un.d_val;
+ else if (dyn.d_tag == DT_MIPS_SYMTABNO)
+ dso->info_DT_MIPS_SYMTABNO = dyn.d_un.d_val;
+ }
}
if (ndx < maxndx)
break;
@@ -238,7 +247,7 @@ open_dso (const char *name)
*/
static DSO *section_cmp_dso;
-int
+static int
section_cmp (const void *A, const void *B)
{
int *a = (int *) A;
@@ -1023,6 +1032,40 @@ error_out:
return 1;
}
+/* Return true if the value of symbol SYM, which belongs to DSO,
+ should be treated as an address within the DSO, and should
+ therefore track DSO's relocations. */
+
+int
+adjust_symbol_p (DSO *dso, GElf_Sym *sym)
+{
+ if (sym->st_shndx == SHN_ABS
+ && sym->st_value != 0
+ && (GELF_ST_TYPE (sym->st_info) <= STT_FUNC
+ || (dso->ehdr.e_machine == EM_ARM
+ && GELF_ST_TYPE (sym->st_info) == STT_ARM_TFUNC)))
+ /* This is problematic. How do we find out if
+ we should relocate this? Assume we should. */
+ return 1;
+
+ /* If a MIPS object does not define a symbol, but has a lazy binding
+ stub for it, st_value will point to that stub. Note that unlike
+ other targets, these stub addresses never participate in symbol
+ lookup; the stubs can only be called by the object that defines them.
+ st_values are only used in this way so that the associated GOT entry
+ can store a Quickstart value without losing the original stub
+ address. */
+ if (dso->ehdr.e_machine == EM_MIPS
+ && sym->st_shndx == SHN_UNDEF
+ && sym->st_value != 0)
+ return 1;
+
+ return (sym->st_shndx > SHN_UNDEF
+ && sym->st_shndx < dso->ehdr.e_shnum
+ && ELF32_ST_TYPE (sym->st_info) != STT_TLS
+ && RELOCATE_SCN (dso->shdr[sym->st_shndx].sh_flags));
+}
+
static int
adjust_symtab (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust)
{
@@ -1037,31 +1080,7 @@ adjust_symtab (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust)
for (ndx = 0; ndx < maxndx; ++ndx)
{
gelfx_getsym (dso->elf, data, ndx, &sym);
- if (sym.st_shndx == SHN_ABS && sym.st_value != 0
- && (GELF_ST_TYPE (sym.st_info) <= STT_FUNC
- || (dso->ehdr.e_machine == EM_ARM
- && GELF_ST_TYPE (sym.st_info) == STT_ARM_TFUNC)))
- {
- /* This is problematic. How do we find out if
- we should relocate this? Assume we should. */
- if (sym.st_value >= start)
- {
- sym.st_value += adjust;
- sym.st_value &= dso->mask;
- gelfx_update_sym (dso->elf, data, ndx, &sym);
- }
- continue;
- }
-
- if (sym.st_shndx <= SHN_UNDEF
- || sym.st_shndx >= dso->ehdr.e_shnum
- || ELF32_ST_TYPE (sym.st_info) == STT_TLS)
- continue;
-
- if (! RELOCATE_SCN (dso->shdr[sym.st_shndx].sh_flags))
- continue;
-
- if (sym.st_value >= start)
+ if (adjust_symbol_p (dso, &sym) && sym.st_value >= start)
{
sym.st_value += adjust;
gelfx_update_sym (dso->elf, data, ndx, &sym);
@@ -1317,6 +1336,10 @@ adjust_dso (DSO *dso, GElf_Addr start, GElf_Addr adjust)
{
int i;
+ if (dso->arch->arch_adjust
+ && dso->arch->arch_adjust (dso, start, adjust))
+ return 1;
+
if (dso->ehdr.e_entry >= start)
{
dso->ehdr.e_entry += adjust;
diff --git a/src/dso.c b/trunk/src/dso.c
index af67d83..5080ffc 100644
--- a/src/dso.c
+++ b/trunk/src/dso.c
@@ -107,6 +107,15 @@ read_dynamic (DSO *dso)
dso->info_DT_GNU_HASH = dyn.d_un.d_val;
dso->info_set_mask |= (1ULL << DT_GNU_HASH_BIT);
}
+ if (dso->ehdr.e_machine == EM_MIPS)
+ {
+ if (dyn.d_tag == DT_MIPS_LOCAL_GOTNO)
+ dso->info_DT_MIPS_LOCAL_GOTNO = dyn.d_un.d_val;
+ else if (dyn.d_tag == DT_MIPS_GOTSYM)
+ dso->info_DT_MIPS_GOTSYM = dyn.d_un.d_val;
+ else if (dyn.d_tag == DT_MIPS_SYMTABNO)
+ dso->info_DT_MIPS_SYMTABNO = dyn.d_un.d_val;
+ }
}
if (ndx < maxndx)
break;
@@ -1011,6 +1020,40 @@ error_out:
return 1;
}
+/* Return true if the value of symbol SYM, which belongs to DSO,
+ should be treated as an address within the DSO, and should
+ therefore track DSO's relocations. */
+
+int
+adjust_symbol_p (DSO *dso, GElf_Sym *sym)
+{
+ if (sym->st_shndx == SHN_ABS
+ && sym->st_value != 0
+ && (GELF_ST_TYPE (sym->st_info) <= STT_FUNC
+ || (dso->ehdr.e_machine == EM_ARM
+ && GELF_ST_TYPE (sym->st_info) == STT_ARM_TFUNC)))
+ /* This is problematic. How do we find out if
+ we should relocate this? Assume we should. */
+ return 1;
+
+ /* If a MIPS object does not define a symbol, but has a lazy binding
+ stub for it, st_value will point to that stub. Note that unlike
+ other targets, these stub addresses never participate in symbol
+ lookup; the stubs can only be called by the object that defines them.
+ st_values are only used in this way so that the associated GOT entry
+ can store a Quickstart value without losing the original stub
+ address. */
+ if (dso->ehdr.e_machine == EM_MIPS
+ && sym->st_shndx == SHN_UNDEF
+ && sym->st_value != 0)
+ return 1;
+
+ return (sym->st_shndx > SHN_UNDEF
+ && sym->st_shndx < dso->ehdr.e_shnum
+ && ELF32_ST_TYPE (sym->st_info) != STT_TLS
+ && RELOCATE_SCN (dso->shdr[sym->st_shndx].sh_flags));
+}
+
static int
adjust_symtab (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust)
{
@@ -1025,31 +1068,7 @@ adjust_symtab (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust)
for (ndx = 0; ndx < maxndx; ++ndx)
{
gelfx_getsym (dso->elf, data, ndx, &sym);
- if (sym.st_shndx == SHN_ABS && sym.st_value != 0
- && (GELF_ST_TYPE (sym.st_info) <= STT_FUNC
- || (dso->ehdr.e_machine == EM_ARM
- && GELF_ST_TYPE (sym.st_info) == STT_ARM_TFUNC)))
- {
- /* This is problematic. How do we find out if
- we should relocate this? Assume we should. */
- if (sym.st_value >= start)
- {
- sym.st_value += adjust;
- sym.st_value &= dso->mask;
- gelfx_update_sym (dso->elf, data, ndx, &sym);
- }
- continue;
- }
-
- if (sym.st_shndx <= SHN_UNDEF
- || sym.st_shndx >= dso->ehdr.e_shnum
- || ELF32_ST_TYPE (sym.st_info) == STT_TLS)
- continue;
-
- if (! RELOCATE_SCN (dso->shdr[sym.st_shndx].sh_flags))
- continue;
-
- if (sym.st_value >= start)
+ if (adjust_symbol_p (dso, &sym) && sym.st_value >= start)
{
sym.st_value += adjust;
gelfx_update_sym (dso->elf, data, ndx, &sym);
@@ -1297,6 +1316,10 @@ adjust_dso (DSO *dso, GElf_Addr start, GElf_Addr adjust)
{
int i;
+ if (dso->arch->arch_adjust
+ && dso->arch->arch_adjust (dso, start, adjust))
+ return 1;
+
if (dso->ehdr.e_entry >= start)
{
dso->ehdr.e_entry += adjust;
diff --git a/src/dwarf2.c b/trunk/src/dwarf2.c
index 49b7baf..4c27836 100644
--- a/src/dwarf2.c
+++ b/trunk/src/dwarf2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2005 Red Hat, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2005, 2006 Red Hat, Inc.
Written by Jakub Jelinek <jakub@redhat.com>, 2001.
This program is free software; you can redistribute it and/or modify
@@ -430,8 +430,13 @@ adjust_dwarf2_ranges (DSO *dso, GElf_Addr offset, GElf_Addr base,
else if (! adjusted_base)
{
if (base + low >= start && addr_to_sec (dso, base + low) != -1)
- write_ptr (ptr - 2 * ptr_size, low + adjust);
- if (base + high >= start && addr_to_sec (dso, base + high) != -1)
+ {
+ write_ptr (ptr - 2 * ptr_size, low + adjust);
+ if (high == low)
+ write_ptr (ptr - ptr_size, high + adjust);
+ }
+ if (low != high && base + high >= start
+ && addr_to_sec (dso, base + high - 1) != -1)
write_ptr (ptr - ptr_size, high + adjust);
}
}
diff --git a/src/dwarf2.h b/trunk/src/dwarf2.h
index 1f938f5..1f938f5 100644
--- a/src/dwarf2.h
+++ b/trunk/src/dwarf2.h
diff --git a/src/elf.h b/trunk/src/elf.h
index 0daff76..0daff76 100644
--- a/src/elf.h
+++ b/trunk/src/elf.h
diff --git a/src/exec.c b/trunk/src/exec.c
index 7c8f38f..7c8f38f 100644
--- a/src/exec.c
+++ b/trunk/src/exec.c
diff --git a/src/execle_open.c b/trunk/src/execle_open.c
index 52872aa..52872aa 100644
--- a/src/execle_open.c
+++ b/trunk/src/execle_open.c
diff --git a/src/execstack.c b/trunk/src/execstack.c
index b7c770f..f38fead 100644
--- a/src/execstack.c
+++ b/trunk/src/execstack.c
@@ -32,7 +32,7 @@
int set;
int execflag;
-const char *argp_program_version = "execstack 1.0 (20060712) Wind River";
+const char *argp_program_version = "execstack 1.0 (20061201) Wind River";
const char *argp_program_bug_address = "<support@windriver.com>";
diff --git a/src/fptr.c b/trunk/src/fptr.c
index 7602d5e..7602d5e 100644
--- a/src/fptr.c
+++ b/trunk/src/fptr.c
diff --git a/src/fptr.h b/trunk/src/fptr.h
index 36ef7c6..36ef7c6 100644
--- a/src/fptr.h
+++ b/trunk/src/fptr.h
diff --git a/src/gather.c b/trunk/src/gather.c
index 9219fdf..9219fdf 100644
--- a/src/gather.c
+++ b/trunk/src/gather.c
diff --git a/src/get.c b/trunk/src/get.c
index 0ae418b..0ae418b 100644
--- a/src/get.c
+++ b/trunk/src/get.c
diff --git a/src/hashtab.c b/trunk/src/hashtab.c
index fa27446..fa27446 100644
--- a/src/hashtab.c
+++ b/trunk/src/hashtab.c
diff --git a/src/hashtab.h b/trunk/src/hashtab.h
index 31e63e0..31e63e0 100644
--- a/src/hashtab.h
+++ b/trunk/src/hashtab.h
diff --git a/src/layout.c b/trunk/src/layout.c
index 9292425..9292425 100644
--- a/src/layout.c
+++ b/trunk/src/layout.c
diff --git a/src/layout.h b/trunk/src/layout.h
index f481d22..f481d22 100644
--- a/src/layout.h
+++ b/trunk/src/layout.h
diff --git a/src/ld-do-lookup.h b/trunk/src/ld-do-lookup.h
index 62a1280..62a1280 100644
--- a/src/ld-do-lookup.h
+++ b/trunk/src/ld-do-lookup.h
diff --git a/src/ld-libs.c b/trunk/src/ld-libs.c
index ec8dc57..b169cde 100644
--- a/src/ld-libs.c
+++ b/trunk/src/ld-libs.c
@@ -44,7 +44,7 @@ int host_paths;
void string_to_path (struct search_path *path, const char *string);
-const char *argp_program_version = "prelink-rtld 1.0 (20060712) Wind River Linux";
+const char *argp_program_version = "prelink-rtld 1.0 (20061201) Wind River Linux";
const char *argp_program_bug_address = "<support@windriver.com>";
diff --git a/src/ld-libs.h b/trunk/src/ld-libs.h
index 48dd555..48dd555 100644
--- a/src/ld-libs.h
+++ b/trunk/src/ld-libs.h
diff --git a/src/ld-lookup.c b/trunk/src/ld-lookup.c
index 69b6bd1..69b6bd1 100644
--- a/src/ld-lookup.c
+++ b/trunk/src/ld-lookup.c
diff --git a/src/ld-lookup64.c b/trunk/src/ld-lookup64.c
index 7e35334..7e35334 100644
--- a/src/ld-lookup64.c
+++ b/trunk/src/ld-lookup64.c
diff --git a/src/main.c b/trunk/src/main.c
index b352479..631da44 100644
--- a/src/main.c
+++ b/trunk/src/main.c
@@ -61,7 +61,7 @@ const char *undo_output;
int noreexecinit;
time_t initctime;
-const char *argp_program_version = "prelink 1.0 (20060712) Wind River Linux";
+const char *argp_program_version = "prelink 1.0 (20061201) Wind River Linux";
const char *argp_program_bug_address = "<support@windriver.com>";
diff --git a/src/makecrc.c b/trunk/src/makecrc.c
index db52013..db52013 100644
--- a/src/makecrc.c
+++ b/trunk/src/makecrc.c
diff --git a/src/md5.c b/trunk/src/md5.c
index 0d2fdef..0d2fdef 100644
--- a/src/md5.c
+++ b/trunk/src/md5.c
diff --git a/src/md5.h b/trunk/src/md5.h
index 55f6195..55f6195 100644
--- a/src/md5.h
+++ b/trunk/src/md5.h
diff --git a/src/mdebug.c b/trunk/src/mdebug.c
index 4c22d2f..4c22d2f 100644
--- a/src/mdebug.c
+++ b/trunk/src/mdebug.c
diff --git a/src/prelink.c b/trunk/src/prelink.c
index a44201a..1a2260e 100644
--- a/src/prelink.c
+++ b/trunk/src/prelink.c
@@ -438,6 +438,15 @@ prelink_prepare (DSO *dso)
from this set only (and SHT_REL) in ET_DYN just needs
adjusting the rest of the library. */
break;
+ case SHT_DYNAMIC:
+ case SHT_MIPS_REGINFO:
+ /* The same applies to these sections on MIPS. The convention
+ is to put .dynamic and .reginfo near the beginning of the
+ read-only segment, before the program text. No relocations
+ may refer to them. */
+ if (dso->ehdr.e_machine == EM_MIPS)
+ break;
+ /* FALLTHROUGH */
default:
/* The rest of sections are not safe. */
safe = 0;
@@ -943,7 +952,7 @@ prelink (DSO *dso, struct prelink_entry *ent)
}
}
- if (dso->arch->arch_prelink && dso->arch->arch_prelink (dso))
+ if (dso->arch->arch_prelink && dso->arch->arch_prelink (&info))
goto error_out;
if (dso->arch->read_opd && dso->arch->read_opd (dso, ent))
diff --git a/src/prelink.h b/trunk/src/prelink.h
index 8d147a4..0118602 100644
--- a/src/prelink.h
+++ b/trunk/src/prelink.h
@@ -51,6 +51,35 @@
#define SHT_GNU_HASH 0x6ffffff6
#endif
+#ifndef DT_MIPS_RLD_VERSION
+#define DT_MIPS_RLD_VERSION 0x70000001
+#define DT_MIPS_TIME_STAMP 0x70000002
+#define DT_MIPS_ICHECKSUM 0x70000003
+#define DT_MIPS_IVERSION 0x70000004
+#define DT_MIPS_FLAGS 0x70000005
+#define DT_MIPS_BASE_ADDRESS 0x70000006
+#define DT_MIPS_CONFLICT 0x70000008
+#define DT_MIPS_LIBLIST 0x70000009
+#define DT_MIPS_LOCAL_GOTNO 0x7000000a
+#define DT_MIPS_CONFLICTNO 0x7000000b
+#define DT_MIPS_LIBLISTNO 0x70000010
+#define DT_MIPS_SYMTABNO 0x70000011
+#define DT_MIPS_UNREFEXTNO 0x70000012
+#define DT_MIPS_GOTSYM 0x70000013
+#define DT_MIPS_HIPAGENO 0x70000014
+#define DT_MIPS_RLD_MAP 0x70000016
+#endif
+
+#ifndef R_MIPS_TLS_DTPMOD32
+#define R_MIPS_TLS_DTPMOD32 38
+#define R_MIPS_TLS_DTPREL32 39
+#define R_MIPS_TLS_TPREL32 47
+#endif
+
+#ifndef R_MIPS_GLOB_DAT
+#define R_MIPS_GLOB_DAT 51
+#endif
+
struct prelink_entry;
struct prelink_info;
struct PLArch;
@@ -83,6 +112,9 @@ typedef struct
GElf_Addr info_DT_CHECKSUM;
GElf_Addr info_DT_VERNEED, info_DT_VERDEF, info_DT_VERSYM;
GElf_Addr info_DT_GNU_HASH;
+ GElf_Addr info_DT_MIPS_LOCAL_GOTNO;
+ GElf_Addr info_DT_MIPS_GOTSYM;
+ GElf_Addr info_DT_MIPS_SYMTABNO;
#define DT_GNU_PRELINKED_BIT 50
#define DT_CHECKSUM_BIT 51
#define DT_VERNEED_BIT 52
@@ -124,6 +156,7 @@ struct PLArch
int R_COPY;
int R_JMP_SLOT;
int R_RELATIVE;
+ int (*arch_adjust) (DSO *dso, GElf_Addr start, GElf_Addr adjust);
int (*adjust_section) (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust);
int (*adjust_dyn) (DSO *dso, int n, GElf_Dyn *dyn, GElf_Addr start,
GElf_Addr adjust);
@@ -139,6 +172,7 @@ struct PLArch
GElf_Rel *rel, GElf_Addr reladdr);
int (*prelink_conflict_rela) (DSO *dso, struct prelink_info *info,
GElf_Rela *rela, GElf_Addr relaaddr);
+ int (*arch_prelink_conflict) (DSO *dso, struct prelink_info *info);
int (*apply_conflict_rela) (struct prelink_info *info, GElf_Rela *rela,
char *buf);
int (*apply_rel) (struct prelink_info *info, GElf_Rel *rel, char *buf);
@@ -158,7 +192,7 @@ struct PLArch
#define RTYPE_CLASS_TLS (8|4)
int (*reloc_class) (int);
int (*arch_pre_prelink) (DSO *dso);
- int (*arch_prelink) (DSO *dso);
+ int (*arch_prelink) (struct prelink_info *info);
int (*arch_undo_prelink) (DSO *dso);
int (*undo_prelink_rel) (DSO *dso, GElf_Rel *rel, GElf_Addr reladdr);
int (*undo_prelink_rela) (DSO *dso, GElf_Rela *rela, GElf_Addr relaaddr);
@@ -180,6 +214,7 @@ struct section_move *init_section_move (DSO *dso);
void add_section (struct section_move *move, int sec);
void remove_section (struct section_move *move, int sec);
int reopen_dso (DSO *dso, struct section_move *move, const char *);
+int adjust_symbol_p (DSO *dso, GElf_Sym *sym);
int check_dso (DSO *dso);
int dso_is_rdwr (DSO *dso);
void read_dynamic (DSO *dso);
@@ -206,21 +241,53 @@ int strtabfind (DSO *dso, int strndx, const char *name);
int shstrtabadd (DSO *dso, const char *name);
/* data.c */
+
+/* Used for reading consecutive blocks of data from a DSO. */
+struct data_iterator {
+ /* The DSO that is being read. */
+ DSO *dso;
+
+ /* The data block that contained the last byte to be read.
+ NULL if no data has been read yet or if the end of the
+ DSO has been reached. */
+ Elf_Data *data;
+
+ /* The section that contains DATA, when DATA is nonnull. */
+ int sec;
+
+ /* The address of the next byte. */
+ GElf_Addr addr;
+
+ /* The offset of the next byte from the start of SEC, when DATA
+ is nonnull. */
+ GElf_Addr sec_offset;
+};
+
unsigned char * get_data (DSO *dso, GElf_Addr addr, int *scnp, Elf_Type *typep);
#define READWRITEPROTO(le,nn) \
uint##nn##_t buf_read_u##le##nn (unsigned char *data); \
uint##nn##_t read_u##le##nn (DSO *dso, GElf_Addr addr); \
void buf_write_##le##nn (unsigned char *data, uint##nn##_t val);\
int write_##le##nn (DSO *dso, GElf_Addr addr, uint##nn##_t val);
+#define READWRITEPROTOSIZE(nn) \
+READWRITEPROTO(le,nn) \
+READWRITEPROTO(be,nn) \
+uint##nn##_t buf_read_une##nn (DSO *dso, unsigned char *data); \
+uint##nn##_t read_une##nn (DSO *dso, GElf_Addr addr); \
+void buf_write_ne##nn (DSO *dso, unsigned char *data, \
+ uint##nn##_t val); \
+void write_ne##nn (DSO *dso, GElf_Addr addr, uint##nn##_t val);
READWRITEPROTO(,8)
-READWRITEPROTO(le,16)
-READWRITEPROTO(be,16)
-READWRITEPROTO(le,32)
-READWRITEPROTO(be,32)
-READWRITEPROTO(le,64)
-READWRITEPROTO(be,64)
+READWRITEPROTOSIZE(16)
+READWRITEPROTOSIZE(32)
+READWRITEPROTOSIZE(64)
#undef READWRITEPROTO
+#undef READWRITEPROTOSIZE
const char * strptr (DSO *dso, int sec, off_t offset);
+void init_data_iterator (struct data_iterator *it, DSO *dso, GElf_Addr addr);
+unsigned char *get_data_from_iterator (struct data_iterator *it,
+ GElf_Addr size);
+int get_sym_from_iterator (struct data_iterator *it, GElf_Sym *sym);
#define PL_ARCH \
static struct PLArch plarch __attribute__((section("pl_arch"),used))
diff --git a/src/prelinktab.h b/trunk/src/prelinktab.h
index f41c79c..f41c79c 100644
--- a/src/prelinktab.h
+++ b/trunk/src/prelinktab.h
diff --git a/src/reloc.c b/trunk/src/reloc.c
index 70b4dbc..70b4dbc 100644
--- a/src/reloc.c
+++ b/trunk/src/reloc.c
diff --git a/src/reloc.h b/trunk/src/reloc.h
index a2ceff9..a2ceff9 100644
--- a/src/reloc.h
+++ b/trunk/src/reloc.h
diff --git a/src/sha.c b/trunk/src/sha.c
index cfbc956..cfbc956 100644
--- a/src/sha.c
+++ b/trunk/src/sha.c
diff --git a/src/sha.h b/trunk/src/sha.h
index 13583e3..13583e3 100644
--- a/src/sha.h
+++ b/trunk/src/sha.h
diff --git a/src/space.c b/trunk/src/space.c
index 155feba..4fea7c7 100644
--- a/src/space.c
+++ b/trunk/src/space.c
@@ -247,9 +247,19 @@ find_readonly_space (DSO *dso, GElf_Shdr *add, GElf_Ehdr *ehdr,
int after = -1, min;
if (phdr[i].p_offset < ehdr->e_phoff)
- start += ehdr->e_phoff
- + ehdr->e_phnum * ehdr->e_phentsize
- - phdr[i].p_offset;
+ {
+ for (j = 0; j < ehdr->e_phnum; j++)
+ if (phdr[j].p_type == PT_PHDR
+ && phdr[j].p_offset == ehdr->e_phoff
+ && phdr[j].p_filesz >= ehdr->e_phnum * ehdr->e_phentsize)
+ break;
+ start += ehdr->e_phoff;
+ if (j < ehdr->e_phnum)
+ start += phdr[j].p_filesz;
+ else
+ start += ehdr->e_phnum * ehdr->e_phentsize;
+ start -= phdr[i].p_offset;
+ }
start = (start + add->sh_addralign - 1) & ~(add->sh_addralign - 1);
for (j = 1; j < ehdr->e_shnum; ++j)
if ((shdr[j].sh_flags & SHF_ALLOC)
diff --git a/src/space.h b/trunk/src/space.h
index 5c9f725..5c9f725 100644
--- a/src/space.h
+++ b/trunk/src/space.h
diff --git a/src/stabs.c b/trunk/src/stabs.c
index c0a5a6a..c0a5a6a 100644
--- a/src/stabs.c
+++ b/trunk/src/stabs.c
diff --git a/src/undo.c b/trunk/src/undo.c
index f9b0bd3..f9b0bd3 100644
--- a/src/undo.c
+++ b/trunk/src/undo.c
diff --git a/src/undoall.c b/trunk/src/undoall.c
index 90e9240..90e9240 100644
--- a/src/undoall.c
+++ b/trunk/src/undoall.c
diff --git a/src/verify.c b/trunk/src/verify.c
index a40c98f..8acecfb 100644
--- a/src/verify.c
+++ b/trunk/src/verify.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Red Hat, Inc.
+/* Copyright (C) 2002, 2003, 2006 Red Hat, Inc.
Written by Jakub Jelinek <jakub@redhat.com>, 2002.
This program is free software; you can redistribute it and/or modify
@@ -289,17 +289,17 @@ prelink_verify (const char *filename)
dso2 = fdopen_dso (fd, filename);
if (dso2 == NULL)
- goto failure;
+ goto failure_unlink;
fd = -1;
if (prelink_prepare (dso2))
- goto failure;
+ goto failure_unlink;
if (ent->type == ET_DYN && relocate_dso (dso2, base))
- goto failure;
+ goto failure_unlink;
if (prelink (dso2, ent))
- goto failure;
+ goto failure_unlink;
unlink (ent->filename);
@@ -414,6 +414,8 @@ prelink_verify (const char *filename)
close (fdundone);
return 0;
+failure_unlink:
+ unlink (ent->filename);
failure:
if (fd != -1)
close (fd);
diff --git a/src/wrap-file.c b/trunk/src/wrap-file.c
index c631458..c631458 100644
--- a/src/wrap-file.c
+++ b/trunk/src/wrap-file.c
diff --git a/stamp-h.in b/trunk/stamp-h.in
index 9788f70..9788f70 100644
--- a/stamp-h.in
+++ b/trunk/stamp-h.in
diff --git a/testsuite/Makefile.am b/trunk/testsuite/Makefile.am
index 3af929b..3af929b 100644
--- a/testsuite/Makefile.am
+++ b/trunk/testsuite/Makefile.am
diff --git a/testsuite/Makefile.in b/trunk/testsuite/Makefile.in
index 205f6e3..205f6e3 100644
--- a/testsuite/Makefile.in
+++ b/trunk/testsuite/Makefile.in
diff --git a/testsuite/cxx1.C b/trunk/testsuite/cxx1.C
index 9c11a6d..9c11a6d 100644
--- a/testsuite/cxx1.C
+++ b/trunk/testsuite/cxx1.C
diff --git a/testsuite/cxx1.h b/trunk/testsuite/cxx1.h
index d6efe9b..d6efe9b 100644
--- a/testsuite/cxx1.h
+++ b/trunk/testsuite/cxx1.h
diff --git a/testsuite/cxx1.sh b/trunk/testsuite/cxx1.sh
index 81428c2..81428c2 100755
--- a/testsuite/cxx1.sh
+++ b/trunk/testsuite/cxx1.sh
diff --git a/testsuite/cxx1lib1.C b/trunk/testsuite/cxx1lib1.C
index 1eb192a..1eb192a 100644
--- a/testsuite/cxx1lib1.C
+++ b/trunk/testsuite/cxx1lib1.C
diff --git a/testsuite/cxx1lib2.C b/trunk/testsuite/cxx1lib2.C
index 77055da..77055da 100644
--- a/testsuite/cxx1lib2.C
+++ b/trunk/testsuite/cxx1lib2.C
diff --git a/testsuite/cycle1.sh b/trunk/testsuite/cycle1.sh
index caf7864..caf7864 100755
--- a/testsuite/cycle1.sh
+++ b/trunk/testsuite/cycle1.sh
diff --git a/testsuite/cycle2.sh b/trunk/testsuite/cycle2.sh
index a160a3a..a160a3a 100755
--- a/testsuite/cycle2.sh
+++ b/trunk/testsuite/cycle2.sh
diff --git a/testsuite/deps1.c b/trunk/testsuite/deps1.c
index 331546c..331546c 100644
--- a/testsuite/deps1.c
+++ b/trunk/testsuite/deps1.c
diff --git a/testsuite/deps1.h b/trunk/testsuite/deps1.h
index d5868f7..d5868f7 100644
--- a/testsuite/deps1.h
+++ b/trunk/testsuite/deps1.h
diff --git a/testsuite/deps1.sh b/trunk/testsuite/deps1.sh
index 96395fa..96395fa 100755
--- a/testsuite/deps1.sh
+++ b/trunk/testsuite/deps1.sh
diff --git a/testsuite/deps1lib1.c b/trunk/testsuite/deps1lib1.c
index d4ab28b..d4ab28b 100644
--- a/testsuite/deps1lib1.c
+++ b/trunk/testsuite/deps1lib1.c
diff --git a/testsuite/deps1lib2.c b/trunk/testsuite/deps1lib2.c
index f73b456..f73b456 100644
--- a/testsuite/deps1lib2.c
+++ b/trunk/testsuite/deps1lib2.c
diff --git a/testsuite/deps2.sh b/trunk/testsuite/deps2.sh
index 4838f9b..4838f9b 100755
--- a/testsuite/deps2.sh
+++ b/trunk/testsuite/deps2.sh
diff --git a/testsuite/deps2lib1.c b/trunk/testsuite/deps2lib1.c
index 9d4b2de..9d4b2de 100644
--- a/testsuite/deps2lib1.c
+++ b/trunk/testsuite/deps2lib1.c
diff --git a/testsuite/functions.sh b/trunk/testsuite/functions.sh
index c351fd1..c351fd1 100755
--- a/testsuite/functions.sh
+++ b/trunk/testsuite/functions.sh
diff --git a/testsuite/layout.C b/trunk/testsuite/layout.C
index 5047a34..5047a34 100644
--- a/testsuite/layout.C
+++ b/trunk/testsuite/layout.C
diff --git a/testsuite/layout1.sh b/trunk/testsuite/layout1.sh
index e217dea..e217dea 100755
--- a/testsuite/layout1.sh
+++ b/trunk/testsuite/layout1.sh
diff --git a/testsuite/layout2.sh b/trunk/testsuite/layout2.sh
index 2307a42..2307a42 100755
--- a/testsuite/layout2.sh
+++ b/trunk/testsuite/layout2.sh
diff --git a/testsuite/layoutlib.C b/trunk/testsuite/layoutlib.C
index 8162515..8162515 100644
--- a/testsuite/layoutlib.C
+++ b/trunk/testsuite/layoutlib.C
diff --git a/testsuite/movelibs.sh b/trunk/testsuite/movelibs.sh
index 010e0e7..010e0e7 100755
--- a/testsuite/movelibs.sh
+++ b/trunk/testsuite/movelibs.sh
diff --git a/testsuite/quick1.c b/trunk/testsuite/quick1.c
index dc98441..dc98441 100644
--- a/testsuite/quick1.c
+++ b/trunk/testsuite/quick1.c
diff --git a/testsuite/quick1.sh b/trunk/testsuite/quick1.sh
index f3f80a8..f3f80a8 100755
--- a/testsuite/quick1.sh
+++ b/trunk/testsuite/quick1.sh
diff --git a/testsuite/quick1lib1.c b/trunk/testsuite/quick1lib1.c
index 41767ce..41767ce 100644
--- a/testsuite/quick1lib1.c
+++ b/trunk/testsuite/quick1lib1.c
diff --git a/testsuite/quick1lib2.c b/trunk/testsuite/quick1lib2.c
index b545086..b545086 100644
--- a/testsuite/quick1lib2.c
+++ b/trunk/testsuite/quick1lib2.c
diff --git a/testsuite/quick1lib3.c b/trunk/testsuite/quick1lib3.c
index 06760a3..06760a3 100644
--- a/testsuite/quick1lib3.c
+++ b/trunk/testsuite/quick1lib3.c
diff --git a/testsuite/quick1lib4.c b/trunk/testsuite/quick1lib4.c
index 53e23d7..53e23d7 100644
--- a/testsuite/quick1lib4.c
+++ b/trunk/testsuite/quick1lib4.c
diff --git a/testsuite/quick2.sh b/trunk/testsuite/quick2.sh
index 87138ae..87138ae 100755
--- a/testsuite/quick2.sh
+++ b/trunk/testsuite/quick2.sh
diff --git a/testsuite/quick3.sh b/trunk/testsuite/quick3.sh
index 0562e52..0562e52 100755
--- a/testsuite/quick3.sh
+++ b/trunk/testsuite/quick3.sh
diff --git a/testsuite/reloc1.c b/trunk/testsuite/reloc1.c
index e679bed..e679bed 100644
--- a/testsuite/reloc1.c
+++ b/trunk/testsuite/reloc1.c
diff --git a/testsuite/reloc1.h b/trunk/testsuite/reloc1.h
index 093dd3a..093dd3a 100644
--- a/testsuite/reloc1.h
+++ b/trunk/testsuite/reloc1.h
diff --git a/testsuite/reloc1.sh b/trunk/testsuite/reloc1.sh
index ade05c9..ade05c9 100755
--- a/testsuite/reloc1.sh
+++ b/trunk/testsuite/reloc1.sh
diff --git a/testsuite/reloc10.c b/trunk/testsuite/reloc10.c
index 5720d33..5720d33 100644
--- a/testsuite/reloc10.c
+++ b/trunk/testsuite/reloc10.c
diff --git a/testsuite/reloc10.sh b/trunk/testsuite/reloc10.sh
index 66dd438..66dd438 100755
--- a/testsuite/reloc10.sh
+++ b/trunk/testsuite/reloc10.sh
diff --git a/testsuite/reloc10lib1.c b/trunk/testsuite/reloc10lib1.c
index 2ee06d2..2ee06d2 100644
--- a/testsuite/reloc10lib1.c
+++ b/trunk/testsuite/reloc10lib1.c
diff --git a/testsuite/reloc10lib2.c b/trunk/testsuite/reloc10lib2.c
index fc327fc..fc327fc 100644
--- a/testsuite/reloc10lib2.c
+++ b/trunk/testsuite/reloc10lib2.c
diff --git a/testsuite/reloc10lib3.c b/trunk/testsuite/reloc10lib3.c
index 2ec80ab..2ec80ab 100644
--- a/testsuite/reloc10lib3.c
+++ b/trunk/testsuite/reloc10lib3.c
diff --git a/testsuite/reloc10lib4.c b/trunk/testsuite/reloc10lib4.c
index 4376249..4376249 100644
--- a/testsuite/reloc10lib4.c
+++ b/trunk/testsuite/reloc10lib4.c
diff --git a/testsuite/reloc10lib5.c b/trunk/testsuite/reloc10lib5.c
index 19fd925..19fd925 100644
--- a/testsuite/reloc10lib5.c
+++ b/trunk/testsuite/reloc10lib5.c
diff --git a/testsuite/reloc11.c b/trunk/testsuite/reloc11.c
index 923aff4..923aff4 100644
--- a/testsuite/reloc11.c
+++ b/trunk/testsuite/reloc11.c
diff --git a/testsuite/reloc11.sh b/trunk/testsuite/reloc11.sh
index ab0cbee..ab0cbee 100755
--- a/testsuite/reloc11.sh
+++ b/trunk/testsuite/reloc11.sh
diff --git a/testsuite/reloc11lib2.c b/trunk/testsuite/reloc11lib2.c
index 6a2191c..6a2191c 100644
--- a/testsuite/reloc11lib2.c
+++ b/trunk/testsuite/reloc11lib2.c
diff --git a/testsuite/reloc11lib3.c b/trunk/testsuite/reloc11lib3.c
index 0cea7f3..0cea7f3 100644
--- a/testsuite/reloc11lib3.c
+++ b/trunk/testsuite/reloc11lib3.c
diff --git a/testsuite/reloc1lib1.c b/trunk/testsuite/reloc1lib1.c
index 8aa0628..8aa0628 100644
--- a/testsuite/reloc1lib1.c
+++ b/trunk/testsuite/reloc1lib1.c
diff --git a/testsuite/reloc1lib2.c b/trunk/testsuite/reloc1lib2.c
index a338c1d..a338c1d 100644
--- a/testsuite/reloc1lib2.c
+++ b/trunk/testsuite/reloc1lib2.c
diff --git a/testsuite/reloc2.c b/trunk/testsuite/reloc2.c
index 6c7fed5..6c7fed5 100644
--- a/testsuite/reloc2.c
+++ b/trunk/testsuite/reloc2.c
diff --git a/testsuite/reloc2.sh b/trunk/testsuite/reloc2.sh
index 6560879..4d180c6 100755
--- a/testsuite/reloc2.sh
+++ b/trunk/testsuite/reloc2.sh
@@ -2,7 +2,7 @@
. `dirname $0`/functions.sh
SHFLAGS=
case "`uname -m`" in
- ia64|ppc*|x86_64) SHFLAGS=-fpic;; # Does not support non-pic shared libs
+ ia64|ppc*|x86_64|mips*) SHFLAGS=-fpic;; # Does not support non-pic shared libs
s390*) if file reloc1lib1.so | grep -q 64-bit; then SHFLAGS=-fpic; fi;;
esac
rm -f reloc2 reloc2lib*.so reloc2.log
diff --git a/testsuite/reloc2lib1.c b/trunk/testsuite/reloc2lib1.c
index 3551704..3551704 100644
--- a/testsuite/reloc2lib1.c
+++ b/trunk/testsuite/reloc2lib1.c
diff --git a/testsuite/reloc2lib2.c b/trunk/testsuite/reloc2lib2.c
index 094daad..094daad 100644
--- a/testsuite/reloc2lib2.c
+++ b/trunk/testsuite/reloc2lib2.c
diff --git a/testsuite/reloc3.c b/trunk/testsuite/reloc3.c
index 2f455d7..2f455d7 100644
--- a/testsuite/reloc3.c
+++ b/trunk/testsuite/reloc3.c
diff --git a/testsuite/reloc3.sh b/trunk/testsuite/reloc3.sh
index acf0497..acf0497 100755
--- a/testsuite/reloc3.sh
+++ b/trunk/testsuite/reloc3.sh
diff --git a/testsuite/reloc3lib1.c b/trunk/testsuite/reloc3lib1.c
index fd649c6..fd649c6 100644
--- a/testsuite/reloc3lib1.c
+++ b/trunk/testsuite/reloc3lib1.c
diff --git a/testsuite/reloc4.c b/trunk/testsuite/reloc4.c
index cb3b17a..cb3b17a 100644
--- a/testsuite/reloc4.c
+++ b/trunk/testsuite/reloc4.c
diff --git a/testsuite/reloc4.sh b/trunk/testsuite/reloc4.sh
index 6163d31..c20f8b5 100755
--- a/testsuite/reloc4.sh
+++ b/trunk/testsuite/reloc4.sh
@@ -12,12 +12,16 @@ $HOST_CC -O2 -o reloc4.tmp $srcdir/reloc4.c
./reloc4lib2.tmp > reloc4lib2.tmp.c
./reloc4lib3.tmp > reloc4lib3.tmp.c
./reloc4.tmp > reloc4.tmp.c
-$CC -shared -fpic -o reloc4lib1.so reloc4lib1.tmp.c
-$CC -shared -fpic -o reloc4lib2.so reloc4lib2.tmp.c reloc4lib1.so
-$CC -shared -fpic -o reloc4lib3.so reloc4lib3.tmp.c reloc4lib2.so
+case "`$RUN uname -m`" in
+ mips*) extra=-mxgot ;;
+ *) extra= ;;
+esac
+$CC -shared -fpic $extra -o reloc4lib1.so reloc4lib1.tmp.c
+$CC -shared -fpic $extra -o reloc4lib2.so reloc4lib2.tmp.c reloc4lib1.so
+$CC -shared -fpic $extra -o reloc4lib3.so reloc4lib3.tmp.c reloc4lib2.so
BINS="reloc4"
LIBS="reloc4lib1.so reloc4lib2.so reloc4lib3.so"
-$CCLINK -o reloc4 reloc4.tmp.c -Wl,--rpath-link,. reloc4lib3.so
+$CCLINK $extra -o reloc4 reloc4.tmp.c -Wl,--rpath-link,. reloc4lib3.so
savelibs
rm -f reloc4*.tmp reloc4*.tmp.c
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc4 > reloc4.log
diff --git a/testsuite/reloc4lib1.c b/trunk/testsuite/reloc4lib1.c
index f1297d8..f1297d8 100644
--- a/testsuite/reloc4lib1.c
+++ b/trunk/testsuite/reloc4lib1.c
diff --git a/testsuite/reloc4lib2.c b/trunk/testsuite/reloc4lib2.c
index 07aa721..07aa721 100644
--- a/testsuite/reloc4lib2.c
+++ b/trunk/testsuite/reloc4lib2.c
diff --git a/testsuite/reloc4lib3.c b/trunk/testsuite/reloc4lib3.c
index 1f30817..1f30817 100644
--- a/testsuite/reloc4lib3.c
+++ b/trunk/testsuite/reloc4lib3.c
diff --git a/testsuite/reloc5.c b/trunk/testsuite/reloc5.c
index 6c1b3c9..b174bcf 100644
--- a/testsuite/reloc5.c
+++ b/trunk/testsuite/reloc5.c
@@ -15,8 +15,10 @@ int main (void)
printf (" if (testzero[x]) abort ();\n");
printf (" exit (0);\n}\n\n");
printf ("#ifdef __arm__\n");
- printf ("asm (\".section nonalloced,\\\"aw\\\",%%nobits; testzero: .skip 16384\");\n");
+ printf ("asm (\".section nonalloced,\\\"aw\\\",%%nobits\\n\\t\"\n");
printf ("#else\n");
- printf ("asm (\".section nonalloced,\\\"aw\\\",@nobits; testzero: .skip 16384\");\n");
+ printf ("asm (\".section nonalloced,\\\"aw\\\",@nobits\\n\\t\"\n");
printf ("#endif\n");
+ printf (" \".globl testzero\\n\\t\"\n");
+ printf (" \"testzero: .skip 16384\");\n");
}
diff --git a/testsuite/reloc5.sh b/trunk/testsuite/reloc5.sh
index f543f69..f543f69 100755
--- a/testsuite/reloc5.sh
+++ b/trunk/testsuite/reloc5.sh
diff --git a/testsuite/reloc6.sh b/trunk/testsuite/reloc6.sh
index 7f72936..7f72936 100755
--- a/testsuite/reloc6.sh
+++ b/trunk/testsuite/reloc6.sh
diff --git a/testsuite/reloc7.c b/trunk/testsuite/reloc7.c
index c1f6dc8..c1f6dc8 100644
--- a/testsuite/reloc7.c
+++ b/trunk/testsuite/reloc7.c
diff --git a/testsuite/reloc7.sh b/trunk/testsuite/reloc7.sh
index edbbcbf..edbbcbf 100755
--- a/testsuite/reloc7.sh
+++ b/trunk/testsuite/reloc7.sh
diff --git a/testsuite/reloc8.sh b/trunk/testsuite/reloc8.sh
index 9f5e1fb..9f5e1fb 100755
--- a/testsuite/reloc8.sh
+++ b/trunk/testsuite/reloc8.sh
diff --git a/testsuite/reloc9.sh b/trunk/testsuite/reloc9.sh
index d3a449c..d3a449c 100755
--- a/testsuite/reloc9.sh
+++ b/trunk/testsuite/reloc9.sh
diff --git a/testsuite/shuffle1.sh b/trunk/testsuite/shuffle1.sh
index 4553d2e..4553d2e 100755
--- a/testsuite/shuffle1.sh
+++ b/trunk/testsuite/shuffle1.sh
diff --git a/testsuite/shuffle2.c b/trunk/testsuite/shuffle2.c
index 870b189..c9f03ce 100644
--- a/testsuite/shuffle2.c
+++ b/trunk/testsuite/shuffle2.c
@@ -17,7 +17,11 @@ int main()
}
#ifdef __arm__
-asm (".section nonalloced,\"aw\",%nobits; testzero: .skip 16384");
+asm (".section nonalloced,\"aw\",%nobits\n\t"
+ ".globl testzero\n\t"
+ "testzero: .skip 16384");
#else
-asm (".section nonalloced,\"aw\",@nobits; testzero: .skip 16384");
+asm (".section nonalloced,\"aw\",@nobits\n\t"
+ ".globl testzero\n\t"
+ "testzero: .skip 16384");
#endif
diff --git a/testsuite/shuffle2.sh b/trunk/testsuite/shuffle2.sh
index fdaf03e..fdaf03e 100755
--- a/testsuite/shuffle2.sh
+++ b/trunk/testsuite/shuffle2.sh
diff --git a/testsuite/shuffle3.sh b/trunk/testsuite/shuffle3.sh
index 989bfcb..989bfcb 100755
--- a/testsuite/shuffle3.sh
+++ b/trunk/testsuite/shuffle3.sh
diff --git a/testsuite/shuffle4.sh b/trunk/testsuite/shuffle4.sh
index 781431c..781431c 100755
--- a/testsuite/shuffle4.sh
+++ b/trunk/testsuite/shuffle4.sh
diff --git a/testsuite/shuffle5.sh b/trunk/testsuite/shuffle5.sh
index db722e8..db722e8 100755
--- a/testsuite/shuffle5.sh
+++ b/trunk/testsuite/shuffle5.sh
diff --git a/testsuite/shuffle6.sh b/trunk/testsuite/shuffle6.sh
index eb28d62..eb28d62 100755
--- a/testsuite/shuffle6.sh
+++ b/trunk/testsuite/shuffle6.sh
diff --git a/testsuite/shuffle6lib1.c b/trunk/testsuite/shuffle6lib1.c
index 8053293..8053293 100644
--- a/testsuite/shuffle6lib1.c
+++ b/trunk/testsuite/shuffle6lib1.c
diff --git a/testsuite/shuffle6lib2.c b/trunk/testsuite/shuffle6lib2.c
index ed18f6b..ed18f6b 100644
--- a/testsuite/shuffle6lib2.c
+++ b/trunk/testsuite/shuffle6lib2.c
diff --git a/testsuite/shuffle7.sh b/trunk/testsuite/shuffle7.sh
index c6449c8..c6449c8 100755
--- a/testsuite/shuffle7.sh
+++ b/trunk/testsuite/shuffle7.sh
diff --git a/testsuite/shuffle8.c b/trunk/testsuite/shuffle8.c
index 4e80184..4e80184 100644
--- a/testsuite/shuffle8.c
+++ b/trunk/testsuite/shuffle8.c
diff --git a/testsuite/shuffle8.sh b/trunk/testsuite/shuffle8.sh
index 51dcc4c..51dcc4c 100755
--- a/testsuite/shuffle8.sh
+++ b/trunk/testsuite/shuffle8.sh
diff --git a/testsuite/tls1.c b/trunk/testsuite/tls1.c
index 08bd26f..08bd26f 100644
--- a/testsuite/tls1.c
+++ b/trunk/testsuite/tls1.c
diff --git a/testsuite/tls1.h b/trunk/testsuite/tls1.h
index d627340..d627340 100644
--- a/testsuite/tls1.h
+++ b/trunk/testsuite/tls1.h
diff --git a/testsuite/tls1.sh b/trunk/testsuite/tls1.sh
index f3d2113..f3d2113 100755
--- a/testsuite/tls1.sh
+++ b/trunk/testsuite/tls1.sh
diff --git a/testsuite/tls1lib1.c b/trunk/testsuite/tls1lib1.c
index eb0734b..eb0734b 100644
--- a/testsuite/tls1lib1.c
+++ b/trunk/testsuite/tls1lib1.c
diff --git a/testsuite/tls1lib2.c b/trunk/testsuite/tls1lib2.c
index eee03a9..eee03a9 100644
--- a/testsuite/tls1lib2.c
+++ b/trunk/testsuite/tls1lib2.c
diff --git a/testsuite/tls2.c b/trunk/testsuite/tls2.c
index 1246165..1246165 100644
--- a/testsuite/tls2.c
+++ b/trunk/testsuite/tls2.c
diff --git a/testsuite/tls2.sh b/trunk/testsuite/tls2.sh
index 4b515b0..4b515b0 100755
--- a/testsuite/tls2.sh
+++ b/trunk/testsuite/tls2.sh
diff --git a/testsuite/tls2lib1.c b/trunk/testsuite/tls2lib1.c
index 24b7555..24b7555 100644
--- a/testsuite/tls2lib1.c
+++ b/trunk/testsuite/tls2lib1.c
diff --git a/testsuite/tls3.sh b/trunk/testsuite/tls3.sh
index 1663ad7..e7270e9 100755
--- a/testsuite/tls3.sh
+++ b/trunk/testsuite/tls3.sh
@@ -7,7 +7,7 @@ rm -f tlstest
#( ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
SHFLAGS=
case "`uname -m`" in
- ia64|ppc*|x86_64|alpha*|s390*) SHFLAGS=-fpic;; # Does not support non-pic shared libs
+ ia64|ppc*|x86_64|alpha*|s390*|mips*) SHFLAGS=-fpic;; # Does not support non-pic shared libs
esac
rm -f tls3 tls3lib*.so tls3.log
rm -f prelink.cache
diff --git a/testsuite/tls3lib2.c b/trunk/testsuite/tls3lib2.c
index ba485d3..ba485d3 100644
--- a/testsuite/tls3lib2.c
+++ b/trunk/testsuite/tls3lib2.c
diff --git a/testsuite/tls4.c b/trunk/testsuite/tls4.c
index 0882f07..0882f07 100644
--- a/testsuite/tls4.c
+++ b/trunk/testsuite/tls4.c
diff --git a/testsuite/tls4.sh b/trunk/testsuite/tls4.sh
index e6bdde2..e6bdde2 100755
--- a/testsuite/tls4.sh
+++ b/trunk/testsuite/tls4.sh
diff --git a/testsuite/tls4lib1.c b/trunk/testsuite/tls4lib1.c
index a03af0b..a03af0b 100644
--- a/testsuite/tls4lib1.c
+++ b/trunk/testsuite/tls4lib1.c
diff --git a/testsuite/tls4lib2.c b/trunk/testsuite/tls4lib2.c
index 309504b..309504b 100644
--- a/testsuite/tls4lib2.c
+++ b/trunk/testsuite/tls4lib2.c
diff --git a/testsuite/tls5.sh b/trunk/testsuite/tls5.sh
index 68ec82f..68ec82f 100755
--- a/testsuite/tls5.sh
+++ b/trunk/testsuite/tls5.sh
diff --git a/testsuite/tls5lib1.c b/trunk/testsuite/tls5lib1.c
index 9677848..9677848 100644
--- a/testsuite/tls5lib1.c
+++ b/trunk/testsuite/tls5lib1.c
diff --git a/testsuite/tls6.sh b/trunk/testsuite/tls6.sh
index 60ae492..60ae492 100755
--- a/testsuite/tls6.sh
+++ b/trunk/testsuite/tls6.sh
diff --git a/testsuite/tls6lib1.c b/trunk/testsuite/tls6lib1.c
index 5310c06..5310c06 100644
--- a/testsuite/tls6lib1.c
+++ b/trunk/testsuite/tls6lib1.c
diff --git a/testsuite/tls7.c b/trunk/testsuite/tls7.c
index 4a3db24..4a3db24 100644
--- a/testsuite/tls7.c
+++ b/trunk/testsuite/tls7.c
diff --git a/testsuite/tls7.sh b/trunk/testsuite/tls7.sh
index 216a379..216a379 100755
--- a/testsuite/tls7.sh
+++ b/trunk/testsuite/tls7.sh
diff --git a/testsuite/undo1.sh b/trunk/testsuite/undo1.sh
index ed61b6b..ed61b6b 100755
--- a/testsuite/undo1.sh
+++ b/trunk/testsuite/undo1.sh
diff --git a/testsuite/undosyslibs.sh b/trunk/testsuite/undosyslibs.sh
index 1ce136d..1ce136d 100755
--- a/testsuite/undosyslibs.sh
+++ b/trunk/testsuite/undosyslibs.sh