aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog114
-rw-r--r--configure.ac1
-rw-r--r--src/Makefile.am6
-rw-r--r--src/cache.c10
-rw-r--r--src/canonicalize.c87
-rw-r--r--src/doit.c12
-rw-r--r--src/dso.c60
-rw-r--r--src/elf.h3562
-rw-r--r--src/execstack.c6
-rw-r--r--src/gather.c95
-rw-r--r--src/get.c89
-rw-r--r--src/main.c44
-rw-r--r--src/prelink.h27
-rw-r--r--src/rtld/COPYING339
-rw-r--r--src/rtld/COPYING.LIB502
-rw-r--r--src/rtld/ChangeLog296
-rw-r--r--src/rtld/Makefile.am30
-rw-r--r--src/rtld/README-rtld18
-rw-r--r--src/rtld/dl-hash.h77
-rw-r--r--src/rtld/dl-load.c281
-rw-r--r--src/rtld/dl-lookup.c131
-rw-r--r--src/rtld/dl-lookupX.h915
-rw-r--r--src/rtld/dl-misc.c106
-rw-r--r--src/rtld/dl-object.c57
-rw-r--r--src/rtld/dl-open.c45
-rw-r--r--src/rtld/dl-tls.c287
-rw-r--r--src/rtld/dl-version.c369
-rw-r--r--src/rtld/rtld.c1446
-rw-r--r--src/rtld/rtld.h337
-rw-r--r--src/undoall.c10
-rw-r--r--src/verify.c8
-rw-r--r--src/wrap-file.c399
-rw-r--r--testsuite/Makefile.am2
-rwxr-xr-xtestsuite/cxx1.sh16
-rwxr-xr-xtestsuite/cxx2.sh14
-rwxr-xr-xtestsuite/cxx3.sh12
-rwxr-xr-xtestsuite/cycle1.sh14
-rwxr-xr-xtestsuite/cycle2.sh20
-rwxr-xr-xtestsuite/deps1.sh32
-rwxr-xr-xtestsuite/deps2.sh28
-rwxr-xr-xtestsuite/functions.sh12
-rwxr-xr-xtestsuite/ifunc1.sh20
-rwxr-xr-xtestsuite/ifunc2.sh20
-rwxr-xr-xtestsuite/ifunc3.sh20
-rwxr-xr-xtestsuite/layout1.sh12
-rwxr-xr-xtestsuite/layout2.sh12
-rwxr-xr-xtestsuite/movelibs.sh8
-rwxr-xr-xtestsuite/order.sh20
-rwxr-xr-xtestsuite/preload1.sh28
-rwxr-xr-xtestsuite/quick1.sh110
-rwxr-xr-xtestsuite/quick2.sh114
-rwxr-xr-xtestsuite/quick3.sh22
-rwxr-xr-xtestsuite/reloc1.sh14
-rwxr-xr-xtestsuite/reloc10.sh20
-rwxr-xr-xtestsuite/reloc11.sh16
-rwxr-xr-xtestsuite/reloc2.sh18
-rwxr-xr-xtestsuite/reloc3.sh16
-rwxr-xr-xtestsuite/reloc4.sh26
-rwxr-xr-xtestsuite/reloc5.sh12
-rwxr-xr-xtestsuite/reloc6.sh38
-rwxr-xr-xtestsuite/reloc7.sh14
-rwxr-xr-xtestsuite/reloc8.sh20
-rwxr-xr-xtestsuite/reloc9.sh20
-rwxr-xr-xtestsuite/shuffle1.sh16
-rwxr-xr-xtestsuite/shuffle2.sh22
-rwxr-xr-xtestsuite/shuffle3.sh22
-rwxr-xr-xtestsuite/shuffle4.sh16
-rwxr-xr-xtestsuite/shuffle5.sh16
-rwxr-xr-xtestsuite/shuffle6.sh28
-rwxr-xr-xtestsuite/shuffle7.sh36
-rwxr-xr-xtestsuite/shuffle8.sh16
-rwxr-xr-xtestsuite/shuffle9.sh10
-rwxr-xr-xtestsuite/tls1.sh20
-rwxr-xr-xtestsuite/tls2.sh20
-rwxr-xr-xtestsuite/tls3.sh22
-rwxr-xr-xtestsuite/tls4.sh20
-rwxr-xr-xtestsuite/tls5.sh30
-rwxr-xr-xtestsuite/tls6.sh30
-rwxr-xr-xtestsuite/tls7.sh16
-rwxr-xr-xtestsuite/undo1.sh16
-rwxr-xr-xtestsuite/unprel1.sh8
81 files changed, 592 insertions, 10288 deletions
diff --git a/ChangeLog b/ChangeLog
index f6e75b2..b8fb3e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,22 +1,22 @@
2016-03-22 Mark Hatle <mark.hatle@windriver.com>
* src/gather.c, src/get.c: Fix LD_PRELOAD
+ * Merge with cross_prelink
+
+2016-03-22 Mark Hatle <mark.hatle@windriver.com>
+ * Merge with cross_prelink
2016-03-18 Donn Seeley <donn.seeley@windriver.com>
- * src/rtld/rtld.c: rewrite build_local_scope to ensure breadth-first
- processing
* testsuite/order: Add test to verify prelink/prelink-rtld resolution
order
2016-03-18 Mark Hatle <mark.hatle@windriver.com>
- * src/rtld: Add ability to debug scopes
- * src/rtld/rtld.h, src/dso.c: Fix compilation warning
+ * src/dso.c: Fix compilation warning
2016-03-10 Mark Hatle <mark.hatle@windriver.com>
* configure.ac, m4/libelf.m4, doc/Makefile.am, gelf/Makefile.am,
gelfx/Makefile.am, gelfx32/Makefile.am, patches/Makefile.am,
- src/Makefile.am, src/rtld/Makefile.am, testsuite/Makefile.am:
+ src/Makefile.am, testsuite/Makefile.am:
Update to avoid autoconf/automake warnings
- * Resync src/rtld to glibc-2.23
2015-10-29 Mark Hatle <mark.hatle@windriver.com>
Kyle McMartin <kmcmartin@redhat.com>
@@ -36,20 +36,20 @@
adjust the error to give us more info on the bad section
2015-10-28 Mark Hatle <mark.hatle@windriver.com>
+ * Merge with cross_prelink
+ * Strip out the cross compilation bits to generate a standalone
+ prelink project
+
+2015-10-28 Mark Hatle <mark.hatle@windriver.com>
* get.c: Sync rtld/prelink type_class values
2015-10-22 Mark Hatle <mark.hatle@windriver.com>
* Upstream project appears to have been abandoned
* Update the project to remove the SVN like 'trunk' dir
* Adjust the AUTHORS file
- * Move the README.cross to replace README and update it
* Move the previous ChangeLog to ChangeLog.1
- * Move the current ChangeLog.cross to ChangeLog
2015-10-21 Mark Hatle <mark.hatle@windriver.com>
- * Resync src/rtld to glibc-2.22
- * src/elf.h, src/rtld/*:
- Update elf.h to glibc 2.22 version
* get.c, prelink.h: Add symname to conflict structure
* conflict.c: Provide more debuggign on a conflict (symname)
@@ -73,9 +73,8 @@
the new BFD default.
2015-04-06 Mark Hatle <mark.hatle@windriver.com>
- Maninder Singh <maninder1.s@samsung.com>
- * src/rtld/dl-version.c: Add debug for mising ld-linux or libc
- * src/gather.c: Return rtld error messages on failure
+ Maninder Singh <maninder1.s@samsung.com>
+ * src/gather.c: Return rtld error messages on failure
2015-03-31 Mark Hatle <mark.hatle@windriver.com>
* Based on submission by Maninder Singh <maninder1.s@samsung.com>
@@ -86,23 +85,10 @@
* testsuite/Makefile.am: latest autotools has changed the
way TEST_ENVIRONMENT is defined. Remove the $(SHELL)
-2014-12-10 Mark Hatle <mark.hatle@windriver.com>
- * Resync src/rtld to glibc-2.20
- * src/elf.h, src/rtld/rtld.c, src/rtld/dl-tls.c:
- Update elf.h to glibc 2.20 version
- Add basic aarch64 support
- (do_relocs): fix comparison pltrel_end >= rel_end
-
-2014-12-10 Mark Hatle <mark.hatle@windriver.com>
- * src/rtld/COPYING, src/rtld/COPYING.LIB,
- src/rtld/ChangeLog, src/rtld/README-rtld: Add local history
- information to setup for a resync to glibc-2.20
-
2014-12-09 Jon Masters <jcm@jonmasters.org>
Mark Hatle <mark.hatle@windriver.com>
* src/arch-arm.c: Remove support for OABI arm ld-linux.so.2
Add support for hard float ld-linux-armhf.so.3
- * src/rtld/rtld.c: Add ld-linux-armhf.so.3 as a ldso name
2014-08-13 Kyle McMartin <kmcmartin@redhat.com>
Jakub Jelinek <jakub@redhat.com>
@@ -142,10 +128,6 @@
* configure.in -> configure.ac: Rename
* Replace AM_CONFIG_HEADER with AC_CONFIG_HEADERS
-2012-09-12 Joseph Myers <joseph@codesourcery.com>
- * src/rtld/dl-lookup.c: Fix variable copy reloc when host/target
- byte size is different
-
2012-09-08 Joseph Myers <joseph@codesourcery.com>
* src/arch-arm.c: Fix ARM_TLS_DTPOFF32 addends
* src/dwarf2.c: Fix address range handling related to DW_AT_high_pc
@@ -180,10 +162,6 @@
* testsuite/quick2.sh: Enable PIE test for ARM
* testsuite: Use $CCLINK instead of $CC for tls tests
-2012-04-10 Maxim Kuvyrkov <maxim@codesourcery.com>
- * src/rtld/rtld.c (find_lib_by_soname): Follow ld.so's behavior of
- pulling its name from PT_INTERP.
-
2012-05-29 Mark Hatle <mark.hatle@windriver.com>
* arch-x86_64.c: Fix R_X86_64_64 relocation
@@ -214,8 +192,6 @@
* configure.in: Fix enabling and disabling of SE Linux support
2012-01-26 Mark Hatle <mark.hatle@windriver.com>
- * elf.h, rtld/dl-lookupX.h, rtld/rtld.c: Sync to eglibc 2.15
-
Integrate R_ARM_TLS_DESC relocation support patch:
2011-04-13 Maciej W. Rozycki <macro@codesourcery.com>
@@ -241,13 +217,6 @@
PROGBITS section at the end of a segment will cause a
failure.
-2011-12-08 Mark Hatle <mark.hatle@windriver.com>
- * rtld/rtld.c: Fix an issue where missing objects would trigger
- an assert in dl-version.c
- * rtld/rtld.h: Add _dl_new_object prototype
- * rtld/rtld.c: Add support for $ORIGIN, $PLATFORM and $LIB.
- Note: $PLATFORM = ""
-
2011-10-26 Mark Hatle <mark.hatle@windriver.com>
* Merge to upstream r196
* Resolve merge conflicts with src/main.c
@@ -257,25 +226,16 @@
that platform, you manually pass:
--layout-page-size=32768
-2011-09-13 Mark Hatle <mark.hatle@windriver.com>
- * Fix printf problem causing prelink-rtld issues on x86 (32-bit)
- and arm
-
2011-08-30 Mark Hatle <mark.hatle@windriver.com>
* Merge to upstream r195
* Update testsuite to work with explicit intermedite objects
2011-08-26 Mark Hatle <mark.hatle@windriver.com>
- * Rename ld-libs.c to rtld.c
* Sync to eglibc 2.13 ld.so code
* mips specific items from ports
* sync elf_machine_type_class macros for supports archs
* Add a special check for invalid GNU_HASH entries
-2011-08-18 Mark Hatle <mark.hatle@windriver.com>
- * Resync src/elf.h to glibc 2.13
- * Move prelink-rtld specific components to src/rtld
-
2011-06-24 Mark Hatle <mark.hatle@windriver.com>
* Merge to upstream r190
@@ -313,9 +273,6 @@
* src/ld-libs.c: Handle MIPS64 TLS PLT relocs
2010-07-22 Mark Hatle <mark.hatle@windriver.com>
- * src/dso.c: Add DSO_READONLY conditionals
- * src/dso-readonly.c: remove
- * src/Makefile.am: switch RTLD dep to dso.c, pass DSO_READONLY
* configure.in: Add AM_PROG_CC_C_O
2010-07-22 Mark Hatle <mark.hatle@windriver.com>
@@ -357,28 +314,12 @@
2009-04-23 Maciej W. Rozycki <macro@codesourcery.com>
Issue #5165
- * src/ld-lookup.c (rtld_elf_hash): Handle an initial NULL
- character correctly. Reformat for consistency with
- rtld_elf_gnu_hash()
-
- 2009-04-23 Maciej W. Rozycki <macro@codesourcery.com>
-
- Issue #5165
* src/ld-do-lookup.h (FCT): Remove the hash argument and
calculate the value within the function. Call
do_lookup_get_first() and do_lookup_get_next() to iterate over
symbols.
* src/prelink.h (dynamic_info_is_set): Convert macro to a
function. Return 1 for success rather than the bit set.
- * src/ld-libs.h (ldlibs_link_map): Add l_gnu_hash, l_maskword64,
- l_nmaskwords, l_shift and l_maskwords members.
- * src/ld-libs.c (create_ldlibs_link_map): Handle the GNU hash.
- * src/ld-lookup.c (rtld_elf_gnu_hash): New function.
- (rtld_elf_any_hash): Likewise.
- (rtld_elf_hash): Move above "ld-do-lookup.h" inclusions.
- (do_lookup_get_first, do_lookup_get_next): New functions.
- (rtld_lookup_symbol): Remove hash calculation.
- (rtld_lookup_symbol_versioned): Likewise.
2009-04-23 Maciej W. Rozycki <macro@codesourcery.com>
@@ -505,7 +446,6 @@
reloc_r_type().
* src/Makefile.am (common_SOURCES): Add reloc-info.c and
reloc-info.h.
- (prelink_rtld_SOURCES): Likewise.
* src/Makefile.in: Regenerate.
* configure.in: Check for the Elf64_Byte type. Require autoconf
2.50.
@@ -590,7 +530,6 @@
* src/execstack.c: Likewise. Also use EXECSTACK_PROG.
Mark Hatle <mark.hatle@windriver.com>
- * src/ld-libs.c: Use PRELINK_RTLD_PROG, PKGVERSION and REPORT_BUGS_TO
* src/execstack.c: Use EXECSTACK_PROG in (argp_doc)
2006-11-30 Mark Shinwell <shinwell@codesourcery.com>
@@ -632,7 +571,7 @@
* configure.in (AC_CANONICAL_HOST): Remove in favour of...
(AC_CANONICAL_SYSTEM): ...this new directive.
(AC_ARG_PROGRAM): New directive.
- * src/Makefile.am (AM_CFLAGS): Define PRELINK_PROG, PRELINK_RTLD_PROG
+ * src/Makefile.am (AM_CFLAGS): Define PRELINK_PROG,
and EXEEXT.
(execstack_LDADD): Add -liberty.
* src/execstack.c (program_path, prelink_path): New variables.
@@ -643,9 +582,6 @@
(main): Initialize program_path.
* src/main.c (argp_program_version, argp_doc): Use PRELINK_PROG as
the program name.
- (main): Handle empty --rtld= arguments first. Always use
- make_relative_prefix to work out the path of the defalt rtld
- executable. Also use PRELINK_RTLD and EXEEXT for this purpose.
2010-06-14 Mark Hatle <mark.hatle@windriver.com>
* configure.in: Add option to disable selinux
@@ -729,28 +665,6 @@
* ld-libs.c: add argp option processing and WR versioning
* main.c: add WR versioning
-2006-08-09 Mark Hatle <mark.hatle@windriver.com>
-
- * ld-libs.c: Add --root argument to prelink-rtld
-
-2006-08-09 Mark Hatle <mark.hatle@windriver.com>
-
- * cross-prelink code merged and upreved
- original code from:
- MontaVista Software, Inc.
- CodeSourcery, LLC.
- * Makefile.am: add prelink-rtld, libiberty
- * dso-readonly.c: new file based on dso.c
- * gather.c: use cross-rtld
- * get.c: use cross-rtld
- * ld-do-lookup.h: Add ld-do-lookup.h from glibc
- * ld-libs.c: add cross-rtld functionality
- * ld-libs.h: ditto
- * ld-lookup.c: ditto
- * ld-lookup64.c: ditto
- * main.c: Add rtld option
- * prelink.h: add extern rtld variable
-
2006-08-09 CodeSourcery, LLC.
* main.c: if we modified /sbin/init, re-run init
diff --git a/configure.ac b/configure.ac
index 507fa89..5046176 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,7 +127,6 @@ AC_SUBST(REPORT_BUGS_TO)
AC_OUTPUT([Makefile
src/Makefile
- src/rtld/Makefile
gelfx/Makefile
gelfx32/Makefile
gelf/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 93333a8..8e5f7b8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,5 @@
## Process this file with automake to create Makefile.in
-SUBDIRS = rtld
-
PKGVERSION = "\"@PKGVERSION@\""
REPORT_BUGS_TO = "\"@REPORT_BUGS_TO@\""
@@ -10,8 +8,6 @@ AM_CFLAGS = -Wall -Wno-pointer-sign
AM_CPPFLAGS = -DSBINDIR='"@sbindir@"' -DBINDIR='"@bindir@"' \
-DEXECSTACK_PROG="\"`echo execstack | sed '$(transform)'`\"" \
-DPRELINK_PROG="\"`echo prelink | sed '$(transform)'`\"" \
- -DPRELINK_RTLD_PROG="\"`echo prelink-rtld | \
- sed '$(transform)'`\"" \
-DEXEEXT='"$(EXEEXT)"' \
-DPKGVERSION=$(PKGVERSION) \
-DREPORT_BUGS_TO=$(REPORT_BUGS_TO)
@@ -25,7 +21,7 @@ arch_SOURCES = arch-i386.c arch-alpha.c arch-ppc.c arch-ppc64.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 \
- wrap-file.c canonicalize.c reloc-info.c reloc-info.h
+ canonicalize.c reloc-info.c reloc-info.h
prelink_SOURCES = cache.c conflict.c cxx.c doit.c exec.c execle_open.c get.c \
gather.c layout.c main.c prelink.c \
prelinktab.h reloc.c reloc.h space.c undo.c undoall.c \
diff --git a/src/cache.c b/src/cache.c
index abcec27..1cc3217 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -113,7 +113,7 @@ prelink_find_entry (const char *filename, const struct stat64 *stp,
if (! stp)
{
canon_filename = prelink_canonicalize (filename, &st);
- if (canon_filename == NULL && wrap_stat64 (filename, &st) < 0)
+ if (canon_filename == NULL && stat64 (filename, &st) < 0)
{
error (0, errno, "Could not stat %s", filename);
if (insert)
@@ -364,7 +364,7 @@ prelink_load_cache (void)
size_t cache_size;
uint32_t string_start, *dep;
- fd = wrap_open (prelink_cache, O_RDONLY);
+ fd = open (prelink_cache, O_RDONLY);
if (fd < 0)
return 0; /* The cache does not exist yet. */
@@ -676,7 +676,7 @@ prelink_save_cache (int do_warn)
char prelink_cache_tmp [prelink_cache_len + sizeof (".XXXXXX")];
memcpy (mempcpy (prelink_cache_tmp, prelink_cache, prelink_cache_len),
".XXXXXX", sizeof (".XXXXXX"));
- fd = wrap_mkstemp (prelink_cache_tmp);
+ fd = mkstemp (prelink_cache_tmp);
if (fd < 0)
{
error (0, errno, "Could not write prelink cache");
@@ -688,10 +688,10 @@ prelink_save_cache (int do_warn)
|| fchmod (fd, 0644)
|| fsync (fd)
|| close (fd)
- || wrap_rename (prelink_cache_tmp, prelink_cache))
+ || rename (prelink_cache_tmp, prelink_cache))
{
error (0, errno, "Could not write prelink cache");
- wrap_unlink (prelink_cache_tmp);
+ unlink (prelink_cache_tmp);
return 1;
}
return 0;
diff --git a/src/canonicalize.c b/src/canonicalize.c
index 717e991..79df44e 100644
--- a/src/canonicalize.c
+++ b/src/canonicalize.c
@@ -28,7 +28,6 @@
#include <stddef.h>
#include "hashtab.h"
-#include "prelink.h"
htab_t prelink_dirname_htab;
@@ -73,17 +72,14 @@ dirname_eq (const void *p, const void *q)
separators ('/') or symlinks. All path components must exist.
The result is malloc'd. */
-char *
-canon_filename (const char *name, int nested, struct stat64 *stp,
- const char *chroot, int allow_last_link,
- int allow_missing)
+static char *
+canon_filename (const char *name, int nested, struct stat64 *stp)
{
- char *rpath, *dest, *extra_buf = NULL, *rpath_root;
+ char *rpath, *dest, *extra_buf = NULL;
const char *start, *end, *rpath_limit;
long int path_max;
int num_links = 0;
int stp_initialized = 0;
- int chroot_len;
if (name == NULL)
{
@@ -96,9 +92,6 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
errno = ENOENT;
return NULL;
}
- chroot_len = strlen (chroot);
- if (chroot_len > 0 && chroot[chroot_len - 1] == '/')
- chroot_len--;
#ifdef PATH_MAX
path_max = PATH_MAX;
@@ -108,7 +101,7 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
path_max = 1024;
#endif
- rpath = malloc (path_max + chroot_len + 1);
+ rpath = malloc (path_max);
if (rpath == NULL)
return NULL;
rpath_limit = rpath + path_max;
@@ -120,32 +113,12 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
rpath[0] = '\0';
goto error;
}
- if (chroot_len > 0)
- {
- struct stat64 st;
- char *cwd = canon_filename (rpath, 1, &st, chroot, 0, 0);
- if (cwd == NULL)
- goto error;
- if (memcmp (cwd, chroot, chroot_len) != 0)
- goto error;
- strcpy (rpath, cwd);
- free (cwd);
- rpath_root = rpath + chroot_len;
- }
- else
- rpath_root = rpath;
-
- dest = strchr (rpath_root, '\0');
+ dest = strchr (rpath, '\0');
}
else
{
- if (chroot_len > 0)
- rpath_root = (char *) mempcpy (rpath, chroot, chroot_len);
- else
- rpath_root = rpath;
-
- rpath_root[0] = '/';
- dest = rpath_root + 1;
+ rpath[0] = '/';
+ dest = rpath + 1;
if (!nested)
{
@@ -178,8 +151,7 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
ep->dirname_len = e.dirname_len;
memcpy (dirname, name, ep->dirname_len);
dirname[ep->dirname_len] = '\0';
- ep->canon_dirname = canon_filename (ep->dirname, 1, &st,
- chroot, 0, 0);
+ ep->canon_dirname = canon_filename (ep->dirname, 1, &st);
if (ep->canon_dirname == NULL || !S_ISDIR (st.st_mode))
free (ep);
else
@@ -196,11 +168,10 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
if (rpath + ep->canon_dirname_len + 1 >= rpath_limit)
{
- size_t new_size, root_size;
+ size_t new_size;
char *new_rpath;
new_size = rpath_limit - rpath;
- root_size = rpath_root - rpath;
if (ep->canon_dirname_len + 1 > path_max)
new_size += ep->canon_dirname_len + 1;
else
@@ -210,7 +181,6 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
goto error;
rpath = new_rpath;
rpath_limit = rpath + new_size;
- rpath_root = rpath + root_size;
}
dest = mempcpy (rpath, ep->canon_dirname, ep->canon_dirname_len);
*dest = '\0';
@@ -238,7 +208,7 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
else if (end - start == 2 && start[0] == '.' && start[1] == '.')
{
/* Back up to previous component, ignore if at root already. */
- if (dest > rpath_root + 1)
+ if (dest > rpath + 1)
while ((--dest)[-1] != '/');
stp_initialized = 0;
}
@@ -252,7 +222,6 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
if (dest + (end - start) >= rpath_limit)
{
ptrdiff_t dest_offset = dest - rpath;
- size_t root_size = rpath_root - rpath;
char *new_rpath;
new_size = rpath_limit - rpath;
@@ -265,7 +234,6 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
goto error;
rpath = new_rpath;
rpath_limit = rpath + new_size;
- rpath_root = rpath + root_size;
dest = rpath + dest_offset;
}
@@ -273,15 +241,8 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
dest = mempcpy (dest, start, end - start);
*dest = '\0';
- if (allow_last_link && *end == '\0')
- break;
-
if (lstat64 (rpath, stp) < 0)
- {
- if (allow_missing && *end == '\0')
- break;
- goto error;
- }
+ goto error;
stp_initialized = 1;
@@ -298,11 +259,7 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
n = readlink (rpath, buf, path_max);
if (n < 0)
- {
- if (allow_missing && *end == '\0')
- break;
- goto error;
- }
+ goto error;
buf[n] = '\0';
if (!extra_buf)
@@ -320,10 +277,10 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
name = end = memcpy (extra_buf, buf, n);
if (buf[0] == '/')
- dest = rpath_root + 1; /* It's an absolute symlink */
+ dest = rpath + 1; /* It's an absolute symlink */
else
/* Back up to previous component, ignore if at root already: */
- if (dest > rpath_root + 1)
+ if (dest > rpath + 1)
while ((--dest)[-1] != '/');
}
else if (!S_ISDIR (stp->st_mode) && *end != '\0')
@@ -337,8 +294,7 @@ canon_filename (const char *name, int nested, struct stat64 *stp,
--dest;
*dest = '\0';
- if (!stp_initialized && !allow_missing && !allow_last_link
- && lstat64 (rpath, stp) < 0)
+ if (!stp_initialized && lstat64 (rpath, stp) < 0)
goto error;
if (dest + 1 - rpath <= (rpath_limit - rpath) / 2)
@@ -355,20 +311,9 @@ error:
return NULL;
}
-char *unsysroot_file_name (const char *name);
-
char *
prelink_canonicalize (const char *name, struct stat64 *stp)
{
struct stat64 st;
- char *canon, *final;
-
- canon = canon_filename (name, 0, stp ? stp : &st,
- sysroot ? sysroot : "", 0, 0);
- if (canon == NULL)
- return NULL;
- final = unsysroot_file_name (canon);
- if (final != canon)
- free (canon);
- return final;
+ return canon_filename (name, 0, stp ? stp : &st);
}
diff --git a/src/doit.c b/src/doit.c
index 6b07afb..1e32ad5 100644
--- a/src/doit.c
+++ b/src/doit.c
@@ -145,7 +145,7 @@ prelink_ent (struct prelink_entry *ent)
{
size_t len;
- if (wrap_lstat64 (hardlink->canon_filename, &st) < 0)
+ if (lstat64 (hardlink->canon_filename, &st) < 0)
{
error (0, 0, "Could not stat %s (former hardlink to %s)",
hardlink->canon_filename, ent->canon_filename);
@@ -190,19 +190,19 @@ prelink_ent (struct prelink_entry *ent)
memcpy (mempcpy (move, hardlink->canon_filename, len), ".#prelink#",
sizeof (".#prelink#"));
- if (wrap_rename (hardlink->canon_filename, move) < 0)
+ if (rename (hardlink->canon_filename, move) < 0)
{
error (0, errno, "Could not hardlink %s to %s",
hardlink->canon_filename, ent->canon_filename);
continue;
}
- if (wrap_link (ent->canon_filename, hardlink->canon_filename) < 0)
+ if (link (ent->canon_filename, hardlink->canon_filename) < 0)
{
error (0, errno, "Could not hardlink %s to %s",
hardlink->canon_filename, ent->canon_filename);
- if (wrap_rename (move, hardlink->canon_filename) < 0)
+ if (rename (move, hardlink->canon_filename) < 0)
{
error (0, errno, "Could not rename %s back to %s",
move, hardlink->canon_filename);
@@ -210,7 +210,7 @@ prelink_ent (struct prelink_entry *ent)
continue;
}
- if (wrap_unlink (move) < 0)
+ if (unlink (move) < 0)
{
error (0, errno, "Could not unlink %s", move);
continue;
@@ -218,7 +218,7 @@ prelink_ent (struct prelink_entry *ent)
}
free (move);
- if (! dry_run && wrap_stat64 (ent->canon_filename, &st) >= 0)
+ if (! dry_run && stat64 (ent->canon_filename, &st) >= 0)
{
ent->dev = st.st_dev;
ent->ino = st.st_ino;
diff --git a/src/dso.c b/src/dso.c
index ae5e04d..1dac153 100644
--- a/src/dso.c
+++ b/src/dso.c
@@ -231,13 +231,11 @@ check_dso (DSO *dso)
last = i;
}
-#ifndef DSO_READONLY
if (dso_has_bad_textrel (dso))
{
error (0, 0, "%s has text relocations", dso->filename);
return 1;
}
-#endif
return 0;
}
@@ -247,7 +245,7 @@ open_dso (const char *name)
{
int fd;
- fd = wrap_open (name, O_RDONLY);
+ fd = open (name, O_RDONLY);
if (fd == -1)
{
error (0, errno, "cannot open \"%s\"", name);
@@ -289,10 +287,8 @@ fdopen_dso (int fd, const char *name)
GElf_Addr last_off;
int i, j, k, *sections, *invsections;
DSO *dso = NULL;
-#ifndef DSO_READONLY
struct PLArch *plarch;
extern struct PLArch __start_pl_arch[], __stop_pl_arch[];
-#endif /* DSO_READONLY */
elf = elf_begin (fd, ELF_C_READ, NULL);
if (elf == NULL)
@@ -419,7 +415,6 @@ fdopen_dso (int fd, const char *name)
invsections[sections[i]] = i;
}
-#ifndef DSO_READONLY
if (j)
{
dso->move = init_section_move (dso);
@@ -428,7 +423,6 @@ fdopen_dso (int fd, const char *name)
memcpy (dso->move->old_to_new, invsections, dso->ehdr.e_shnum * sizeof (int));
memcpy (dso->move->new_to_old, sections, dso->ehdr.e_shnum * sizeof (int));
}
-#endif /* DSO_READONLY */
last_off = 0;
for (i = 1; i < ehdr.e_shnum; ++i)
@@ -487,7 +481,6 @@ fdopen_dso (int fd, const char *name)
}
dso->ehdr.e_shstrndx = invsections[dso->ehdr.e_shstrndx];
-#ifndef DSO_READONLY
for (plarch = __start_pl_arch; plarch < __stop_pl_arch; plarch++)
if (plarch->class == ehdr.e_ident[EI_CLASS]
&& (plarch->machine == ehdr.e_machine
@@ -503,9 +496,6 @@ fdopen_dso (int fd, const char *name)
}
dso->arch = plarch;
-#else
- dso->arch = NULL;
-#endif /* DSO_READONLY */
dso->base = ~(GElf_Addr) 0;
dso->align = 0;
@@ -545,7 +535,6 @@ fdopen_dso (int fd, const char *name)
dso->soname = (const char *) strdup (soname);
}
-#ifndef DSO_READONLY
if (dso->arch->machine == EM_ALPHA
|| dso->arch->machine == EM_MIPS)
for (i = 1; i < ehdr.e_shnum; ++i)
@@ -562,7 +551,6 @@ fdopen_dso (int fd, const char *name)
break;
}
}
-#endif /* DSO_READONLY */
return dso;
@@ -585,7 +573,6 @@ error_out:
return NULL;
}
-#ifndef DSO_READONLY
static int
adjust_symtab_section_indices (DSO *dso, int n, int old_shnum, int *old_to_new)
{
@@ -796,15 +783,15 @@ reopen_dso (DSO *dso, struct section_move *move, const char *temp_base)
temp_base = dso->filename;
sprintf (filename, "%s.#prelink#.XXXXXX", temp_base);
- fd = wrap_mkstemp (filename);
+ fd = mkstemp (filename);
if (fd == -1)
{
strcpy (filename, "/tmp/#prelink#.XXXXXX");
- fd = wrap_mkstemp (filename);
+ fd = mkstemp (filename);
if (fd == -1)
{
strcpy (filename, "/dev/shm/#prelink#.XXXXXX");
- fd = wrap_mkstemp (filename);
+ fd = mkstemp (filename);
}
if (fd == -1)
{
@@ -1046,7 +1033,7 @@ error_out:
elf_end (elf);
if (fd != -1)
{
- wrap_unlink (filename);
+ unlink (filename);
fsync (fd);
close (fd);
}
@@ -1112,7 +1099,6 @@ adjust_symtab (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust)
elf_flagscn (scn, ELF_C_SET, ELF_F_DIRTY);
return 0;
}
-#endif /* DSO_READONLY */
int
dso_is_rdwr (DSO *dso)
@@ -1120,7 +1106,6 @@ dso_is_rdwr (DSO *dso)
return dso->elfro != NULL;
}
-#ifndef DSO_READONLY
GElf_Addr
adjust_old_to_new (DSO *dso, GElf_Addr addr)
{
@@ -1223,7 +1208,6 @@ adjust_dynamic (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust)
read_dynamic (dso);
return 0;
}
-#endif /* DSO_READONLY */
int
addr_to_sec (DSO *dso, GElf_Addr addr)
@@ -1245,7 +1229,6 @@ addr_to_sec (DSO *dso, GElf_Addr addr)
return -1;
}
-#ifndef DSO_READONLY
static int
adjust_rel (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust)
{
@@ -1650,7 +1633,6 @@ relocate_dso (DSO *dso, GElf_Addr base)
return adjust_dso (dso, 0, base - dso->base);
}
-#endif /* DSO_READONLY */
static int
close_dso_1 (DSO *dso)
@@ -1698,12 +1680,11 @@ close_dso (DSO *dso)
int rdwr = dso_is_rdwr (dso);
if (rdwr && dso->temp_filename != NULL)
- wrap_unlink (dso->temp_filename);
+ unlink (dso->temp_filename);
close_dso_1 (dso);
return 0;
}
-#ifndef DSO_READONLY
int
prepare_write_dso (DSO *dso)
{
@@ -1743,7 +1724,7 @@ write_dso (DSO *dso)
static int
copy_xattrs (const char *temp_name, const char *name, int ignore_errors)
{
- ssize_t sz = wrap_listxattr (name, NULL, 0), valsz = 0;
+ ssize_t sz = listxattr (name, NULL, 0), valsz = 0;
char *list = NULL, *end, *p, *val = NULL, *newval;
if (sz < 0)
@@ -1755,7 +1736,7 @@ copy_xattrs (const char *temp_name, const char *name, int ignore_errors)
list = malloc (sz + 1);
if (list == NULL)
goto read_err;
- sz = wrap_listxattr (name, list, sz);
+ sz = listxattr (name, list, sz);
if (sz < 0)
goto read_err;
end = list + sz;
@@ -1765,12 +1746,12 @@ copy_xattrs (const char *temp_name, const char *name, int ignore_errors)
continue;
else
{
- sz = wrap_getxattr (name, p, val, valsz);
+ sz = getxattr (name, p, val, valsz);
if (sz < 0)
{
if (errno != ERANGE)
goto read_err;
- sz = wrap_getxattr (name, p, NULL, 0);
+ sz = getxattr (name, p, NULL, 0);
if (sz < 0)
goto read_err;
}
@@ -1783,11 +1764,11 @@ copy_xattrs (const char *temp_name, const char *name, int ignore_errors)
if (newval == NULL)
goto read_err;
val = newval;
- sz = wrap_getxattr (name, p, val, valsz);
+ sz = getxattr (name, p, val, valsz);
if (sz < 0)
goto read_err;
}
- if (wrap_setxattr (temp_name, p, val, sz, 0) < 0)
+ if (setxattr (temp_name, p, val, sz, 0) < 0)
{
if (errno == ENOSYS || errno == ENOTSUP)
continue;
@@ -1798,7 +1779,7 @@ copy_xattrs (const char *temp_name, const char *name, int ignore_errors)
newval = malloc (sz);
if (newval == NULL
- || (newsz = wrap_getxattr (temp_name, p, newval, sz)) != sz
+ || (newsz = getxattr (temp_name, p, newval, sz)) != sz
|| memcmp (val, newval, sz) != 0)
{
error (0, err, "Could not set extended attributes for %s",
@@ -1870,7 +1851,7 @@ copy_fd_to_file (int fdin, const char *name, struct stat64 *st)
if (strcmp (name, "-") == 0)
fdout = 1;
else
- fdout = wrap_open (name, O_WRONLY | O_CREAT, 0600);
+ fdout = open (name, O_WRONLY | O_CREAT, 0600);
if (fdout != -1
&& fstat64 (fdin, &stt) >= 0
&& send_file (fdout, fdin, &off, stt.st_size) == stt.st_size)
@@ -1882,7 +1863,7 @@ copy_fd_to_file (int fdin, const char *name, struct stat64 *st)
set_security_context (name, name, 1);
u.actime = time (NULL);
u.modtime = st->st_mtime;
- wrap_utime (name, &u);
+ utime (name, &u);
close (fdout);
}
return 0;
@@ -1946,33 +1927,33 @@ update_dso (DSO *dso, const char *orig_name)
close_dso_1 (dso);
u.actime = time (NULL);
u.modtime = st.st_mtime;
- wrap_utime (name2, &u);
+ utime (name2, &u);
if (set_security_context (name2, orig_name ? orig_name : name1,
orig_name != NULL))
{
if (fdin != -1)
close (fdin);
- wrap_unlink (name2);
+ unlink (name2);
return 1;
}
if ((orig_name != NULL && strcmp (name1, "-") == 0)
- || wrap_rename (name2, name1))
+ || rename (name2, name1))
{
if (fdin != -1)
{
int err = copy_fd_to_file (fdin, name1, &st);
close (fdin);
- wrap_unlink (name2);
+ unlink (name2);
if (err == 0)
return 0;
error (0, err, "Could not rename nor copy temporary to %s",
name1);
return 1;
}
- wrap_unlink (name2);
+ unlink (name2);
error (0, errno, "Could not rename temporary to %s", name1);
return 1;
}
@@ -2009,4 +1990,3 @@ dso_has_bad_textrel (DSO *dso)
return 0;
}
}
-#endif /* DSO_READONLY */
diff --git a/src/elf.h b/src/elf.h
deleted file mode 100644
index fbadda4..0000000
--- a/src/elf.h
+++ /dev/null
@@ -1,3562 +0,0 @@
-/* This file defines standard ELF types, structures, and macros.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _ELF_H
-#define _ELF_H 1
-
-#include <features.h>
-
-__BEGIN_DECLS
-
-/* Standard ELF types. */
-
-#include <stdint.h>
-
-/* Type for a 16-bit quantity. */
-typedef uint16_t Elf32_Half;
-typedef uint16_t Elf64_Half;
-
-/* Types for signed and unsigned 32-bit quantities. */
-typedef uint32_t Elf32_Word;
-typedef int32_t Elf32_Sword;
-typedef uint32_t Elf64_Word;
-typedef int32_t Elf64_Sword;
-
-/* Types for signed and unsigned 64-bit quantities. */
-typedef uint64_t Elf32_Xword;
-typedef int64_t Elf32_Sxword;
-typedef uint64_t Elf64_Xword;
-typedef int64_t Elf64_Sxword;
-
-/* Type of addresses. */
-typedef uint32_t Elf32_Addr;
-typedef uint64_t Elf64_Addr;
-
-/* Type of file offsets. */
-typedef uint32_t Elf32_Off;
-typedef uint64_t Elf64_Off;
-
-/* Type for section indices, which are 16-bit quantities. */
-typedef uint16_t Elf32_Section;
-typedef uint16_t Elf64_Section;
-
-/* Type for version symbol information. */
-typedef Elf32_Half Elf32_Versym;
-typedef Elf64_Half Elf64_Versym;
-
-
-/* The ELF file header. This appears at the start of every ELF file. */
-
-#define EI_NIDENT (16)
-
-typedef struct
-{
- unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
- Elf32_Half e_type; /* Object file type */
- Elf32_Half e_machine; /* Architecture */
- Elf32_Word e_version; /* Object file version */
- Elf32_Addr e_entry; /* Entry point virtual address */
- Elf32_Off e_phoff; /* Program header table file offset */
- Elf32_Off e_shoff; /* Section header table file offset */
- Elf32_Word e_flags; /* Processor-specific flags */
- Elf32_Half e_ehsize; /* ELF header size in bytes */
- Elf32_Half e_phentsize; /* Program header table entry size */
- Elf32_Half e_phnum; /* Program header table entry count */
- Elf32_Half e_shentsize; /* Section header table entry size */
- Elf32_Half e_shnum; /* Section header table entry count */
- Elf32_Half e_shstrndx; /* Section header string table index */
-} Elf32_Ehdr;
-
-typedef struct
-{
- unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
- Elf64_Half e_type; /* Object file type */
- Elf64_Half e_machine; /* Architecture */
- Elf64_Word e_version; /* Object file version */
- Elf64_Addr e_entry; /* Entry point virtual address */
- Elf64_Off e_phoff; /* Program header table file offset */
- Elf64_Off e_shoff; /* Section header table file offset */
- Elf64_Word e_flags; /* Processor-specific flags */
- Elf64_Half e_ehsize; /* ELF header size in bytes */
- Elf64_Half e_phentsize; /* Program header table entry size */
- Elf64_Half e_phnum; /* Program header table entry count */
- Elf64_Half e_shentsize; /* Section header table entry size */
- Elf64_Half e_shnum; /* Section header table entry count */
- Elf64_Half e_shstrndx; /* Section header string table index */
-} Elf64_Ehdr;
-
-/* Fields in the e_ident array. The EI_* macros are indices into the
- array. The macros under each EI_* macro are the values the byte
- may have. */
-
-#define EI_MAG0 0 /* File identification byte 0 index */
-#define ELFMAG0 0x7f /* Magic number byte 0 */
-
-#define EI_MAG1 1 /* File identification byte 1 index */
-#define ELFMAG1 'E' /* Magic number byte 1 */
-
-#define EI_MAG2 2 /* File identification byte 2 index */
-#define ELFMAG2 'L' /* Magic number byte 2 */
-
-#define EI_MAG3 3 /* File identification byte 3 index */
-#define ELFMAG3 'F' /* Magic number byte 3 */
-
-/* Conglomeration of the identification bytes, for easy testing as a word. */
-#define ELFMAG "\177ELF"
-#define SELFMAG 4
-
-#define EI_CLASS 4 /* File class byte index */
-#define ELFCLASSNONE 0 /* Invalid class */
-#define ELFCLASS32 1 /* 32-bit objects */
-#define ELFCLASS64 2 /* 64-bit objects */
-#define ELFCLASSNUM 3
-
-#define EI_DATA 5 /* Data encoding byte index */
-#define ELFDATANONE 0 /* Invalid data encoding */
-#define ELFDATA2LSB 1 /* 2's complement, little endian */
-#define ELFDATA2MSB 2 /* 2's complement, big endian */
-#define ELFDATANUM 3
-
-#define EI_VERSION 6 /* File version byte index */
- /* Value must be EV_CURRENT */
-
-#define EI_OSABI 7 /* OS ABI identification */
-#define ELFOSABI_NONE 0 /* UNIX System V ABI */
-#define ELFOSABI_SYSV 0 /* Alias. */
-#define ELFOSABI_HPUX 1 /* HP-UX */
-#define ELFOSABI_NETBSD 2 /* NetBSD. */
-#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */
-#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */
-#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */
-#define ELFOSABI_AIX 7 /* IBM AIX. */
-#define ELFOSABI_IRIX 8 /* SGI Irix. */
-#define ELFOSABI_FREEBSD 9 /* FreeBSD. */
-#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */
-#define ELFOSABI_MODESTO 11 /* Novell Modesto. */
-#define ELFOSABI_OPENBSD 12 /* OpenBSD. */
-#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */
-#define ELFOSABI_ARM 97 /* ARM */
-#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
-
-#define EI_ABIVERSION 8 /* ABI version */
-
-#define EI_PAD 9 /* Byte index of padding bytes */
-
-/* Legal values for e_type (object file type). */
-
-#define ET_NONE 0 /* No file type */
-#define ET_REL 1 /* Relocatable file */
-#define ET_EXEC 2 /* Executable file */
-#define ET_DYN 3 /* Shared object file */
-#define ET_CORE 4 /* Core file */
-#define ET_NUM 5 /* Number of defined types */
-#define ET_LOOS 0xfe00 /* OS-specific range start */
-#define ET_HIOS 0xfeff /* OS-specific range end */
-#define ET_LOPROC 0xff00 /* Processor-specific range start */
-#define ET_HIPROC 0xffff /* Processor-specific range end */
-
-/* Legal values for e_machine (architecture). */
-
-#define EM_NONE 0 /* No machine */
-#define EM_M32 1 /* AT&T WE 32100 */
-#define EM_SPARC 2 /* SUN SPARC */
-#define EM_386 3 /* Intel 80386 */
-#define EM_68K 4 /* Motorola m68k family */
-#define EM_88K 5 /* Motorola m88k family */
-#define EM_860 7 /* Intel 80860 */
-#define EM_MIPS 8 /* MIPS R3000 big-endian */
-#define EM_S370 9 /* IBM System/370 */
-#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
-
-#define EM_PARISC 15 /* HPPA */
-#define EM_VPP500 17 /* Fujitsu VPP500 */
-#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
-#define EM_960 19 /* Intel 80960 */
-#define EM_PPC 20 /* PowerPC */
-#define EM_PPC64 21 /* PowerPC 64-bit */
-#define EM_S390 22 /* IBM S390 */
-
-#define EM_V800 36 /* NEC V800 series */
-#define EM_FR20 37 /* Fujitsu FR20 */
-#define EM_RH32 38 /* TRW RH-32 */
-#define EM_RCE 39 /* Motorola RCE */
-#define EM_ARM 40 /* ARM */
-#define EM_FAKE_ALPHA 41 /* Digital Alpha */
-#define EM_SH 42 /* Hitachi SH */
-#define EM_SPARCV9 43 /* SPARC v9 64-bit */
-#define EM_TRICORE 44 /* Siemens Tricore */
-#define EM_ARC 45 /* Argonaut RISC Core */
-#define EM_H8_300 46 /* Hitachi H8/300 */
-#define EM_H8_300H 47 /* Hitachi H8/300H */
-#define EM_H8S 48 /* Hitachi H8S */
-#define EM_H8_500 49 /* Hitachi H8/500 */
-#define EM_IA_64 50 /* Intel Merced */
-#define EM_MIPS_X 51 /* Stanford MIPS-X */
-#define EM_COLDFIRE 52 /* Motorola Coldfire */
-#define EM_68HC12 53 /* Motorola M68HC12 */
-#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/
-#define EM_PCP 55 /* Siemens PCP */
-#define EM_NCPU 56 /* Sony nCPU embeeded RISC */
-#define EM_NDR1 57 /* Denso NDR1 microprocessor */
-#define EM_STARCORE 58 /* Motorola Start*Core processor */
-#define EM_ME16 59 /* Toyota ME16 processor */
-#define EM_ST100 60 /* STMicroelectronic ST100 processor */
-#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/
-#define EM_X86_64 62 /* AMD x86-64 architecture */
-#define EM_PDSP 63 /* Sony DSP Processor */
-
-#define EM_FX66 66 /* Siemens FX66 microcontroller */
-#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
-#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
-#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */
-#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */
-#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */
-#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */
-#define EM_SVX 73 /* Silicon Graphics SVx */
-#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */
-#define EM_VAX 75 /* Digital VAX */
-#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
-#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */
-#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
-#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
-#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
-#define EM_HUANY 81 /* Harvard University machine-independent object files */
-#define EM_PRISM 82 /* SiTera Prism */
-#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
-#define EM_FR30 84 /* Fujitsu FR30 */
-#define EM_D10V 85 /* Mitsubishi D10V */
-#define EM_D30V 86 /* Mitsubishi D30V */
-#define EM_V850 87 /* NEC v850 */
-#define EM_M32R 88 /* Mitsubishi M32R */
-#define EM_MN10300 89 /* Matsushita MN10300 */
-#define EM_MN10200 90 /* Matsushita MN10200 */
-#define EM_PJ 91 /* picoJava */
-#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
-#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
-#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
-#define EM_ALTERA_NIOS2 113 /* Altera Nios II */
-#define EM_AARCH64 183 /* ARM AARCH64 */
-#define EM_TILEPRO 188 /* Tilera TILEPro */
-#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */
-#define EM_TILEGX 191 /* Tilera TILE-Gx */
-#define EM_NUM 192
-
-/* If it is necessary to assign new unofficial EM_* values, please
- pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
- chances of collision with official or non-GNU unofficial values. */
-
-#define EM_ALPHA 0x9026
-
-/* Legal values for e_version (version). */
-
-#define EV_NONE 0 /* Invalid ELF version */
-#define EV_CURRENT 1 /* Current version */
-#define EV_NUM 2
-
-/* Section header. */
-
-typedef struct
-{
- Elf32_Word sh_name; /* Section name (string tbl index) */
- Elf32_Word sh_type; /* Section type */
- Elf32_Word sh_flags; /* Section flags */
- Elf32_Addr sh_addr; /* Section virtual addr at execution */
- Elf32_Off sh_offset; /* Section file offset */
- Elf32_Word sh_size; /* Section size in bytes */
- Elf32_Word sh_link; /* Link to another section */
- Elf32_Word sh_info; /* Additional section information */
- Elf32_Word sh_addralign; /* Section alignment */
- Elf32_Word sh_entsize; /* Entry size if section holds table */
-} Elf32_Shdr;
-
-typedef struct
-{
- Elf64_Word sh_name; /* Section name (string tbl index) */
- Elf64_Word sh_type; /* Section type */
- Elf64_Xword sh_flags; /* Section flags */
- Elf64_Addr sh_addr; /* Section virtual addr at execution */
- Elf64_Off sh_offset; /* Section file offset */
- Elf64_Xword sh_size; /* Section size in bytes */
- Elf64_Word sh_link; /* Link to another section */
- Elf64_Word sh_info; /* Additional section information */
- Elf64_Xword sh_addralign; /* Section alignment */
- Elf64_Xword sh_entsize; /* Entry size if section holds table */
-} Elf64_Shdr;
-
-/* Special section indices. */
-
-#define SHN_UNDEF 0 /* Undefined section */
-#define SHN_LORESERVE 0xff00 /* Start of reserved indices */
-#define SHN_LOPROC 0xff00 /* Start of processor-specific */
-#define SHN_BEFORE 0xff00 /* Order section before all others
- (Solaris). */
-#define SHN_AFTER 0xff01 /* Order section after all others
- (Solaris). */
-#define SHN_HIPROC 0xff1f /* End of processor-specific */
-#define SHN_LOOS 0xff20 /* Start of OS-specific */
-#define SHN_HIOS 0xff3f /* End of OS-specific */
-#define SHN_ABS 0xfff1 /* Associated symbol is absolute */
-#define SHN_COMMON 0xfff2 /* Associated symbol is common */
-#define SHN_XINDEX 0xffff /* Index is in extra table. */
-#define SHN_HIRESERVE 0xffff /* End of reserved indices */
-
-/* Legal values for sh_type (section type). */
-
-#define SHT_NULL 0 /* Section header table entry unused */
-#define SHT_PROGBITS 1 /* Program data */
-#define SHT_SYMTAB 2 /* Symbol table */
-#define SHT_STRTAB 3 /* String table */
-#define SHT_RELA 4 /* Relocation entries with addends */
-#define SHT_HASH 5 /* Symbol hash table */
-#define SHT_DYNAMIC 6 /* Dynamic linking information */
-#define SHT_NOTE 7 /* Notes */
-#define SHT_NOBITS 8 /* Program space with no data (bss) */
-#define SHT_REL 9 /* Relocation entries, no addends */
-#define SHT_SHLIB 10 /* Reserved */
-#define SHT_DYNSYM 11 /* Dynamic linker symbol table */
-#define SHT_INIT_ARRAY 14 /* Array of constructors */
-#define SHT_FINI_ARRAY 15 /* Array of destructors */
-#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
-#define SHT_GROUP 17 /* Section group */
-#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */
-#define SHT_NUM 19 /* Number of defined types. */
-#define SHT_LOOS 0x60000000 /* Start OS-specific. */
-#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */
-#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */
-#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */
-#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */
-#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */
-#define SHT_SUNW_move 0x6ffffffa
-#define SHT_SUNW_COMDAT 0x6ffffffb
-#define SHT_SUNW_syminfo 0x6ffffffc
-#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */
-#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */
-#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */
-#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */
-#define SHT_HIOS 0x6fffffff /* End OS-specific type */
-#define SHT_LOPROC 0x70000000 /* Start of processor-specific */
-#define SHT_HIPROC 0x7fffffff /* End of processor-specific */
-#define SHT_LOUSER 0x80000000 /* Start of application-specific */
-#define SHT_HIUSER 0x8fffffff /* End of application-specific */
-
-/* Legal values for sh_flags (section flags). */
-
-#define SHF_WRITE (1 << 0) /* Writable */
-#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
-#define SHF_EXECINSTR (1 << 2) /* Executable */
-#define SHF_MERGE (1 << 4) /* Might be merged */
-#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */
-#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */
-#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */
-#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling
- required */
-#define SHF_GROUP (1 << 9) /* Section is member of a group. */
-#define SHF_TLS (1 << 10) /* Section hold thread-local data. */
-#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */
-#define SHF_MASKOS 0x0ff00000 /* OS-specific. */
-#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
-#define SHF_ORDERED (1 << 30) /* Special ordering requirement
- (Solaris). */
-#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless
- referenced or allocated (Solaris).*/
-
-/* Section compression header. Used when SHF_COMPRESSED is set. */
-
-typedef struct
-{
- Elf32_Word ch_type; /* Compression format. */
- Elf32_Word ch_size; /* Uncompressed data size. */
- Elf32_Word ch_addralign; /* Uncompressed data alignment. */
-} Elf32_Chdr;
-
-typedef struct
-{
- Elf64_Word ch_type; /* Compression format. */
- Elf64_Word ch_reserved;
- Elf64_Xword ch_size; /* Uncompressed data size. */
- Elf64_Xword ch_addralign; /* Uncompressed data alignment. */
-} Elf64_Chdr;
-
-/* Legal values for ch_type (compression algorithm). */
-#define ELFCOMPRESS_ZLIB 1 /* ZLIB/DEFLATE algorithm. */
-#define ELFCOMPRESS_LOOS 0x60000000 /* Start of OS-specific. */
-#define ELFCOMPRESS_HIOS 0x6fffffff /* End of OS-specific. */
-#define ELFCOMPRESS_LOPROC 0x70000000 /* Start of processor-specific. */
-#define ELFCOMPRESS_HIPROC 0x7fffffff /* End of processor-specific. */
-
-/* Section group handling. */
-#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */
-
-/* Symbol table entry. */
-
-typedef struct
-{
- Elf32_Word st_name; /* Symbol name (string tbl index) */
- Elf32_Addr st_value; /* Symbol value */
- Elf32_Word st_size; /* Symbol size */
- unsigned char st_info; /* Symbol type and binding */
- unsigned char st_other; /* Symbol visibility */
- Elf32_Section st_shndx; /* Section index */
-} Elf32_Sym;
-
-typedef struct
-{
- Elf64_Word st_name; /* Symbol name (string tbl index) */
- unsigned char st_info; /* Symbol type and binding */
- unsigned char st_other; /* Symbol visibility */
- Elf64_Section st_shndx; /* Section index */
- Elf64_Addr st_value; /* Symbol value */
- Elf64_Xword st_size; /* Symbol size */
-} Elf64_Sym;
-
-/* The syminfo section if available contains additional information about
- every dynamic symbol. */
-
-typedef struct
-{
- Elf32_Half si_boundto; /* Direct bindings, symbol bound to */
- Elf32_Half si_flags; /* Per symbol flags */
-} Elf32_Syminfo;
-
-typedef struct
-{
- Elf64_Half si_boundto; /* Direct bindings, symbol bound to */
- Elf64_Half si_flags; /* Per symbol flags */
-} Elf64_Syminfo;
-
-/* Possible values for si_boundto. */
-#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */
-#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */
-#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */
-
-/* Possible bitmasks for si_flags. */
-#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
-#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */
-#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */
-#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy
- loaded */
-/* Syminfo version values. */
-#define SYMINFO_NONE 0
-#define SYMINFO_CURRENT 1
-#define SYMINFO_NUM 2
-
-
-/* How to extract and insert information held in the st_info field. */
-
-#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
-#define ELF32_ST_TYPE(val) ((val) & 0xf)
-#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
-
-/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
-#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
-#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
-#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
-
-/* Legal values for ST_BIND subfield of st_info (symbol binding). */
-
-#define STB_LOCAL 0 /* Local symbol */
-#define STB_GLOBAL 1 /* Global symbol */
-#define STB_WEAK 2 /* Weak symbol */
-#define STB_NUM 3 /* Number of defined types. */
-#define STB_LOOS 10 /* Start of OS-specific */
-#define STB_GNU_UNIQUE 10 /* Unique symbol. */
-#define STB_HIOS 12 /* End of OS-specific */
-#define STB_LOPROC 13 /* Start of processor-specific */
-#define STB_HIPROC 15 /* End of processor-specific */
-
-/* Legal values for ST_TYPE subfield of st_info (symbol type). */
-
-#define STT_NOTYPE 0 /* Symbol type is unspecified */
-#define STT_OBJECT 1 /* Symbol is a data object */
-#define STT_FUNC 2 /* Symbol is a code object */
-#define STT_SECTION 3 /* Symbol associated with a section */
-#define STT_FILE 4 /* Symbol's name is file name */
-#define STT_COMMON 5 /* Symbol is a common data object */
-#define STT_TLS 6 /* Symbol is thread-local data object*/
-#define STT_NUM 7 /* Number of defined types. */
-#define STT_LOOS 10 /* Start of OS-specific */
-#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */
-#define STT_HIOS 12 /* End of OS-specific */
-#define STT_LOPROC 13 /* Start of processor-specific */
-#define STT_HIPROC 15 /* End of processor-specific */
-
-
-/* Symbol table indices are found in the hash buckets and chain table
- of a symbol hash table section. This special index value indicates
- the end of a chain, meaning no further symbols are found in that bucket. */
-
-#define STN_UNDEF 0 /* End of a chain. */
-
-
-/* How to extract and insert information held in the st_other field. */
-
-#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
-
-/* For ELF64 the definitions are the same. */
-#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
-
-/* Symbol visibility specification encoded in the st_other field. */
-#define STV_DEFAULT 0 /* Default symbol visibility rules */
-#define STV_INTERNAL 1 /* Processor specific hidden class */
-#define STV_HIDDEN 2 /* Sym unavailable in other modules */
-#define STV_PROTECTED 3 /* Not preemptible, not exported */
-
-
-/* Relocation table entry without addend (in section of type SHT_REL). */
-
-typedef struct
-{
- Elf32_Addr r_offset; /* Address */
- Elf32_Word r_info; /* Relocation type and symbol index */
-} Elf32_Rel;
-
-/* I have seen two different definitions of the Elf64_Rel and
- Elf64_Rela structures, so we'll leave them out until Novell (or
- whoever) gets their act together. */
-/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */
-
-typedef struct
-{
- Elf64_Addr r_offset; /* Address */
- Elf64_Xword r_info; /* Relocation type and symbol index */
-} Elf64_Rel;
-
-/* Relocation table entry with addend (in section of type SHT_RELA). */
-
-typedef struct
-{
- Elf32_Addr r_offset; /* Address */
- Elf32_Word r_info; /* Relocation type and symbol index */
- Elf32_Sword r_addend; /* Addend */
-} Elf32_Rela;
-
-typedef struct
-{
- Elf64_Addr r_offset; /* Address */
- Elf64_Xword r_info; /* Relocation type and symbol index */
- Elf64_Sxword r_addend; /* Addend */
-} Elf64_Rela;
-
-/* How to extract and insert information held in the r_info field. */
-
-#define ELF32_R_SYM(val) ((val) >> 8)
-#define ELF32_R_TYPE(val) ((val) & 0xff)
-#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
-
-#define ELF64_R_SYM(i) ((i) >> 32)
-#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
-#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type))
-
-/* Program segment header. */
-
-typedef struct
-{
- Elf32_Word p_type; /* Segment type */
- Elf32_Off p_offset; /* Segment file offset */
- Elf32_Addr p_vaddr; /* Segment virtual address */
- Elf32_Addr p_paddr; /* Segment physical address */
- Elf32_Word p_filesz; /* Segment size in file */
- Elf32_Word p_memsz; /* Segment size in memory */
- Elf32_Word p_flags; /* Segment flags */
- Elf32_Word p_align; /* Segment alignment */
-} Elf32_Phdr;
-
-typedef struct
-{
- Elf64_Word p_type; /* Segment type */
- Elf64_Word p_flags; /* Segment flags */
- Elf64_Off p_offset; /* Segment file offset */
- Elf64_Addr p_vaddr; /* Segment virtual address */
- Elf64_Addr p_paddr; /* Segment physical address */
- Elf64_Xword p_filesz; /* Segment size in file */
- Elf64_Xword p_memsz; /* Segment size in memory */
- Elf64_Xword p_align; /* Segment alignment */
-} Elf64_Phdr;
-
-/* Special value for e_phnum. This indicates that the real number of
- program headers is too large to fit into e_phnum. Instead the real
- value is in the field sh_info of section 0. */
-
-#define PN_XNUM 0xffff
-
-/* Legal values for p_type (segment type). */
-
-#define PT_NULL 0 /* Program header table entry unused */
-#define PT_LOAD 1 /* Loadable program segment */
-#define PT_DYNAMIC 2 /* Dynamic linking information */
-#define PT_INTERP 3 /* Program interpreter */
-#define PT_NOTE 4 /* Auxiliary information */
-#define PT_SHLIB 5 /* Reserved */
-#define PT_PHDR 6 /* Entry for header table itself */
-#define PT_TLS 7 /* Thread-local storage segment */
-#define PT_NUM 8 /* Number of defined types */
-#define PT_LOOS 0x60000000 /* Start of OS-specific */
-#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
-#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
-#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
-#define PT_LOSUNW 0x6ffffffa
-#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
-#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
-#define PT_HISUNW 0x6fffffff
-#define PT_HIOS 0x6fffffff /* End of OS-specific */
-#define PT_LOPROC 0x70000000 /* Start of processor-specific */
-#define PT_HIPROC 0x7fffffff /* End of processor-specific */
-
-/* Legal values for p_flags (segment flags). */
-
-#define PF_X (1 << 0) /* Segment is executable */
-#define PF_W (1 << 1) /* Segment is writable */
-#define PF_R (1 << 2) /* Segment is readable */
-#define PF_MASKOS 0x0ff00000 /* OS-specific */
-#define PF_MASKPROC 0xf0000000 /* Processor-specific */
-
-/* Legal values for note segment descriptor types for core files. */
-
-#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
-#define NT_FPREGSET 2 /* Contains copy of fpregset struct */
-#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
-#define NT_PRXREG 4 /* Contains copy of prxregset struct */
-#define NT_TASKSTRUCT 4 /* Contains copy of task structure */
-#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */
-#define NT_AUXV 6 /* Contains copy of auxv array */
-#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */
-#define NT_ASRS 8 /* Contains copy of asrset struct */
-#define NT_PSTATUS 10 /* Contains copy of pstatus struct */
-#define NT_PSINFO 13 /* Contains copy of psinfo struct */
-#define NT_PRCRED 14 /* Contains copy of prcred struct */
-#define NT_UTSNAME 15 /* Contains copy of utsname struct */
-#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */
-#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */
-#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */
-#define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t,
- size might increase */
-#define NT_FILE 0x46494c45 /* Contains information about mapped
- files */
-#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */
-#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
-#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
-#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
-#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
-#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
-#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
-#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
-#define NT_S390_TIMER 0x301 /* s390 timer register */
-#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
-#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
-#define NT_S390_CTRS 0x304 /* s390 control registers */
-#define NT_S390_PREFIX 0x305 /* s390 prefix register */
-#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
-#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
-#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
-#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
-#define NT_ARM_TLS 0x401 /* ARM TLS register */
-#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
-#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
-
-/* Legal values for the note segment descriptor types for object files. */
-
-#define NT_VERSION 1 /* Contains a version string. */
-
-
-/* Dynamic section entry. */
-
-typedef struct
-{
- Elf32_Sword d_tag; /* Dynamic entry type */
- union
- {
- Elf32_Word d_val; /* Integer value */
- Elf32_Addr d_ptr; /* Address value */
- } d_un;
-} Elf32_Dyn;
-
-typedef struct
-{
- Elf64_Sxword d_tag; /* Dynamic entry type */
- union
- {
- Elf64_Xword d_val; /* Integer value */
- Elf64_Addr d_ptr; /* Address value */
- } d_un;
-} Elf64_Dyn;
-
-/* Legal values for d_tag (dynamic entry type). */
-
-#define DT_NULL 0 /* Marks end of dynamic section */
-#define DT_NEEDED 1 /* Name of needed library */
-#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */
-#define DT_PLTGOT 3 /* Processor defined value */
-#define DT_HASH 4 /* Address of symbol hash table */
-#define DT_STRTAB 5 /* Address of string table */
-#define DT_SYMTAB 6 /* Address of symbol table */
-#define DT_RELA 7 /* Address of Rela relocs */
-#define DT_RELASZ 8 /* Total size of Rela relocs */
-#define DT_RELAENT 9 /* Size of one Rela reloc */
-#define DT_STRSZ 10 /* Size of string table */
-#define DT_SYMENT 11 /* Size of one symbol table entry */
-#define DT_INIT 12 /* Address of init function */
-#define DT_FINI 13 /* Address of termination function */
-#define DT_SONAME 14 /* Name of shared object */
-#define DT_RPATH 15 /* Library search path (deprecated) */
-#define DT_SYMBOLIC 16 /* Start symbol search here */
-#define DT_REL 17 /* Address of Rel relocs */
-#define DT_RELSZ 18 /* Total size of Rel relocs */
-#define DT_RELENT 19 /* Size of one Rel reloc */
-#define DT_PLTREL 20 /* Type of reloc in PLT */
-#define DT_DEBUG 21 /* For debugging; unspecified */
-#define DT_TEXTREL 22 /* Reloc might modify .text */
-#define DT_JMPREL 23 /* Address of PLT relocs */
-#define DT_BIND_NOW 24 /* Process relocations of object */
-#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */
-#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */
-#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */
-#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */
-#define DT_RUNPATH 29 /* Library search path */
-#define DT_FLAGS 30 /* Flags for the object being loaded */
-#define DT_ENCODING 32 /* Start of encoded range */
-#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
-#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
-#define DT_NUM 34 /* Number used */
-#define DT_LOOS 0x6000000d /* Start of OS-specific */
-#define DT_HIOS 0x6ffff000 /* End of OS-specific */
-#define DT_LOPROC 0x70000000 /* Start of processor-specific */
-#define DT_HIPROC 0x7fffffff /* End of processor-specific */
-#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */
-
-/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
- Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's
- approach. */
-#define DT_VALRNGLO 0x6ffffd00
-#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */
-#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */
-#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */
-#define DT_CHECKSUM 0x6ffffdf8
-#define DT_PLTPADSZ 0x6ffffdf9
-#define DT_MOVEENT 0x6ffffdfa
-#define DT_MOVESZ 0x6ffffdfb
-#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */
-#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting
- the following DT_* entry. */
-#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */
-#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */
-#define DT_VALRNGHI 0x6ffffdff
-#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */
-#define DT_VALNUM 12
-
-/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
- Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
-
- If any adjustment is made to the ELF object after it has been
- built these entries will need to be adjusted. */
-#define DT_ADDRRNGLO 0x6ffffe00
-#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */
-#define DT_TLSDESC_PLT 0x6ffffef6
-#define DT_TLSDESC_GOT 0x6ffffef7
-#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */
-#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */
-#define DT_CONFIG 0x6ffffefa /* Configuration information. */
-#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */
-#define DT_AUDIT 0x6ffffefc /* Object auditing. */
-#define DT_PLTPAD 0x6ffffefd /* PLT padding. */
-#define DT_MOVETAB 0x6ffffefe /* Move table. */
-#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */
-#define DT_ADDRRNGHI 0x6ffffeff
-#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */
-#define DT_ADDRNUM 11
-
-/* The versioning entry types. The next are defined as part of the
- GNU extension. */
-#define DT_VERSYM 0x6ffffff0
-
-#define DT_RELACOUNT 0x6ffffff9
-#define DT_RELCOUNT 0x6ffffffa
-
-/* These were chosen by Sun. */
-#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */
-#define DT_VERDEF 0x6ffffffc /* Address of version definition
- table */
-#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */
-#define DT_VERNEED 0x6ffffffe /* Address of table with needed
- versions */
-#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */
-#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
-#define DT_VERSIONTAGNUM 16
-
-/* Sun added these machine-independent extensions in the "processor-specific"
- range. Be compatible. */
-#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
-#define DT_FILTER 0x7fffffff /* Shared object to get values from */
-#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
-#define DT_EXTRANUM 3
-
-/* Values of `d_un.d_val' in the DT_FLAGS entry. */
-#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */
-#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */
-#define DF_TEXTREL 0x00000004 /* Object contains text relocations */
-#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */
-#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */
-
-/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
- entry in the dynamic section. */
-#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */
-#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */
-#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */
-#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/
-#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/
-#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/
-#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */
-#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */
-#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */
-#define DF_1_TRANS 0x00000200
-#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */
-#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */
-#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */
-#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/
-#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */
-#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */
-#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */
-#define DF_1_NODIRECT 0x00020000 /* Object has no-direct binding. */
-#define DF_1_IGNMULDEF 0x00040000
-#define DF_1_NOKSYMS 0x00080000
-#define DF_1_NOHDR 0x00100000
-#define DF_1_EDITED 0x00200000 /* Object is modified after built. */
-#define DF_1_NORELOC 0x00400000
-#define DF_1_SYMINTPOSE 0x00800000 /* Object has individual interposers. */
-#define DF_1_GLOBAUDIT 0x01000000 /* Global auditing required. */
-#define DF_1_SINGLETON 0x02000000 /* Singleton symbols are used. */
-
-/* Flags for the feature selection in DT_FEATURE_1. */
-#define DTF_1_PARINIT 0x00000001
-#define DTF_1_CONFEXP 0x00000002
-
-/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */
-#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */
-#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not
- generally available. */
-
-/* Version definition sections. */
-
-typedef struct
-{
- Elf32_Half vd_version; /* Version revision */
- Elf32_Half vd_flags; /* Version information */
- Elf32_Half vd_ndx; /* Version Index */
- Elf32_Half vd_cnt; /* Number of associated aux entries */
- Elf32_Word vd_hash; /* Version name hash value */
- Elf32_Word vd_aux; /* Offset in bytes to verdaux array */
- Elf32_Word vd_next; /* Offset in bytes to next verdef
- entry */
-} Elf32_Verdef;
-
-typedef struct
-{
- Elf64_Half vd_version; /* Version revision */
- Elf64_Half vd_flags; /* Version information */
- Elf64_Half vd_ndx; /* Version Index */
- Elf64_Half vd_cnt; /* Number of associated aux entries */
- Elf64_Word vd_hash; /* Version name hash value */
- Elf64_Word vd_aux; /* Offset in bytes to verdaux array */
- Elf64_Word vd_next; /* Offset in bytes to next verdef
- entry */
-} Elf64_Verdef;
-
-
-/* Legal values for vd_version (version revision). */
-#define VER_DEF_NONE 0 /* No version */
-#define VER_DEF_CURRENT 1 /* Current version */
-#define VER_DEF_NUM 2 /* Given version number */
-
-/* Legal values for vd_flags (version information flags). */
-#define VER_FLG_BASE 0x1 /* Version definition of file itself */
-#define VER_FLG_WEAK 0x2 /* Weak version identifier */
-
-/* Versym symbol index values. */
-#define VER_NDX_LOCAL 0 /* Symbol is local. */
-#define VER_NDX_GLOBAL 1 /* Symbol is global. */
-#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */
-#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */
-
-/* Auxialiary version information. */
-
-typedef struct
-{
- Elf32_Word vda_name; /* Version or dependency names */
- Elf32_Word vda_next; /* Offset in bytes to next verdaux
- entry */
-} Elf32_Verdaux;
-
-typedef struct
-{
- Elf64_Word vda_name; /* Version or dependency names */
- Elf64_Word vda_next; /* Offset in bytes to next verdaux
- entry */
-} Elf64_Verdaux;
-
-
-/* Version dependency section. */
-
-typedef struct
-{
- Elf32_Half vn_version; /* Version of structure */
- Elf32_Half vn_cnt; /* Number of associated aux entries */
- Elf32_Word vn_file; /* Offset of filename for this
- dependency */
- Elf32_Word vn_aux; /* Offset in bytes to vernaux array */
- Elf32_Word vn_next; /* Offset in bytes to next verneed
- entry */
-} Elf32_Verneed;
-
-typedef struct
-{
- Elf64_Half vn_version; /* Version of structure */
- Elf64_Half vn_cnt; /* Number of associated aux entries */
- Elf64_Word vn_file; /* Offset of filename for this
- dependency */
- Elf64_Word vn_aux; /* Offset in bytes to vernaux array */
- Elf64_Word vn_next; /* Offset in bytes to next verneed
- entry */
-} Elf64_Verneed;
-
-
-/* Legal values for vn_version (version revision). */
-#define VER_NEED_NONE 0 /* No version */
-#define VER_NEED_CURRENT 1 /* Current version */
-#define VER_NEED_NUM 2 /* Given version number */
-
-/* Auxiliary needed version information. */
-
-typedef struct
-{
- Elf32_Word vna_hash; /* Hash value of dependency name */
- Elf32_Half vna_flags; /* Dependency specific information */
- Elf32_Half vna_other; /* Unused */
- Elf32_Word vna_name; /* Dependency name string offset */
- Elf32_Word vna_next; /* Offset in bytes to next vernaux
- entry */
-} Elf32_Vernaux;
-
-typedef struct
-{
- Elf64_Word vna_hash; /* Hash value of dependency name */
- Elf64_Half vna_flags; /* Dependency specific information */
- Elf64_Half vna_other; /* Unused */
- Elf64_Word vna_name; /* Dependency name string offset */
- Elf64_Word vna_next; /* Offset in bytes to next vernaux
- entry */
-} Elf64_Vernaux;
-
-
-/* Legal values for vna_flags. */
-#define VER_FLG_WEAK 0x2 /* Weak version identifier */
-
-
-/* Auxiliary vector. */
-
-/* This vector is normally only used by the program interpreter. The
- usual definition in an ABI supplement uses the name auxv_t. The
- vector is not usually defined in a standard <elf.h> file, but it
- can't hurt. We rename it to avoid conflicts. The sizes of these
- types are an arrangement between the exec server and the program
- interpreter, so we don't fully specify them here. */
-
-typedef struct
-{
- uint32_t a_type; /* Entry type */
- union
- {
- uint32_t a_val; /* Integer value */
- /* We use to have pointer elements added here. We cannot do that,
- though, since it does not work when using 32-bit definitions
- on 64-bit platforms and vice versa. */
- } a_un;
-} Elf32_auxv_t;
-
-typedef struct
-{
- uint64_t a_type; /* Entry type */
- union
- {
- uint64_t a_val; /* Integer value */
- /* We use to have pointer elements added here. We cannot do that,
- though, since it does not work when using 32-bit definitions
- on 64-bit platforms and vice versa. */
- } a_un;
-} Elf64_auxv_t;
-
-/* Legal values for a_type (entry type). */
-
-#define AT_NULL 0 /* End of vector */
-#define AT_IGNORE 1 /* Entry should be ignored */
-#define AT_EXECFD 2 /* File descriptor of program */
-#define AT_PHDR 3 /* Program headers for program */
-#define AT_PHENT 4 /* Size of program header entry */
-#define AT_PHNUM 5 /* Number of program headers */
-#define AT_PAGESZ 6 /* System page size */
-#define AT_BASE 7 /* Base address of interpreter */
-#define AT_FLAGS 8 /* Flags */
-#define AT_ENTRY 9 /* Entry point of program */
-#define AT_NOTELF 10 /* Program is not ELF */
-#define AT_UID 11 /* Real uid */
-#define AT_EUID 12 /* Effective uid */
-#define AT_GID 13 /* Real gid */
-#define AT_EGID 14 /* Effective gid */
-#define AT_CLKTCK 17 /* Frequency of times() */
-
-/* Some more special a_type values describing the hardware. */
-#define AT_PLATFORM 15 /* String identifying platform. */
-#define AT_HWCAP 16 /* Machine-dependent hints about
- processor capabilities. */
-
-/* This entry gives some information about the FPU initialization
- performed by the kernel. */
-#define AT_FPUCW 18 /* Used FPU control word. */
-
-/* Cache block sizes. */
-#define AT_DCACHEBSIZE 19 /* Data cache block size. */
-#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */
-#define AT_UCACHEBSIZE 21 /* Unified cache block size. */
-
-/* A special ignored value for PPC, used by the kernel to control the
- interpretation of the AUXV. Must be > 16. */
-#define AT_IGNOREPPC 22 /* Entry should be ignored. */
-
-#define AT_SECURE 23 /* Boolean, was exec setuid-like? */
-
-#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/
-
-#define AT_RANDOM 25 /* Address of 16 random bytes. */
-
-#define AT_HWCAP2 26 /* More machine-dependent hints about
- processor capabilities. */
-
-#define AT_EXECFN 31 /* Filename of executable. */
-
-/* Pointer to the global system page used for system calls and other
- nice things. */
-#define AT_SYSINFO 32
-#define AT_SYSINFO_EHDR 33
-
-/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains
- log2 of line size; mask those to get cache size. */
-#define AT_L1I_CACHESHAPE 34
-#define AT_L1D_CACHESHAPE 35
-#define AT_L2_CACHESHAPE 36
-#define AT_L3_CACHESHAPE 37
-
-/* Note section contents. Each entry in the note section begins with
- a header of a fixed form. */
-
-typedef struct
-{
- Elf32_Word n_namesz; /* Length of the note's name. */
- Elf32_Word n_descsz; /* Length of the note's descriptor. */
- Elf32_Word n_type; /* Type of the note. */
-} Elf32_Nhdr;
-
-typedef struct
-{
- Elf64_Word n_namesz; /* Length of the note's name. */
- Elf64_Word n_descsz; /* Length of the note's descriptor. */
- Elf64_Word n_type; /* Type of the note. */
-} Elf64_Nhdr;
-
-/* Known names of notes. */
-
-/* Solaris entries in the note section have this name. */
-#define ELF_NOTE_SOLARIS "SUNW Solaris"
-
-/* Note entries for GNU systems have this name. */
-#define ELF_NOTE_GNU "GNU"
-
-
-/* Defined types of notes for Solaris. */
-
-/* Value of descriptor (one word) is desired pagesize for the binary. */
-#define ELF_NOTE_PAGESIZE_HINT 1
-
-
-/* Defined note types for GNU systems. */
-
-/* ABI information. The descriptor consists of words:
- word 0: OS descriptor
- word 1: major version of the ABI
- word 2: minor version of the ABI
- word 3: subminor version of the ABI
-*/
-#define NT_GNU_ABI_TAG 1
-#define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */
-
-/* Known OSes. These values can appear in word 0 of an
- NT_GNU_ABI_TAG note section entry. */
-#define ELF_NOTE_OS_LINUX 0
-#define ELF_NOTE_OS_GNU 1
-#define ELF_NOTE_OS_SOLARIS2 2
-#define ELF_NOTE_OS_FREEBSD 3
-
-/* Synthetic hwcap information. The descriptor begins with two words:
- word 0: number of entries
- word 1: bitmask of enabled entries
- Then follow variable-length entries, one byte followed by a
- '\0'-terminated hwcap name string. The byte gives the bit
- number to test if enabled, (1U << bit) & bitmask. */
-#define NT_GNU_HWCAP 2
-
-/* Build ID bits as generated by ld --build-id.
- The descriptor consists of any nonzero number of bytes. */
-#define NT_GNU_BUILD_ID 3
-
-/* Version note generated by GNU gold containing a version string. */
-#define NT_GNU_GOLD_VERSION 4
-
-
-/* Move records. */
-typedef struct
-{
- Elf32_Xword m_value; /* Symbol value. */
- Elf32_Word m_info; /* Size and index. */
- Elf32_Word m_poffset; /* Symbol offset. */
- Elf32_Half m_repeat; /* Repeat count. */
- Elf32_Half m_stride; /* Stride info. */
-} Elf32_Move;
-
-typedef struct
-{
- Elf64_Xword m_value; /* Symbol value. */
- Elf64_Xword m_info; /* Size and index. */
- Elf64_Xword m_poffset; /* Symbol offset. */
- Elf64_Half m_repeat; /* Repeat count. */
- Elf64_Half m_stride; /* Stride info. */
-} Elf64_Move;
-
-/* Macro to construct move records. */
-#define ELF32_M_SYM(info) ((info) >> 8)
-#define ELF32_M_SIZE(info) ((unsigned char) (info))
-#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size))
-
-#define ELF64_M_SYM(info) ELF32_M_SYM (info)
-#define ELF64_M_SIZE(info) ELF32_M_SIZE (info)
-#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size)
-
-
-/* Motorola 68k specific definitions. */
-
-/* Values for Elf32_Ehdr.e_flags. */
-#define EF_CPU32 0x00810000
-
-/* m68k relocs. */
-
-#define R_68K_NONE 0 /* No reloc */
-#define R_68K_32 1 /* Direct 32 bit */
-#define R_68K_16 2 /* Direct 16 bit */
-#define R_68K_8 3 /* Direct 8 bit */
-#define R_68K_PC32 4 /* PC relative 32 bit */
-#define R_68K_PC16 5 /* PC relative 16 bit */
-#define R_68K_PC8 6 /* PC relative 8 bit */
-#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */
-#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */
-#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */
-#define R_68K_GOT32O 10 /* 32 bit GOT offset */
-#define R_68K_GOT16O 11 /* 16 bit GOT offset */
-#define R_68K_GOT8O 12 /* 8 bit GOT offset */
-#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */
-#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */
-#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */
-#define R_68K_PLT32O 16 /* 32 bit PLT offset */
-#define R_68K_PLT16O 17 /* 16 bit PLT offset */
-#define R_68K_PLT8O 18 /* 8 bit PLT offset */
-#define R_68K_COPY 19 /* Copy symbol at runtime */
-#define R_68K_GLOB_DAT 20 /* Create GOT entry */
-#define R_68K_JMP_SLOT 21 /* Create PLT entry */
-#define R_68K_RELATIVE 22 /* Adjust by program base */
-#define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */
-#define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */
-#define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */
-#define R_68K_TLS_LDM32 28 /* 32 bit GOT offset for LDM */
-#define R_68K_TLS_LDM16 29 /* 16 bit GOT offset for LDM */
-#define R_68K_TLS_LDM8 30 /* 8 bit GOT offset for LDM */
-#define R_68K_TLS_LDO32 31 /* 32 bit module-relative offset */
-#define R_68K_TLS_LDO16 32 /* 16 bit module-relative offset */
-#define R_68K_TLS_LDO8 33 /* 8 bit module-relative offset */
-#define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */
-#define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */
-#define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */
-#define R_68K_TLS_LE32 37 /* 32 bit offset relative to
- static TLS block */
-#define R_68K_TLS_LE16 38 /* 16 bit offset relative to
- static TLS block */
-#define R_68K_TLS_LE8 39 /* 8 bit offset relative to
- static TLS block */
-#define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */
-#define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */
-#define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */
-/* Keep this the last entry. */
-#define R_68K_NUM 43
-
-/* Intel 80386 specific definitions. */
-
-/* i386 relocs. */
-
-#define R_386_NONE 0 /* No reloc */
-#define R_386_32 1 /* Direct 32 bit */
-#define R_386_PC32 2 /* PC relative 32 bit */
-#define R_386_GOT32 3 /* 32 bit GOT entry */
-#define R_386_PLT32 4 /* 32 bit PLT address */
-#define R_386_COPY 5 /* Copy symbol at runtime */
-#define R_386_GLOB_DAT 6 /* Create GOT entry */
-#define R_386_JMP_SLOT 7 /* Create PLT entry */
-#define R_386_RELATIVE 8 /* Adjust by program base */
-#define R_386_GOTOFF 9 /* 32 bit offset to GOT */
-#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */
-#define R_386_32PLT 11
-#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */
-#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS
- block offset */
-#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block
- offset */
-#define R_386_TLS_LE 17 /* Offset relative to static TLS
- block */
-#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of
- general dynamic thread local data */
-#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of
- local dynamic thread local data
- in LE code */
-#define R_386_16 20
-#define R_386_PC16 21
-#define R_386_8 22
-#define R_386_PC8 23
-#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic
- thread local data */
-#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */
-#define R_386_TLS_GD_CALL 26 /* Relocation for call to
- __tls_get_addr() */
-#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */
-#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic
- thread local data in LE code */
-#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */
-#define R_386_TLS_LDM_CALL 30 /* Relocation for call to
- __tls_get_addr() in LDM code */
-#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */
-#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */
-#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS
- block offset */
-#define R_386_TLS_LE_32 34 /* Negated offset relative to static
- TLS block */
-#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */
-#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */
-#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */
-#define R_386_SIZE32 38 /* 32-bit symbol size */
-#define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */
-#define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS
- descriptor for
- relaxation. */
-#define R_386_TLS_DESC 41 /* TLS descriptor containing
- pointer to code and to
- argument, returning the TLS
- offset for the symbol. */
-#define R_386_IRELATIVE 42 /* Adjust indirectly by program base */
-/* Keep this the last entry. */
-#define R_386_NUM 43
-
-/* SUN SPARC specific definitions. */
-
-/* Legal values for ST_TYPE subfield of st_info (symbol type). */
-
-#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */
-
-/* Values for Elf64_Ehdr.e_flags. */
-
-#define EF_SPARCV9_MM 3
-#define EF_SPARCV9_TSO 0
-#define EF_SPARCV9_PSO 1
-#define EF_SPARCV9_RMO 2
-#define EF_SPARC_LEDATA 0x800000 /* little endian data */
-#define EF_SPARC_EXT_MASK 0xFFFF00
-#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */
-#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */
-#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */
-#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */
-
-/* SPARC relocs. */
-
-#define R_SPARC_NONE 0 /* No reloc */
-#define R_SPARC_8 1 /* Direct 8 bit */
-#define R_SPARC_16 2 /* Direct 16 bit */
-#define R_SPARC_32 3 /* Direct 32 bit */
-#define R_SPARC_DISP8 4 /* PC relative 8 bit */
-#define R_SPARC_DISP16 5 /* PC relative 16 bit */
-#define R_SPARC_DISP32 6 /* PC relative 32 bit */
-#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */
-#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */
-#define R_SPARC_HI22 9 /* High 22 bit */
-#define R_SPARC_22 10 /* Direct 22 bit */
-#define R_SPARC_13 11 /* Direct 13 bit */
-#define R_SPARC_LO10 12 /* Truncated 10 bit */
-#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */
-#define R_SPARC_GOT13 14 /* 13 bit GOT entry */
-#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */
-#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */
-#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */
-#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */
-#define R_SPARC_COPY 19 /* Copy symbol at runtime */
-#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */
-#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */
-#define R_SPARC_RELATIVE 22 /* Adjust by program base */
-#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */
-
-/* Additional Sparc64 relocs. */
-
-#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */
-#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */
-#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */
-#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */
-#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */
-#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */
-#define R_SPARC_10 30 /* Direct 10 bit */
-#define R_SPARC_11 31 /* Direct 11 bit */
-#define R_SPARC_64 32 /* Direct 64 bit */
-#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */
-#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */
-#define R_SPARC_HM10 35 /* High middle 10 bits of ... */
-#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */
-#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */
-#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */
-#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */
-#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */
-#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */
-#define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */
-#define R_SPARC_7 43 /* Direct 7 bit */
-#define R_SPARC_5 44 /* Direct 5 bit */
-#define R_SPARC_6 45 /* Direct 6 bit */
-#define R_SPARC_DISP64 46 /* PC relative 64 bit */
-#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */
-#define R_SPARC_HIX22 48 /* High 22 bit complemented */
-#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */
-#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */
-#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */
-#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */
-#define R_SPARC_REGISTER 53 /* Global register usage */
-#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */
-#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */
-#define R_SPARC_TLS_GD_HI22 56
-#define R_SPARC_TLS_GD_LO10 57
-#define R_SPARC_TLS_GD_ADD 58
-#define R_SPARC_TLS_GD_CALL 59
-#define R_SPARC_TLS_LDM_HI22 60
-#define R_SPARC_TLS_LDM_LO10 61
-#define R_SPARC_TLS_LDM_ADD 62
-#define R_SPARC_TLS_LDM_CALL 63
-#define R_SPARC_TLS_LDO_HIX22 64
-#define R_SPARC_TLS_LDO_LOX10 65
-#define R_SPARC_TLS_LDO_ADD 66
-#define R_SPARC_TLS_IE_HI22 67
-#define R_SPARC_TLS_IE_LO10 68
-#define R_SPARC_TLS_IE_LD 69
-#define R_SPARC_TLS_IE_LDX 70
-#define R_SPARC_TLS_IE_ADD 71
-#define R_SPARC_TLS_LE_HIX22 72
-#define R_SPARC_TLS_LE_LOX10 73
-#define R_SPARC_TLS_DTPMOD32 74
-#define R_SPARC_TLS_DTPMOD64 75
-#define R_SPARC_TLS_DTPOFF32 76
-#define R_SPARC_TLS_DTPOFF64 77
-#define R_SPARC_TLS_TPOFF32 78
-#define R_SPARC_TLS_TPOFF64 79
-#define R_SPARC_GOTDATA_HIX22 80
-#define R_SPARC_GOTDATA_LOX10 81
-#define R_SPARC_GOTDATA_OP_HIX22 82
-#define R_SPARC_GOTDATA_OP_LOX10 83
-#define R_SPARC_GOTDATA_OP 84
-#define R_SPARC_H34 85
-#define R_SPARC_SIZE32 86
-#define R_SPARC_SIZE64 87
-#define R_SPARC_WDISP10 88
-#define R_SPARC_JMP_IREL 248
-#define R_SPARC_IRELATIVE 249
-#define R_SPARC_GNU_VTINHERIT 250
-#define R_SPARC_GNU_VTENTRY 251
-#define R_SPARC_REV32 252
-/* Keep this the last entry. */
-#define R_SPARC_NUM 253
-
-/* For Sparc64, legal values for d_tag of Elf64_Dyn. */
-
-#define DT_SPARC_REGISTER 0x70000001
-#define DT_SPARC_NUM 2
-
-/* MIPS R3000 specific definitions. */
-
-/* Legal values for e_flags field of Elf32_Ehdr. */
-
-#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used. */
-#define EF_MIPS_PIC 2 /* Contains PIC code. */
-#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence. */
-#define EF_MIPS_XGOT 8
-#define EF_MIPS_64BIT_WHIRL 16
-#define EF_MIPS_ABI2 32
-#define EF_MIPS_ABI_ON32 64
-#define EF_MIPS_FP64 512 /* Uses FP64 (12 callee-saved). */
-#define EF_MIPS_NAN2008 1024 /* Uses IEEE 754-2008 NaN encoding. */
-#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level. */
-
-/* Legal values for MIPS architecture level. */
-
-#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
-#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
-#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
-#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
-#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
-#define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */
-#define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */
-#define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32r2 code. */
-#define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64r2 code. */
-
-/* The following are unofficial names and should not be used. */
-
-#define E_MIPS_ARCH_1 EF_MIPS_ARCH_1
-#define E_MIPS_ARCH_2 EF_MIPS_ARCH_2
-#define E_MIPS_ARCH_3 EF_MIPS_ARCH_3
-#define E_MIPS_ARCH_4 EF_MIPS_ARCH_4
-#define E_MIPS_ARCH_5 EF_MIPS_ARCH_5
-#define E_MIPS_ARCH_32 EF_MIPS_ARCH_32
-#define E_MIPS_ARCH_64 EF_MIPS_ARCH_64
-
-/* Special section indices. */
-
-#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols. */
-#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
-#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
-#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols. */
-#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols. */
-
-/* Legal values for sh_type field of Elf32_Shdr. */
-
-#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link. */
-#define SHT_MIPS_MSYM 0x70000001
-#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols. */
-#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes. */
-#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
-#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging info. */
-#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information. */
-#define SHT_MIPS_PACKAGE 0x70000007
-#define SHT_MIPS_PACKSYM 0x70000008
-#define SHT_MIPS_RELD 0x70000009
-#define SHT_MIPS_IFACE 0x7000000b
-#define SHT_MIPS_CONTENT 0x7000000c
-#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */
-#define SHT_MIPS_SHDR 0x70000010
-#define SHT_MIPS_FDESC 0x70000011
-#define SHT_MIPS_EXTSYM 0x70000012
-#define SHT_MIPS_DENSE 0x70000013
-#define SHT_MIPS_PDESC 0x70000014
-#define SHT_MIPS_LOCSYM 0x70000015
-#define SHT_MIPS_AUXSYM 0x70000016
-#define SHT_MIPS_OPTSYM 0x70000017
-#define SHT_MIPS_LOCSTR 0x70000018
-#define SHT_MIPS_LINE 0x70000019
-#define SHT_MIPS_RFDESC 0x7000001a
-#define SHT_MIPS_DELTASYM 0x7000001b
-#define SHT_MIPS_DELTAINST 0x7000001c
-#define SHT_MIPS_DELTACLASS 0x7000001d
-#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */
-#define SHT_MIPS_DELTADECL 0x7000001f
-#define SHT_MIPS_SYMBOL_LIB 0x70000020
-#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */
-#define SHT_MIPS_TRANSLATE 0x70000022
-#define SHT_MIPS_PIXIE 0x70000023
-#define SHT_MIPS_XLATE 0x70000024
-#define SHT_MIPS_XLATE_DEBUG 0x70000025
-#define SHT_MIPS_WHIRL 0x70000026
-#define SHT_MIPS_EH_REGION 0x70000027
-#define SHT_MIPS_XLATE_OLD 0x70000028
-#define SHT_MIPS_PDR_EXCEPTION 0x70000029
-
-/* Legal values for sh_flags field of Elf32_Shdr. */
-
-#define SHF_MIPS_GPREL 0x10000000 /* Must be in global data area. */
-#define SHF_MIPS_MERGE 0x20000000
-#define SHF_MIPS_ADDR 0x40000000
-#define SHF_MIPS_STRINGS 0x80000000
-#define SHF_MIPS_NOSTRIP 0x08000000
-#define SHF_MIPS_LOCAL 0x04000000
-#define SHF_MIPS_NAMES 0x02000000
-#define SHF_MIPS_NODUPE 0x01000000
-
-
-/* Symbol tables. */
-
-/* MIPS specific values for `st_other'. */
-#define STO_MIPS_DEFAULT 0x0
-#define STO_MIPS_INTERNAL 0x1
-#define STO_MIPS_HIDDEN 0x2
-#define STO_MIPS_PROTECTED 0x3
-#define STO_MIPS_PLT 0x8
-#define STO_MIPS_SC_ALIGN_UNUSED 0xff
-
-/* MIPS specific values for `st_info'. */
-#define STB_MIPS_SPLIT_COMMON 13
-
-/* Entries found in sections of type SHT_MIPS_GPTAB. */
-
-typedef union
-{
- struct
- {
- Elf32_Word gt_current_g_value; /* -G value used for compilation. */
- Elf32_Word gt_unused; /* Not used. */
- } gt_header; /* First entry in section. */
- struct
- {
- Elf32_Word gt_g_value; /* If this value were used for -G. */
- Elf32_Word gt_bytes; /* This many bytes would be used. */
- } gt_entry; /* Subsequent entries in section. */
-} Elf32_gptab;
-
-/* Entry found in sections of type SHT_MIPS_REGINFO. */
-
-typedef struct
-{
- Elf32_Word ri_gprmask; /* General registers used. */
- Elf32_Word ri_cprmask[4]; /* Coprocessor registers used. */
- Elf32_Sword ri_gp_value; /* $gp register value. */
-} Elf32_RegInfo;
-
-/* Entries found in sections of type SHT_MIPS_OPTIONS. */
-
-typedef struct
-{
- unsigned char kind; /* Determines interpretation of the
- variable part of descriptor. */
- unsigned char size; /* Size of descriptor, including header. */
- Elf32_Section section; /* Section header index of section affected,
- 0 for global options. */
- Elf32_Word info; /* Kind-specific information. */
-} Elf_Options;
-
-/* Values for `kind' field in Elf_Options. */
-
-#define ODK_NULL 0 /* Undefined. */
-#define ODK_REGINFO 1 /* Register usage information. */
-#define ODK_EXCEPTIONS 2 /* Exception processing options. */
-#define ODK_PAD 3 /* Section padding options. */
-#define ODK_HWPATCH 4 /* Hardware workarounds performed */
-#define ODK_FILL 5 /* record the fill value used by the linker. */
-#define ODK_TAGS 6 /* reserve space for desktop tools to write. */
-#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */
-#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */
-
-/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */
-
-#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */
-#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */
-#define OEX_PAGE0 0x10000 /* page zero must be mapped. */
-#define OEX_SMM 0x20000 /* Force sequential memory mode? */
-#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */
-#define OEX_PRECISEFP OEX_FPDBUG
-#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */
-
-#define OEX_FPU_INVAL 0x10
-#define OEX_FPU_DIV0 0x08
-#define OEX_FPU_OFLO 0x04
-#define OEX_FPU_UFLO 0x02
-#define OEX_FPU_INEX 0x01
-
-/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */
-
-#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */
-#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */
-#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */
-#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */
-
-#define OPAD_PREFIX 0x1
-#define OPAD_POSTFIX 0x2
-#define OPAD_SYMBOL 0x4
-
-/* Entry found in `.options' section. */
-
-typedef struct
-{
- Elf32_Word hwp_flags1; /* Extra flags. */
- Elf32_Word hwp_flags2; /* Extra flags. */
-} Elf_Options_Hw;
-
-/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */
-
-#define OHWA0_R4KEOP_CHECKED 0x00000001
-#define OHWA1_R4KEOP_CLEAN 0x00000002
-
-/* MIPS relocs. */
-
-#define R_MIPS_NONE 0 /* No reloc */
-#define R_MIPS_16 1 /* Direct 16 bit */
-#define R_MIPS_32 2 /* Direct 32 bit */
-#define R_MIPS_REL32 3 /* PC relative 32 bit */
-#define R_MIPS_26 4 /* Direct 26 bit shifted */
-#define R_MIPS_HI16 5 /* High 16 bit */
-#define R_MIPS_LO16 6 /* Low 16 bit */
-#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
-#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
-#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
-#define R_MIPS_PC16 10 /* PC relative 16 bit */
-#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
-#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
-
-#define R_MIPS_SHIFT5 16
-#define R_MIPS_SHIFT6 17
-#define R_MIPS_64 18
-#define R_MIPS_GOT_DISP 19
-#define R_MIPS_GOT_PAGE 20
-#define R_MIPS_GOT_OFST 21
-#define R_MIPS_GOT_HI16 22
-#define R_MIPS_GOT_LO16 23
-#define R_MIPS_SUB 24
-#define R_MIPS_INSERT_A 25
-#define R_MIPS_INSERT_B 26
-#define R_MIPS_DELETE 27
-#define R_MIPS_HIGHER 28
-#define R_MIPS_HIGHEST 29
-#define R_MIPS_CALL_HI16 30
-#define R_MIPS_CALL_LO16 31
-#define R_MIPS_SCN_DISP 32
-#define R_MIPS_REL16 33
-#define R_MIPS_ADD_IMMEDIATE 34
-#define R_MIPS_PJUMP 35
-#define R_MIPS_RELGOT 36
-#define R_MIPS_JALR 37
-#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */
-#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */
-#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */
-#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */
-#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */
-#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */
-#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */
-#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */
-#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */
-#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */
-#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */
-#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */
-#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */
-#define R_MIPS_GLOB_DAT 51
-#define R_MIPS_COPY 126
-#define R_MIPS_JUMP_SLOT 127
-/* Keep this the last entry. */
-#define R_MIPS_NUM 128
-
-/* Legal values for p_type field of Elf32_Phdr. */
-
-#define PT_MIPS_REGINFO 0x70000000 /* Register usage information. */
-#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */
-#define PT_MIPS_OPTIONS 0x70000002
-#define PT_MIPS_ABIFLAGS 0x70000003 /* FP mode requirement. */
-
-/* Special program header types. */
-
-#define PF_MIPS_LOCAL 0x10000000
-
-/* Legal values for d_tag field of Elf32_Dyn. */
-
-#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */
-#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
-#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */
-#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
-#define DT_MIPS_FLAGS 0x70000005 /* Flags */
-#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */
-#define DT_MIPS_MSYM 0x70000007
-#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */
-#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */
-#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */
-#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */
-#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */
-#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */
-#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
-#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */
-#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
-#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */
-#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */
-#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in
- DT_MIPS_DELTA_CLASS. */
-#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */
-#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in
- DT_MIPS_DELTA_INSTANCE. */
-#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */
-#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in
- DT_MIPS_DELTA_RELOC. */
-#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta
- relocations refer to. */
-#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in
- DT_MIPS_DELTA_SYM. */
-#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the
- class declaration. */
-#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in
- DT_MIPS_DELTA_CLASSSYM. */
-#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */
-#define DT_MIPS_PIXIE_INIT 0x70000023
-#define DT_MIPS_SYMBOL_LIB 0x70000024
-#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
-#define DT_MIPS_LOCAL_GOTIDX 0x70000026
-#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
-#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
-#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */
-#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */
-#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
-#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */
-#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve
- function stored in GOT. */
-#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added
- by rld on dlopen() calls. */
-#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */
-#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */
-#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */
-/* The address of .got.plt in an executable using the new non-PIC ABI. */
-#define DT_MIPS_PLTGOT 0x70000032
-/* The base of the PLT in an executable using the new non-PIC ABI if that
- PLT is writable. For a non-writable PLT, this is omitted or has a zero
- value. */
-#define DT_MIPS_RWPLT 0x70000034
-/* An alternative description of the classic MIPS RLD_MAP that is usable
- in a PIE as it stores a relative offset from the address of the tag
- rather than an absolute address. */
-#define DT_MIPS_RLD_MAP_REL 0x70000035
-#define DT_MIPS_NUM 0x36
-
-/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */
-
-#define RHF_NONE 0 /* No flags */
-#define RHF_QUICKSTART (1 << 0) /* Use quickstart */
-#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */
-#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */
-#define RHF_NO_MOVE (1 << 3)
-#define RHF_SGI_ONLY (1 << 4)
-#define RHF_GUARANTEE_INIT (1 << 5)
-#define RHF_DELTA_C_PLUS_PLUS (1 << 6)
-#define RHF_GUARANTEE_START_INIT (1 << 7)
-#define RHF_PIXIE (1 << 8)
-#define RHF_DEFAULT_DELAY_LOAD (1 << 9)
-#define RHF_REQUICKSTART (1 << 10)
-#define RHF_REQUICKSTARTED (1 << 11)
-#define RHF_CORD (1 << 12)
-#define RHF_NO_UNRES_UNDEF (1 << 13)
-#define RHF_RLD_ORDER_SAFE (1 << 14)
-
-/* Entries found in sections of type SHT_MIPS_LIBLIST. */
-
-typedef struct
-{
- Elf32_Word l_name; /* Name (string table index) */
- Elf32_Word l_time_stamp; /* Timestamp */
- Elf32_Word l_checksum; /* Checksum */
- Elf32_Word l_version; /* Interface version */
- Elf32_Word l_flags; /* Flags */
-} Elf32_Lib;
-
-typedef struct
-{
- Elf64_Word l_name; /* Name (string table index) */
- Elf64_Word l_time_stamp; /* Timestamp */
- Elf64_Word l_checksum; /* Checksum */
- Elf64_Word l_version; /* Interface version */
- Elf64_Word l_flags; /* Flags */
-} Elf64_Lib;
-
-
-/* Legal values for l_flags. */
-
-#define LL_NONE 0
-#define LL_EXACT_MATCH (1 << 0) /* Require exact match */
-#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */
-#define LL_REQUIRE_MINOR (1 << 2)
-#define LL_EXPORTS (1 << 3)
-#define LL_DELAY_LOAD (1 << 4)
-#define LL_DELTA (1 << 5)
-
-/* Entries found in sections of type SHT_MIPS_CONFLICT. */
-
-typedef Elf32_Addr Elf32_Conflict;
-
-typedef struct
-{
- /* Version of flags structure. */
- Elf32_Half version;
- /* The level of the ISA: 1-5, 32, 64. */
- unsigned char isa_level;
- /* The revision of ISA: 0 for MIPS V and below, 1-n otherwise. */
- unsigned char isa_rev;
- /* The size of general purpose registers. */
- unsigned char gpr_size;
- /* The size of co-processor 1 registers. */
- unsigned char cpr1_size;
- /* The size of co-processor 2 registers. */
- unsigned char cpr2_size;
- /* The floating-point ABI. */
- unsigned char fp_abi;
- /* Processor-specific extension. */
- Elf32_Word isa_ext;
- /* Mask of ASEs used. */
- Elf32_Word ases;
- /* Mask of general flags. */
- Elf32_Word flags1;
- Elf32_Word flags2;
-} Elf_MIPS_ABIFlags_v0;
-
-/* Values for the register size bytes of an abi flags structure. */
-
-#define MIPS_AFL_REG_NONE 0x00 /* No registers. */
-#define MIPS_AFL_REG_32 0x01 /* 32-bit registers. */
-#define MIPS_AFL_REG_64 0x02 /* 64-bit registers. */
-#define MIPS_AFL_REG_128 0x03 /* 128-bit registers. */
-
-/* Masks for the ases word of an ABI flags structure. */
-
-#define MIPS_AFL_ASE_DSP 0x00000001 /* DSP ASE. */
-#define MIPS_AFL_ASE_DSPR2 0x00000002 /* DSP R2 ASE. */
-#define MIPS_AFL_ASE_EVA 0x00000004 /* Enhanced VA Scheme. */
-#define MIPS_AFL_ASE_MCU 0x00000008 /* MCU (MicroController) ASE. */
-#define MIPS_AFL_ASE_MDMX 0x00000010 /* MDMX ASE. */
-#define MIPS_AFL_ASE_MIPS3D 0x00000020 /* MIPS-3D ASE. */
-#define MIPS_AFL_ASE_MT 0x00000040 /* MT ASE. */
-#define MIPS_AFL_ASE_SMARTMIPS 0x00000080 /* SmartMIPS ASE. */
-#define MIPS_AFL_ASE_VIRT 0x00000100 /* VZ ASE. */
-#define MIPS_AFL_ASE_MSA 0x00000200 /* MSA ASE. */
-#define MIPS_AFL_ASE_MIPS16 0x00000400 /* MIPS16 ASE. */
-#define MIPS_AFL_ASE_MICROMIPS 0x00000800 /* MICROMIPS ASE. */
-#define MIPS_AFL_ASE_XPA 0x00001000 /* XPA ASE. */
-#define MIPS_AFL_ASE_MASK 0x00001fff /* All ASEs. */
-
-/* Values for the isa_ext word of an ABI flags structure. */
-
-#define MIPS_AFL_EXT_XLR 1 /* RMI Xlr instruction. */
-#define MIPS_AFL_EXT_OCTEON2 2 /* Cavium Networks Octeon2. */
-#define MIPS_AFL_EXT_OCTEONP 3 /* Cavium Networks OcteonP. */
-#define MIPS_AFL_EXT_LOONGSON_3A 4 /* Loongson 3A. */
-#define MIPS_AFL_EXT_OCTEON 5 /* Cavium Networks Octeon. */
-#define MIPS_AFL_EXT_5900 6 /* MIPS R5900 instruction. */
-#define MIPS_AFL_EXT_4650 7 /* MIPS R4650 instruction. */
-#define MIPS_AFL_EXT_4010 8 /* LSI R4010 instruction. */
-#define MIPS_AFL_EXT_4100 9 /* NEC VR4100 instruction. */
-#define MIPS_AFL_EXT_3900 10 /* Toshiba R3900 instruction. */
-#define MIPS_AFL_EXT_10000 11 /* MIPS R10000 instruction. */
-#define MIPS_AFL_EXT_SB1 12 /* Broadcom SB-1 instruction. */
-#define MIPS_AFL_EXT_4111 13 /* NEC VR4111/VR4181 instruction. */
-#define MIPS_AFL_EXT_4120 14 /* NEC VR4120 instruction. */
-#define MIPS_AFL_EXT_5400 15 /* NEC VR5400 instruction. */
-#define MIPS_AFL_EXT_5500 16 /* NEC VR5500 instruction. */
-#define MIPS_AFL_EXT_LOONGSON_2E 17 /* ST Microelectronics Loongson 2E. */
-#define MIPS_AFL_EXT_LOONGSON_2F 18 /* ST Microelectronics Loongson 2F. */
-
-/* Masks for the flags1 word of an ABI flags structure. */
-#define MIPS_AFL_FLAGS1_ODDSPREG 1 /* Uses odd single-precision registers. */
-
-/* Object attribute values. */
-enum
-{
- /* Not tagged or not using any ABIs affected by the differences. */
- Val_GNU_MIPS_ABI_FP_ANY = 0,
- /* Using hard-float -mdouble-float. */
- Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
- /* Using hard-float -msingle-float. */
- Val_GNU_MIPS_ABI_FP_SINGLE = 2,
- /* Using soft-float. */
- Val_GNU_MIPS_ABI_FP_SOFT = 3,
- /* Using -mips32r2 -mfp64. */
- Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
- /* Using -mfpxx. */
- Val_GNU_MIPS_ABI_FP_XX = 5,
- /* Using -mips32r2 -mfp64. */
- Val_GNU_MIPS_ABI_FP_64 = 6,
- /* Using -mips32r2 -mfp64 -mno-odd-spreg. */
- Val_GNU_MIPS_ABI_FP_64A = 7,
- /* Maximum allocated FP ABI value. */
- Val_GNU_MIPS_ABI_FP_MAX = 7
-};
-
-/* HPPA specific definitions. */
-
-/* Legal values for e_flags field of Elf32_Ehdr. */
-
-#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */
-#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */
-#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */
-#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */
-#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch
- prediction. */
-#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */
-#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */
-
-/* Defined values for `e_flags & EF_PARISC_ARCH' are: */
-
-#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */
-#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */
-#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */
-
-/* Additional section indeces. */
-
-#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared
- symbols in ANSI C. */
-#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */
-
-/* Legal values for sh_type field of Elf32_Shdr. */
-
-#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */
-#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */
-#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */
-
-/* Legal values for sh_flags field of Elf32_Shdr. */
-
-#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */
-#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */
-#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */
-
-/* Legal values for ST_TYPE subfield of st_info (symbol type). */
-
-#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */
-
-#define STT_HP_OPAQUE (STT_LOOS + 0x1)
-#define STT_HP_STUB (STT_LOOS + 0x2)
-
-/* HPPA relocs. */
-
-#define R_PARISC_NONE 0 /* No reloc. */
-#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */
-#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */
-#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */
-#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */
-#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */
-#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */
-#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */
-#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */
-#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */
-#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */
-#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */
-#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */
-#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */
-#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */
-#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */
-#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */
-#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */
-#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */
-#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */
-#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */
-#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */
-#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */
-#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */
-#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */
-#define R_PARISC_FPTR64 64 /* 64 bits function address. */
-#define R_PARISC_PLABEL32 65 /* 32 bits function address. */
-#define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */
-#define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */
-#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */
-#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */
-#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */
-#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */
-#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */
-#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */
-#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */
-#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */
-#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */
-#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */
-#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */
-#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */
-#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */
-#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */
-#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */
-#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */
-#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */
-#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */
-#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */
-#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */
-#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */
-#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */
-#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */
-#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */
-#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */
-#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */
-#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */
-#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */
-#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */
-#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */
-#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */
-#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */
-#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */
-#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */
-#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */
-#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */
-#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */
-#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */
-#define R_PARISC_LORESERVE 128
-#define R_PARISC_COPY 128 /* Copy relocation. */
-#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */
-#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */
-#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */
-#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */
-#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */
-#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */
-#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/
-#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */
-#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */
-#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */
-#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */
-#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */
-#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */
-#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */
-#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */
-#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/
-#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/
-#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */
-#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */
-#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */
-#define R_PARISC_GNU_VTENTRY 232
-#define R_PARISC_GNU_VTINHERIT 233
-#define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */
-#define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */
-#define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */
-#define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */
-#define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */
-#define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */
-#define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */
-#define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */
-#define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */
-#define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */
-#define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */
-#define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */
-#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L
-#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R
-#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L
-#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R
-#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32
-#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64
-#define R_PARISC_HIRESERVE 255
-
-/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */
-
-#define PT_HP_TLS (PT_LOOS + 0x0)
-#define PT_HP_CORE_NONE (PT_LOOS + 0x1)
-#define PT_HP_CORE_VERSION (PT_LOOS + 0x2)
-#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3)
-#define PT_HP_CORE_COMM (PT_LOOS + 0x4)
-#define PT_HP_CORE_PROC (PT_LOOS + 0x5)
-#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6)
-#define PT_HP_CORE_STACK (PT_LOOS + 0x7)
-#define PT_HP_CORE_SHM (PT_LOOS + 0x8)
-#define PT_HP_CORE_MMF (PT_LOOS + 0x9)
-#define PT_HP_PARALLEL (PT_LOOS + 0x10)
-#define PT_HP_FASTBIND (PT_LOOS + 0x11)
-#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12)
-#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13)
-#define PT_HP_STACK (PT_LOOS + 0x14)
-
-#define PT_PARISC_ARCHEXT 0x70000000
-#define PT_PARISC_UNWIND 0x70000001
-
-/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */
-
-#define PF_PARISC_SBP 0x08000000
-
-#define PF_HP_PAGE_SIZE 0x00100000
-#define PF_HP_FAR_SHARED 0x00200000
-#define PF_HP_NEAR_SHARED 0x00400000
-#define PF_HP_CODE 0x01000000
-#define PF_HP_MODIFY 0x02000000
-#define PF_HP_LAZYSWAP 0x04000000
-#define PF_HP_SBP 0x08000000
-
-
-/* Alpha specific definitions. */
-
-/* Legal values for e_flags field of Elf64_Ehdr. */
-
-#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */
-#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */
-
-/* Legal values for sh_type field of Elf64_Shdr. */
-
-/* These two are primerily concerned with ECOFF debugging info. */
-#define SHT_ALPHA_DEBUG 0x70000001
-#define SHT_ALPHA_REGINFO 0x70000002
-
-/* Legal values for sh_flags field of Elf64_Shdr. */
-
-#define SHF_ALPHA_GPREL 0x10000000
-
-/* Legal values for st_other field of Elf64_Sym. */
-#define STO_ALPHA_NOPV 0x80 /* No PV required. */
-#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */
-
-/* Alpha relocs. */
-
-#define R_ALPHA_NONE 0 /* No reloc */
-#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
-#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
-#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
-#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
-#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
-#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
-#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
-#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
-#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
-#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
-#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
-#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */
-#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */
-#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */
-#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
-#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
-#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
-#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
-#define R_ALPHA_TLS_GD_HI 28
-#define R_ALPHA_TLSGD 29
-#define R_ALPHA_TLS_LDM 30
-#define R_ALPHA_DTPMOD64 31
-#define R_ALPHA_GOTDTPREL 32
-#define R_ALPHA_DTPREL64 33
-#define R_ALPHA_DTPRELHI 34
-#define R_ALPHA_DTPRELLO 35
-#define R_ALPHA_DTPREL16 36
-#define R_ALPHA_GOTTPREL 37
-#define R_ALPHA_TPREL64 38
-#define R_ALPHA_TPRELHI 39
-#define R_ALPHA_TPRELLO 40
-#define R_ALPHA_TPREL16 41
-/* Keep this the last entry. */
-#define R_ALPHA_NUM 46
-
-/* Magic values of the LITUSE relocation addend. */
-#define LITUSE_ALPHA_ADDR 0
-#define LITUSE_ALPHA_BASE 1
-#define LITUSE_ALPHA_BYTOFF 2
-#define LITUSE_ALPHA_JSR 3
-#define LITUSE_ALPHA_TLS_GD 4
-#define LITUSE_ALPHA_TLS_LDM 5
-
-/* Legal values for d_tag of Elf64_Dyn. */
-#define DT_ALPHA_PLTRO (DT_LOPROC + 0)
-#define DT_ALPHA_NUM 1
-
-/* PowerPC specific declarations */
-
-/* Values for Elf32/64_Ehdr.e_flags. */
-#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
-
-/* Cygnus local bits below */
-#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
-#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib
- flag */
-
-/* PowerPC relocations defined by the ABIs */
-#define R_PPC_NONE 0
-#define R_PPC_ADDR32 1 /* 32bit absolute address */
-#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
-#define R_PPC_ADDR16 3 /* 16bit absolute address */
-#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
-#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
-#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
-#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
-#define R_PPC_ADDR14_BRTAKEN 8
-#define R_PPC_ADDR14_BRNTAKEN 9
-#define R_PPC_REL24 10 /* PC relative 26 bit */
-#define R_PPC_REL14 11 /* PC relative 16 bit */
-#define R_PPC_REL14_BRTAKEN 12
-#define R_PPC_REL14_BRNTAKEN 13
-#define R_PPC_GOT16 14
-#define R_PPC_GOT16_LO 15
-#define R_PPC_GOT16_HI 16
-#define R_PPC_GOT16_HA 17
-#define R_PPC_PLTREL24 18
-#define R_PPC_COPY 19
-#define R_PPC_GLOB_DAT 20
-#define R_PPC_JMP_SLOT 21
-#define R_PPC_RELATIVE 22
-#define R_PPC_LOCAL24PC 23
-#define R_PPC_UADDR32 24
-#define R_PPC_UADDR16 25
-#define R_PPC_REL32 26
-#define R_PPC_PLT32 27
-#define R_PPC_PLTREL32 28
-#define R_PPC_PLT16_LO 29
-#define R_PPC_PLT16_HI 30
-#define R_PPC_PLT16_HA 31
-#define R_PPC_SDAREL16 32
-#define R_PPC_SECTOFF 33
-#define R_PPC_SECTOFF_LO 34
-#define R_PPC_SECTOFF_HI 35
-#define R_PPC_SECTOFF_HA 36
-
-/* PowerPC relocations defined for the TLS access ABI. */
-#define R_PPC_TLS 67 /* none (sym+add)@tls */
-#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */
-#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */
-#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
-#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
-#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
-#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */
-#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */
-#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
-#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
-#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
-#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */
-#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
-#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
-#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
-#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
-#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
-#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
-#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
-#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
-#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */
-#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */
-#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
-#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
-#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */
-#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */
-#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
-#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
-#define R_PPC_TLSGD 95 /* none (sym+add)@tlsgd */
-#define R_PPC_TLSLD 96 /* none (sym+add)@tlsld */
-
-/* The remaining relocs are from the Embedded ELF ABI, and are not
- in the SVR4 ELF ABI. */
-#define R_PPC_EMB_NADDR32 101
-#define R_PPC_EMB_NADDR16 102
-#define R_PPC_EMB_NADDR16_LO 103
-#define R_PPC_EMB_NADDR16_HI 104
-#define R_PPC_EMB_NADDR16_HA 105
-#define R_PPC_EMB_SDAI16 106
-#define R_PPC_EMB_SDA2I16 107
-#define R_PPC_EMB_SDA2REL 108
-#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
-#define R_PPC_EMB_MRKREF 110
-#define R_PPC_EMB_RELSEC16 111
-#define R_PPC_EMB_RELST_LO 112
-#define R_PPC_EMB_RELST_HI 113
-#define R_PPC_EMB_RELST_HA 114
-#define R_PPC_EMB_BIT_FLD 115
-#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
-
-/* Diab tool relocations. */
-#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
-#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
-#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
-#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
-#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
-#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
-
-/* GNU extension to support local ifunc. */
-#define R_PPC_IRELATIVE 248
-
-/* GNU relocs used in PIC code sequences. */
-#define R_PPC_REL16 249 /* half16 (sym+add-.) */
-#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */
-#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */
-#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */
-
-/* This is a phony reloc to handle any old fashioned TOC16 references
- that may still be in object files. */
-#define R_PPC_TOC16 255
-
-/* PowerPC specific values for the Dyn d_tag field. */
-#define DT_PPC_GOT (DT_LOPROC + 0)
-#define DT_PPC_OPT (DT_LOPROC + 1)
-#define DT_PPC_NUM 2
-
-/* PowerPC specific values for the DT_PPC_OPT Dyn entry. */
-#define PPC_OPT_TLS 1
-
-/* PowerPC64 relocations defined by the ABIs */
-#define R_PPC64_NONE R_PPC_NONE
-#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */
-#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */
-#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */
-#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */
-#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */
-#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
-#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */
-#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
-#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
-#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */
-#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */
-#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
-#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
-#define R_PPC64_GOT16 R_PPC_GOT16
-#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
-#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
-#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
-
-#define R_PPC64_COPY R_PPC_COPY
-#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
-#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
-#define R_PPC64_RELATIVE R_PPC_RELATIVE
-
-#define R_PPC64_UADDR32 R_PPC_UADDR32
-#define R_PPC64_UADDR16 R_PPC_UADDR16
-#define R_PPC64_REL32 R_PPC_REL32
-#define R_PPC64_PLT32 R_PPC_PLT32
-#define R_PPC64_PLTREL32 R_PPC_PLTREL32
-#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
-#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
-#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
-
-#define R_PPC64_SECTOFF R_PPC_SECTOFF
-#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
-#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
-#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
-#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */
-#define R_PPC64_ADDR64 38 /* doubleword64 S + A */
-#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */
-#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */
-#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */
-#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */
-#define R_PPC64_UADDR64 43 /* doubleword64 S + A */
-#define R_PPC64_REL64 44 /* doubleword64 S + A - P */
-#define R_PPC64_PLT64 45 /* doubleword64 L + A */
-#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */
-#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */
-#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */
-#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */
-#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */
-#define R_PPC64_TOC 51 /* doubleword64 .TOC */
-#define R_PPC64_PLTGOT16 52 /* half16* M + A */
-#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */
-#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */
-#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */
-
-#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */
-#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */
-#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */
-#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */
-#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */
-#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */
-#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */
-#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */
-#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */
-#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */
-#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */
-
-/* PowerPC64 relocations defined for the TLS access ABI. */
-#define R_PPC64_TLS 67 /* none (sym+add)@tls */
-#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */
-#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */
-#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
-#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
-#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
-#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */
-#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */
-#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
-#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
-#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
-#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */
-#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
-#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
-#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
-#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
-#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
-#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
-#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
-#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
-#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */
-#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
-#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
-#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
-#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */
-#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
-#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */
-#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */
-#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */
-#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */
-#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */
-#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */
-#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */
-#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */
-#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */
-#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */
-#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */
-#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */
-#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
-#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
-#define R_PPC64_TLSGD 107 /* none (sym+add)@tlsgd */
-#define R_PPC64_TLSLD 108 /* none (sym+add)@tlsld */
-#define R_PPC64_TOCSAVE 109 /* none */
-
-/* Added when HA and HI relocs were changed to report overflows. */
-#define R_PPC64_ADDR16_HIGH 110
-#define R_PPC64_ADDR16_HIGHA 111
-#define R_PPC64_TPREL16_HIGH 112
-#define R_PPC64_TPREL16_HIGHA 113
-#define R_PPC64_DTPREL16_HIGH 114
-#define R_PPC64_DTPREL16_HIGHA 115
-
-/* GNU extension to support local ifunc. */
-#define R_PPC64_JMP_IREL 247
-#define R_PPC64_IRELATIVE 248
-#define R_PPC64_REL16 249 /* half16 (sym+add-.) */
-#define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */
-#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */
-#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */
-
-/* e_flags bits specifying ABI.
- 1 for original function descriptor using ABI,
- 2 for revised ABI without function descriptors,
- 0 for unspecified or not using any features affected by the differences. */
-#define EF_PPC64_ABI 3
-
-/* PowerPC64 specific values for the Dyn d_tag field. */
-#define DT_PPC64_GLINK (DT_LOPROC + 0)
-#define DT_PPC64_OPD (DT_LOPROC + 1)
-#define DT_PPC64_OPDSZ (DT_LOPROC + 2)
-#define DT_PPC64_OPT (DT_LOPROC + 3)
-#define DT_PPC64_NUM 4
-
-/* PowerPC64 specific values for the DT_PPC64_OPT Dyn entry. */
-#define PPC64_OPT_TLS 1
-#define PPC64_OPT_MULTI_TOC 2
-
-/* PowerPC64 specific values for the Elf64_Sym st_other field. */
-#define STO_PPC64_LOCAL_BIT 5
-#define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT)
-#define PPC64_LOCAL_ENTRY_OFFSET(other) \
- (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2)
-
-
-/* ARM specific declarations */
-
-/* Processor specific flags for the ELF header e_flags field. */
-#define EF_ARM_RELEXEC 0x01
-#define EF_ARM_HASENTRY 0x02
-#define EF_ARM_INTERWORK 0x04
-#define EF_ARM_APCS_26 0x08
-#define EF_ARM_APCS_FLOAT 0x10
-#define EF_ARM_PIC 0x20
-#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */
-#define EF_ARM_NEW_ABI 0x80
-#define EF_ARM_OLD_ABI 0x100
-#define EF_ARM_SOFT_FLOAT 0x200
-#define EF_ARM_VFP_FLOAT 0x400
-#define EF_ARM_MAVERICK_FLOAT 0x800
-
-#define EF_ARM_ABI_FLOAT_SOFT 0x200 /* NB conflicts with EF_ARM_SOFT_FLOAT */
-#define EF_ARM_ABI_FLOAT_HARD 0x400 /* NB conflicts with EF_ARM_VFP_FLOAT */
-
-
-/* Other constants defined in the ARM ELF spec. version B-01. */
-/* NB. These conflict with values defined above. */
-#define EF_ARM_SYMSARESORTED 0x04
-#define EF_ARM_DYNSYMSUSESEGIDX 0x08
-#define EF_ARM_MAPSYMSFIRST 0x10
-#define EF_ARM_EABIMASK 0XFF000000
-
-/* Constants defined in AAELF. */
-#define EF_ARM_BE8 0x00800000
-#define EF_ARM_LE8 0x00400000
-
-#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
-#define EF_ARM_EABI_UNKNOWN 0x00000000
-#define EF_ARM_EABI_VER1 0x01000000
-#define EF_ARM_EABI_VER2 0x02000000
-#define EF_ARM_EABI_VER3 0x03000000
-#define EF_ARM_EABI_VER4 0x04000000
-#define EF_ARM_EABI_VER5 0x05000000
-
-/* Additional symbol types for Thumb. */
-#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
-#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
-
-/* ARM-specific values for sh_flags */
-#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */
-#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined
- in the input to a link step. */
-
-/* ARM-specific program header flags */
-#define PF_ARM_SB 0x10000000 /* Segment contains the location
- addressed by the static base. */
-#define PF_ARM_PI 0x20000000 /* Position-independent segment. */
-#define PF_ARM_ABS 0x40000000 /* Absolute segment. */
-
-/* Processor specific values for the Phdr p_type field. */
-#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */
-
-/* Processor specific values for the Shdr sh_type field. */
-#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */
-#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */
-#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */
-
-
-/* AArch64 relocs. */
-
-#define R_AARCH64_NONE 0 /* No relocation. */
-
-/* ILP32 AArch64 relocs. */
-#define R_AARCH64_P32_ABS32 1 /* Direct 32 bit. */
-#define R_AARCH64_P32_COPY 180 /* Copy symbol at runtime. */
-#define R_AARCH64_P32_GLOB_DAT 181 /* Create GOT entry. */
-#define R_AARCH64_P32_JUMP_SLOT 182 /* Create PLT entry. */
-#define R_AARCH64_P32_RELATIVE 183 /* Adjust by program base. */
-#define R_AARCH64_P32_TLS_DTPMOD 184 /* Module number, 32 bit. */
-#define R_AARCH64_P32_TLS_DTPREL 185 /* Module-relative offset, 32 bit. */
-#define R_AARCH64_P32_TLS_TPREL 186 /* TP-relative offset, 32 bit. */
-#define R_AARCH64_P32_TLSDESC 187 /* TLS Descriptor. */
-#define R_AARCH64_P32_IRELATIVE 188 /* STT_GNU_IFUNC relocation. */
-
-/* LP64 AArch64 relocs. */
-#define R_AARCH64_ABS64 257 /* Direct 64 bit. */
-#define R_AARCH64_ABS32 258 /* Direct 32 bit. */
-#define R_AARCH64_ABS16 259 /* Direct 16-bit. */
-#define R_AARCH64_PREL64 260 /* PC-relative 64-bit. */
-#define R_AARCH64_PREL32 261 /* PC-relative 32-bit. */
-#define R_AARCH64_PREL16 262 /* PC-relative 16-bit. */
-#define R_AARCH64_MOVW_UABS_G0 263 /* Dir. MOVZ imm. from bits 15:0. */
-#define R_AARCH64_MOVW_UABS_G0_NC 264 /* Likewise for MOVK; no check. */
-#define R_AARCH64_MOVW_UABS_G1 265 /* Dir. MOVZ imm. from bits 31:16. */
-#define R_AARCH64_MOVW_UABS_G1_NC 266 /* Likewise for MOVK; no check. */
-#define R_AARCH64_MOVW_UABS_G2 267 /* Dir. MOVZ imm. from bits 47:32. */
-#define R_AARCH64_MOVW_UABS_G2_NC 268 /* Likewise for MOVK; no check. */
-#define R_AARCH64_MOVW_UABS_G3 269 /* Dir. MOV{K,Z} imm. from 63:48. */
-#define R_AARCH64_MOVW_SABS_G0 270 /* Dir. MOV{N,Z} imm. from 15:0. */
-#define R_AARCH64_MOVW_SABS_G1 271 /* Dir. MOV{N,Z} imm. from 31:16. */
-#define R_AARCH64_MOVW_SABS_G2 272 /* Dir. MOV{N,Z} imm. from 47:32. */
-#define R_AARCH64_LD_PREL_LO19 273 /* PC-rel. LD imm. from bits 20:2. */
-#define R_AARCH64_ADR_PREL_LO21 274 /* PC-rel. ADR imm. from bits 20:0. */
-#define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page-rel. ADRP imm. from 32:12. */
-#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Likewise; no overflow check. */
-#define R_AARCH64_ADD_ABS_LO12_NC 277 /* Dir. ADD imm. from bits 11:0. */
-#define R_AARCH64_LDST8_ABS_LO12_NC 278 /* Likewise for LD/ST; no check. */
-#define R_AARCH64_TSTBR14 279 /* PC-rel. TBZ/TBNZ imm. from 15:2. */
-#define R_AARCH64_CONDBR19 280 /* PC-rel. cond. br. imm. from 20:2. */
-#define R_AARCH64_JUMP26 282 /* PC-rel. B imm. from bits 27:2. */
-#define R_AARCH64_CALL26 283 /* Likewise for CALL. */
-#define R_AARCH64_LDST16_ABS_LO12_NC 284 /* Dir. ADD imm. from bits 11:1. */
-#define R_AARCH64_LDST32_ABS_LO12_NC 285 /* Likewise for bits 11:2. */
-#define R_AARCH64_LDST64_ABS_LO12_NC 286 /* Likewise for bits 11:3. */
-#define R_AARCH64_MOVW_PREL_G0 287 /* PC-rel. MOV{N,Z} imm. from 15:0. */
-#define R_AARCH64_MOVW_PREL_G0_NC 288 /* Likewise for MOVK; no check. */
-#define R_AARCH64_MOVW_PREL_G1 289 /* PC-rel. MOV{N,Z} imm. from 31:16. */
-#define R_AARCH64_MOVW_PREL_G1_NC 290 /* Likewise for MOVK; no check. */
-#define R_AARCH64_MOVW_PREL_G2 291 /* PC-rel. MOV{N,Z} imm. from 47:32. */
-#define R_AARCH64_MOVW_PREL_G2_NC 292 /* Likewise for MOVK; no check. */
-#define R_AARCH64_MOVW_PREL_G3 293 /* PC-rel. MOV{N,Z} imm. from 63:48. */
-#define R_AARCH64_LDST128_ABS_LO12_NC 299 /* Dir. ADD imm. from bits 11:4. */
-#define R_AARCH64_MOVW_GOTOFF_G0 300 /* GOT-rel. off. MOV{N,Z} imm. 15:0. */
-#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* Likewise for MOVK; no check. */
-#define R_AARCH64_MOVW_GOTOFF_G1 302 /* GOT-rel. o. MOV{N,Z} imm. 31:16. */
-#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* Likewise for MOVK; no check. */
-#define R_AARCH64_MOVW_GOTOFF_G2 304 /* GOT-rel. o. MOV{N,Z} imm. 47:32. */
-#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* Likewise for MOVK; no check. */
-#define R_AARCH64_MOVW_GOTOFF_G3 306 /* GOT-rel. o. MOV{N,Z} imm. 63:48. */
-#define R_AARCH64_GOTREL64 307 /* GOT-relative 64-bit. */
-#define R_AARCH64_GOTREL32 308 /* GOT-relative 32-bit. */
-#define R_AARCH64_GOT_LD_PREL19 309 /* PC-rel. GOT off. load imm. 20:2. */
-#define R_AARCH64_LD64_GOTOFF_LO15 310 /* GOT-rel. off. LD/ST imm. 14:3. */
-#define R_AARCH64_ADR_GOT_PAGE 311 /* P-page-rel. GOT off. ADRP 32:12. */
-#define R_AARCH64_LD64_GOT_LO12_NC 312 /* Dir. GOT off. LD/ST imm. 11:3. */
-#define R_AARCH64_LD64_GOTPAGE_LO15 313 /* GOT-page-rel. GOT off. LD/ST 14:3 */
-#define R_AARCH64_TLSGD_ADR_PREL21 512 /* PC-relative ADR imm. 20:0. */
-#define R_AARCH64_TLSGD_ADR_PAGE21 513 /* page-rel. ADRP imm. 32:12. */
-#define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* direct ADD imm. from 11:0. */
-#define R_AARCH64_TLSGD_MOVW_G1 515 /* GOT-rel. MOV{N,Z} 31:16. */
-#define R_AARCH64_TLSGD_MOVW_G0_NC 516 /* GOT-rel. MOVK imm. 15:0. */
-#define R_AARCH64_TLSLD_ADR_PREL21 517 /* Like 512; local dynamic model. */
-#define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Like 513; local dynamic model. */
-#define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* Like 514; local dynamic model. */
-#define R_AARCH64_TLSLD_MOVW_G1 520 /* Like 515; local dynamic model. */
-#define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* Like 516; local dynamic model. */
-#define R_AARCH64_TLSLD_LD_PREL19 522 /* TLS PC-rel. load imm. 20:2. */
-#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* TLS DTP-rel. MOV{N,Z} 47:32. */
-#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* TLS DTP-rel. MOV{N,Z} 31:16. */
-#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* Likewise; MOVK; no check. */
-#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* TLS DTP-rel. MOV{N,Z} 15:0. */
-#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 /* Likewise; MOVK; no check. */
-#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTP-rel. ADD imm. from 23:12. */
-#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTP-rel. ADD imm. from 11:0. */
-#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* Likewise; no ovfl. check. */
-#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTP-rel. LD/ST imm. 11:0. */
-#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* Likewise; no check. */
-#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTP-rel. LD/ST imm. 11:1. */
-#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* Likewise; no check. */
-#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTP-rel. LD/ST imm. 11:2. */
-#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* Likewise; no check. */
-#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTP-rel. LD/ST imm. 11:3. */
-#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* Likewise; no check. */
-#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* GOT-rel. MOV{N,Z} 31:16. */
-#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* GOT-rel. MOVK 15:0. */
-#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page-rel. ADRP 32:12. */
-#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* Direct LD off. 11:3. */
-#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* PC-rel. load imm. 20:2. */
-#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TLS TP-rel. MOV{N,Z} 47:32. */
-#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 /* TLS TP-rel. MOV{N,Z} 31:16. */
-#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 /* Likewise; MOVK; no check. */
-#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 /* TLS TP-rel. MOV{N,Z} 15:0. */
-#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 /* Likewise; MOVK; no check. */
-#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 /* TP-rel. ADD imm. 23:12. */
-#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 /* TP-rel. ADD imm. 11:0. */
-#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 /* Likewise; no ovfl. check. */
-#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 /* TP-rel. LD/ST off. 11:0. */
-#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 /* Likewise; no ovfl. check. */
-#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 /* TP-rel. LD/ST off. 11:1. */
-#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 /* Likewise; no check. */
-#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 /* TP-rel. LD/ST off. 11:2. */
-#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 /* Likewise; no check. */
-#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 /* TP-rel. LD/ST off. 11:3. */
-#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 /* Likewise; no check. */
-#define R_AARCH64_TLSDESC_LD_PREL19 560 /* PC-rel. load immediate 20:2. */
-#define R_AARCH64_TLSDESC_ADR_PREL21 561 /* PC-rel. ADR immediate 20:0. */
-#define R_AARCH64_TLSDESC_ADR_PAGE21 562 /* Page-rel. ADRP imm. 32:12. */
-#define R_AARCH64_TLSDESC_LD64_LO12 563 /* Direct LD off. from 11:3. */
-#define R_AARCH64_TLSDESC_ADD_LO12 564 /* Direct ADD imm. from 11:0. */
-#define R_AARCH64_TLSDESC_OFF_G1 565 /* GOT-rel. MOV{N,Z} imm. 31:16. */
-#define R_AARCH64_TLSDESC_OFF_G0_NC 566 /* GOT-rel. MOVK imm. 15:0; no ck. */
-#define R_AARCH64_TLSDESC_LDR 567 /* Relax LDR. */
-#define R_AARCH64_TLSDESC_ADD 568 /* Relax ADD. */
-#define R_AARCH64_TLSDESC_CALL 569 /* Relax BLR. */
-#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 /* TP-rel. LD/ST off. 11:4. */
-#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 /* Likewise; no check. */
-#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 /* DTP-rel. LD/ST imm. 11:4. */
-#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 /* Likewise; no check. */
-#define R_AARCH64_COPY 1024 /* Copy symbol at runtime. */
-#define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */
-#define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */
-#define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
-#define R_AARCH64_TLS_DTPMOD 1028 /* Module number, 64 bit. */
-#define R_AARCH64_TLS_DTPREL 1029 /* Module-relative offset, 64 bit. */
-#define R_AARCH64_TLS_TPREL 1030 /* TP-relative offset, 64 bit. */
-#define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
-#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
-
-/* ARM relocs. */
-
-#define R_ARM_NONE 0 /* No reloc */
-#define R_ARM_PC24 1 /* Deprecated PC relative 26
- bit branch. */
-#define R_ARM_ABS32 2 /* Direct 32 bit */
-#define R_ARM_REL32 3 /* PC relative 32 bit */
-#define R_ARM_PC13 4
-#define R_ARM_ABS16 5 /* Direct 16 bit */
-#define R_ARM_ABS12 6 /* Direct 12 bit */
-#define R_ARM_THM_ABS5 7 /* Direct & 0x7C (LDR, STR). */
-#define R_ARM_ABS8 8 /* Direct 8 bit */
-#define R_ARM_SBREL32 9
-#define R_ARM_THM_PC22 10 /* PC relative 24 bit (Thumb32 BL). */
-#define R_ARM_THM_PC8 11 /* PC relative & 0x3FC
- (Thumb16 LDR, ADD, ADR). */
-#define R_ARM_AMP_VCALL9 12
-#define R_ARM_SWI24 13 /* Obsolete static relocation. */
-#define R_ARM_TLS_DESC 13 /* Dynamic relocation. */
-#define R_ARM_THM_SWI8 14 /* Reserved. */
-#define R_ARM_XPC25 15 /* Reserved. */
-#define R_ARM_THM_XPC22 16 /* Reserved. */
-#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */
-#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */
-#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */
-#define R_ARM_COPY 20 /* Copy symbol at runtime */
-#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
-#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
-#define R_ARM_RELATIVE 23 /* Adjust by program base */
-#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */
-#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */
-#define R_ARM_GOT32 26 /* 32 bit GOT entry */
-#define R_ARM_PLT32 27 /* Deprecated, 32 bit PLT address. */
-#define R_ARM_CALL 28 /* PC relative 24 bit (BL, BLX). */
-#define R_ARM_JUMP24 29 /* PC relative 24 bit
- (B, BL<cond>). */
-#define R_ARM_THM_JUMP24 30 /* PC relative 24 bit (Thumb32 B.W). */
-#define R_ARM_BASE_ABS 31 /* Adjust by program base. */
-#define R_ARM_ALU_PCREL_7_0 32 /* Obsolete. */
-#define R_ARM_ALU_PCREL_15_8 33 /* Obsolete. */
-#define R_ARM_ALU_PCREL_23_15 34 /* Obsolete. */
-#define R_ARM_LDR_SBREL_11_0 35 /* Deprecated, prog. base relative. */
-#define R_ARM_ALU_SBREL_19_12 36 /* Deprecated, prog. base relative. */
-#define R_ARM_ALU_SBREL_27_20 37 /* Deprecated, prog. base relative. */
-#define R_ARM_TARGET1 38
-#define R_ARM_SBREL31 39 /* Program base relative. */
-#define R_ARM_V4BX 40
-#define R_ARM_TARGET2 41
-#define R_ARM_PREL31 42 /* 32 bit PC relative. */
-#define R_ARM_MOVW_ABS_NC 43 /* Direct 16-bit (MOVW). */
-#define R_ARM_MOVT_ABS 44 /* Direct high 16-bit (MOVT). */
-#define R_ARM_MOVW_PREL_NC 45 /* PC relative 16-bit (MOVW). */
-#define R_ARM_MOVT_PREL 46 /* PC relative (MOVT). */
-#define R_ARM_THM_MOVW_ABS_NC 47 /* Direct 16 bit (Thumb32 MOVW). */
-#define R_ARM_THM_MOVT_ABS 48 /* Direct high 16 bit
- (Thumb32 MOVT). */
-#define R_ARM_THM_MOVW_PREL_NC 49 /* PC relative 16 bit
- (Thumb32 MOVW). */
-#define R_ARM_THM_MOVT_PREL 50 /* PC relative high 16 bit
- (Thumb32 MOVT). */
-#define R_ARM_THM_JUMP19 51 /* PC relative 20 bit
- (Thumb32 B<cond>.W). */
-#define R_ARM_THM_JUMP6 52 /* PC relative X & 0x7E
- (Thumb16 CBZ, CBNZ). */
-#define R_ARM_THM_ALU_PREL_11_0 53 /* PC relative 12 bit
- (Thumb32 ADR.W). */
-#define R_ARM_THM_PC12 54 /* PC relative 12 bit
- (Thumb32 LDR{D,SB,H,SH}). */
-#define R_ARM_ABS32_NOI 55 /* Direct 32-bit. */
-#define R_ARM_REL32_NOI 56 /* PC relative 32-bit. */
-#define R_ARM_ALU_PC_G0_NC 57 /* PC relative (ADD, SUB). */
-#define R_ARM_ALU_PC_G0 58 /* PC relative (ADD, SUB). */
-#define R_ARM_ALU_PC_G1_NC 59 /* PC relative (ADD, SUB). */
-#define R_ARM_ALU_PC_G1 60 /* PC relative (ADD, SUB). */
-#define R_ARM_ALU_PC_G2 61 /* PC relative (ADD, SUB). */
-#define R_ARM_LDR_PC_G1 62 /* PC relative (LDR,STR,LDRB,STRB). */
-#define R_ARM_LDR_PC_G2 63 /* PC relative (LDR,STR,LDRB,STRB). */
-#define R_ARM_LDRS_PC_G0 64 /* PC relative (STR{D,H},
- LDR{D,SB,H,SH}). */
-#define R_ARM_LDRS_PC_G1 65 /* PC relative (STR{D,H},
- LDR{D,SB,H,SH}). */
-#define R_ARM_LDRS_PC_G2 66 /* PC relative (STR{D,H},
- LDR{D,SB,H,SH}). */
-#define R_ARM_LDC_PC_G0 67 /* PC relative (LDC, STC). */
-#define R_ARM_LDC_PC_G1 68 /* PC relative (LDC, STC). */
-#define R_ARM_LDC_PC_G2 69 /* PC relative (LDC, STC). */
-#define R_ARM_ALU_SB_G0_NC 70 /* Program base relative (ADD,SUB). */
-#define R_ARM_ALU_SB_G0 71 /* Program base relative (ADD,SUB). */
-#define R_ARM_ALU_SB_G1_NC 72 /* Program base relative (ADD,SUB). */
-#define R_ARM_ALU_SB_G1 73 /* Program base relative (ADD,SUB). */
-#define R_ARM_ALU_SB_G2 74 /* Program base relative (ADD,SUB). */
-#define R_ARM_LDR_SB_G0 75 /* Program base relative (LDR,
- STR, LDRB, STRB). */
-#define R_ARM_LDR_SB_G1 76 /* Program base relative
- (LDR, STR, LDRB, STRB). */
-#define R_ARM_LDR_SB_G2 77 /* Program base relative
- (LDR, STR, LDRB, STRB). */
-#define R_ARM_LDRS_SB_G0 78 /* Program base relative
- (LDR, STR, LDRB, STRB). */
-#define R_ARM_LDRS_SB_G1 79 /* Program base relative
- (LDR, STR, LDRB, STRB). */
-#define R_ARM_LDRS_SB_G2 80 /* Program base relative
- (LDR, STR, LDRB, STRB). */
-#define R_ARM_LDC_SB_G0 81 /* Program base relative (LDC,STC). */
-#define R_ARM_LDC_SB_G1 82 /* Program base relative (LDC,STC). */
-#define R_ARM_LDC_SB_G2 83 /* Program base relative (LDC,STC). */
-#define R_ARM_MOVW_BREL_NC 84 /* Program base relative 16
- bit (MOVW). */
-#define R_ARM_MOVT_BREL 85 /* Program base relative high
- 16 bit (MOVT). */
-#define R_ARM_MOVW_BREL 86 /* Program base relative 16
- bit (MOVW). */
-#define R_ARM_THM_MOVW_BREL_NC 87 /* Program base relative 16
- bit (Thumb32 MOVW). */
-#define R_ARM_THM_MOVT_BREL 88 /* Program base relative high
- 16 bit (Thumb32 MOVT). */
-#define R_ARM_THM_MOVW_BREL 89 /* Program base relative 16
- bit (Thumb32 MOVW). */
-#define R_ARM_TLS_GOTDESC 90
-#define R_ARM_TLS_CALL 91
-#define R_ARM_TLS_DESCSEQ 92 /* TLS relaxation. */
-#define R_ARM_THM_TLS_CALL 93
-#define R_ARM_PLT32_ABS 94
-#define R_ARM_GOT_ABS 95 /* GOT entry. */
-#define R_ARM_GOT_PREL 96 /* PC relative GOT entry. */
-#define R_ARM_GOT_BREL12 97 /* GOT entry relative to GOT
- origin (LDR). */
-#define R_ARM_GOTOFF12 98 /* 12 bit, GOT entry relative
- to GOT origin (LDR, STR). */
-#define R_ARM_GOTRELAX 99
-#define R_ARM_GNU_VTENTRY 100
-#define R_ARM_GNU_VTINHERIT 101
-#define R_ARM_THM_PC11 102 /* PC relative & 0xFFE (Thumb16 B). */
-#define R_ARM_THM_PC9 103 /* PC relative & 0x1FE
- (Thumb16 B/B<cond>). */
-#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic
- thread local data */
-#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic
- thread local data */
-#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS
- block */
-#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of
- static TLS block offset */
-#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static
- TLS block */
-#define R_ARM_TLS_LDO12 109 /* 12 bit relative to TLS
- block (LDR, STR). */
-#define R_ARM_TLS_LE12 110 /* 12 bit relative to static
- TLS block (LDR, STR). */
-#define R_ARM_TLS_IE12GP 111 /* 12 bit GOT entry relative
- to GOT origin (LDR). */
-#define R_ARM_ME_TOO 128 /* Obsolete. */
-#define R_ARM_THM_TLS_DESCSEQ 129
-#define R_ARM_THM_TLS_DESCSEQ16 129
-#define R_ARM_THM_TLS_DESCSEQ32 130
-#define R_ARM_THM_GOT_BREL12 131 /* GOT entry relative to GOT
- origin, 12 bit (Thumb32 LDR). */
-#define R_ARM_IRELATIVE 160
-#define R_ARM_RXPC25 249
-#define R_ARM_RSBREL32 250
-#define R_ARM_THM_RPC22 251
-#define R_ARM_RREL32 252
-#define R_ARM_RABS22 253
-#define R_ARM_RPC24 254
-#define R_ARM_RBASE 255
-/* Keep this the last entry. */
-#define R_ARM_NUM 256
-
-/* IA-64 specific declarations. */
-
-/* Processor specific flags for the Ehdr e_flags field. */
-#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */
-#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */
-#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */
-
-/* Processor specific values for the Phdr p_type field. */
-#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */
-#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */
-#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12)
-#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13)
-#define PT_IA_64_HP_STACK (PT_LOOS + 0x14)
-
-/* Processor specific flags for the Phdr p_flags field. */
-#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */
-
-/* Processor specific values for the Shdr sh_type field. */
-#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */
-#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */
-
-/* Processor specific flags for the Shdr sh_flags field. */
-#define SHF_IA_64_SHORT 0x10000000 /* section near gp */
-#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */
-
-/* Processor specific values for the Dyn d_tag field. */
-#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0)
-#define DT_IA_64_NUM 1
-
-/* IA-64 relocations. */
-#define R_IA64_NONE 0x00 /* none */
-#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */
-#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */
-#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */
-#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */
-#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */
-#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */
-#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */
-#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */
-#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */
-#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */
-#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */
-#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */
-#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */
-#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */
-#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */
-#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */
-#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */
-#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */
-#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */
-#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */
-#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */
-#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */
-#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */
-#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */
-#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */
-#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */
-#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */
-#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */
-#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */
-#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */
-#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */
-#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */
-#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */
-#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */
-#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */
-#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */
-#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */
-#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */
-#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */
-#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */
-#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */
-#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */
-#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */
-#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */
-#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */
-#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */
-#define R_IA64_REL32MSB 0x6c /* data 4 + REL */
-#define R_IA64_REL32LSB 0x6d /* data 4 + REL */
-#define R_IA64_REL64MSB 0x6e /* data 8 + REL */
-#define R_IA64_REL64LSB 0x6f /* data 8 + REL */
-#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */
-#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */
-#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */
-#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */
-#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */
-#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */
-#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */
-#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */
-#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */
-#define R_IA64_COPY 0x84 /* copy relocation */
-#define R_IA64_SUB 0x85 /* Addend and symbol difference */
-#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */
-#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */
-#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */
-#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */
-#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */
-#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */
-#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */
-#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */
-#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */
-#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */
-#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */
-#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */
-#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */
-#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */
-#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */
-#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */
-#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */
-#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */
-#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */
-
-/* SH specific declarations */
-
-/* Processor specific flags for the ELF header e_flags field. */
-#define EF_SH_MACH_MASK 0x1f
-#define EF_SH_UNKNOWN 0x0
-#define EF_SH1 0x1
-#define EF_SH2 0x2
-#define EF_SH3 0x3
-#define EF_SH_DSP 0x4
-#define EF_SH3_DSP 0x5
-#define EF_SH4AL_DSP 0x6
-#define EF_SH3E 0x8
-#define EF_SH4 0x9
-#define EF_SH2E 0xb
-#define EF_SH4A 0xc
-#define EF_SH2A 0xd
-#define EF_SH4_NOFPU 0x10
-#define EF_SH4A_NOFPU 0x11
-#define EF_SH4_NOMMU_NOFPU 0x12
-#define EF_SH2A_NOFPU 0x13
-#define EF_SH3_NOMMU 0x14
-#define EF_SH2A_SH4_NOFPU 0x15
-#define EF_SH2A_SH3_NOFPU 0x16
-#define EF_SH2A_SH4 0x17
-#define EF_SH2A_SH3E 0x18
-
-/* SH relocs. */
-#define R_SH_NONE 0
-#define R_SH_DIR32 1
-#define R_SH_REL32 2
-#define R_SH_DIR8WPN 3
-#define R_SH_IND12W 4
-#define R_SH_DIR8WPL 5
-#define R_SH_DIR8WPZ 6
-#define R_SH_DIR8BP 7
-#define R_SH_DIR8W 8
-#define R_SH_DIR8L 9
-#define R_SH_SWITCH16 25
-#define R_SH_SWITCH32 26
-#define R_SH_USES 27
-#define R_SH_COUNT 28
-#define R_SH_ALIGN 29
-#define R_SH_CODE 30
-#define R_SH_DATA 31
-#define R_SH_LABEL 32
-#define R_SH_SWITCH8 33
-#define R_SH_GNU_VTINHERIT 34
-#define R_SH_GNU_VTENTRY 35
-#define R_SH_TLS_GD_32 144
-#define R_SH_TLS_LD_32 145
-#define R_SH_TLS_LDO_32 146
-#define R_SH_TLS_IE_32 147
-#define R_SH_TLS_LE_32 148
-#define R_SH_TLS_DTPMOD32 149
-#define R_SH_TLS_DTPOFF32 150
-#define R_SH_TLS_TPOFF32 151
-#define R_SH_GOT32 160
-#define R_SH_PLT32 161
-#define R_SH_COPY 162
-#define R_SH_GLOB_DAT 163
-#define R_SH_JMP_SLOT 164
-#define R_SH_RELATIVE 165
-#define R_SH_GOTOFF 166
-#define R_SH_GOTPC 167
-/* Keep this the last entry. */
-#define R_SH_NUM 256
-
-/* S/390 specific definitions. */
-
-/* Valid values for the e_flags field. */
-
-#define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed. */
-
-/* Additional s390 relocs */
-
-#define R_390_NONE 0 /* No reloc. */
-#define R_390_8 1 /* Direct 8 bit. */
-#define R_390_12 2 /* Direct 12 bit. */
-#define R_390_16 3 /* Direct 16 bit. */
-#define R_390_32 4 /* Direct 32 bit. */
-#define R_390_PC32 5 /* PC relative 32 bit. */
-#define R_390_GOT12 6 /* 12 bit GOT offset. */
-#define R_390_GOT32 7 /* 32 bit GOT offset. */
-#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */
-#define R_390_COPY 9 /* Copy symbol at runtime. */
-#define R_390_GLOB_DAT 10 /* Create GOT entry. */
-#define R_390_JMP_SLOT 11 /* Create PLT entry. */
-#define R_390_RELATIVE 12 /* Adjust by program base. */
-#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */
-#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */
-#define R_390_GOT16 15 /* 16 bit GOT offset. */
-#define R_390_PC16 16 /* PC relative 16 bit. */
-#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */
-#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */
-#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */
-#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */
-#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */
-#define R_390_64 22 /* Direct 64 bit. */
-#define R_390_PC64 23 /* PC relative 64 bit. */
-#define R_390_GOT64 24 /* 64 bit GOT offset. */
-#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */
-#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */
-#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */
-#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */
-#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */
-#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */
-#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */
-#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */
-#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */
-#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */
-#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */
-#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */
-#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */
-#define R_390_TLS_GDCALL 38 /* Tag for function call in general
- dynamic TLS code. */
-#define R_390_TLS_LDCALL 39 /* Tag for function call in local
- dynamic TLS code. */
-#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic
- thread local data. */
-#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic
- thread local data. */
-#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS
- block offset. */
-#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS
- block offset. */
-#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS
- block offset. */
-#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic
- thread local data in LE code. */
-#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic
- thread local data in LE code. */
-#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for
- negated static TLS block offset. */
-#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for
- negated static TLS block offset. */
-#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for
- negated static TLS block offset. */
-#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to
- static TLS block. */
-#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to
- static TLS block. */
-#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS
- block. */
-#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS
- block. */
-#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */
-#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */
-#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS
- block. */
-#define R_390_20 57 /* Direct 20 bit. */
-#define R_390_GOT20 58 /* 20 bit GOT offset. */
-#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */
-#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS
- block offset. */
-#define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */
-/* Keep this the last entry. */
-#define R_390_NUM 62
-
-
-/* CRIS relocations. */
-#define R_CRIS_NONE 0
-#define R_CRIS_8 1
-#define R_CRIS_16 2
-#define R_CRIS_32 3
-#define R_CRIS_8_PCREL 4
-#define R_CRIS_16_PCREL 5
-#define R_CRIS_32_PCREL 6
-#define R_CRIS_GNU_VTINHERIT 7
-#define R_CRIS_GNU_VTENTRY 8
-#define R_CRIS_COPY 9
-#define R_CRIS_GLOB_DAT 10
-#define R_CRIS_JUMP_SLOT 11
-#define R_CRIS_RELATIVE 12
-#define R_CRIS_16_GOT 13
-#define R_CRIS_32_GOT 14
-#define R_CRIS_16_GOTPLT 15
-#define R_CRIS_32_GOTPLT 16
-#define R_CRIS_32_GOTREL 17
-#define R_CRIS_32_PLT_GOTREL 18
-#define R_CRIS_32_PLT_PCREL 19
-
-#define R_CRIS_NUM 20
-
-
-/* AMD x86-64 relocations. */
-#define R_X86_64_NONE 0 /* No reloc */
-#define R_X86_64_64 1 /* Direct 64 bit */
-#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
-#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
-#define R_X86_64_PLT32 4 /* 32 bit PLT address */
-#define R_X86_64_COPY 5 /* Copy symbol at runtime */
-#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
-#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
-#define R_X86_64_RELATIVE 8 /* Adjust by program base */
-#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative
- offset to GOT */
-#define R_X86_64_32 10 /* Direct 32 bit zero extended */
-#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
-#define R_X86_64_16 12 /* Direct 16 bit zero extended */
-#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
-#define R_X86_64_8 14 /* Direct 8 bit sign extended */
-#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
-#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
-#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */
-#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */
-#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset
- to two GOT entries for GD symbol */
-#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset
- to two GOT entries for LD symbol */
-#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
-#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset
- to GOT entry for IE symbol */
-#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */
-#define R_X86_64_PC64 24 /* PC relative 64 bit */
-#define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */
-#define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative
- offset to GOT */
-#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */
-#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset
- to GOT entry */
-#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */
-#define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */
-#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset
- to PLT entry */
-#define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */
-#define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */
-#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */
-#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS
- descriptor. */
-#define R_X86_64_TLSDESC 36 /* TLS descriptor. */
-#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */
-#define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */
-
-#define R_X86_64_NUM 39
-
-
-/* AM33 relocations. */
-#define R_MN10300_NONE 0 /* No reloc. */
-#define R_MN10300_32 1 /* Direct 32 bit. */
-#define R_MN10300_16 2 /* Direct 16 bit. */
-#define R_MN10300_8 3 /* Direct 8 bit. */
-#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */
-#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */
-#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */
-#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */
-#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */
-#define R_MN10300_24 9 /* Direct 24 bit. */
-#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */
-#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */
-#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */
-#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */
-#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */
-#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */
-#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */
-#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */
-#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */
-#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */
-#define R_MN10300_COPY 20 /* Copy symbol at runtime. */
-#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */
-#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */
-#define R_MN10300_RELATIVE 23 /* Adjust by program base. */
-#define R_MN10300_TLS_GD 24 /* 32-bit offset for global dynamic. */
-#define R_MN10300_TLS_LD 25 /* 32-bit offset for local dynamic. */
-#define R_MN10300_TLS_LDO 26 /* Module-relative offset. */
-#define R_MN10300_TLS_GOTIE 27 /* GOT offset for static TLS block
- offset. */
-#define R_MN10300_TLS_IE 28 /* GOT address for static TLS block
- offset. */
-#define R_MN10300_TLS_LE 29 /* Offset relative to static TLS
- block. */
-#define R_MN10300_TLS_DTPMOD 30 /* ID of module containing symbol. */
-#define R_MN10300_TLS_DTPOFF 31 /* Offset in module TLS block. */
-#define R_MN10300_TLS_TPOFF 32 /* Offset in static TLS block. */
-#define R_MN10300_SYM_DIFF 33 /* Adjustment for next reloc as needed
- by linker relaxation. */
-#define R_MN10300_ALIGN 34 /* Alignment requirement for linker
- relaxation. */
-#define R_MN10300_NUM 35
-
-
-/* M32R relocs. */
-#define R_M32R_NONE 0 /* No reloc. */
-#define R_M32R_16 1 /* Direct 16 bit. */
-#define R_M32R_32 2 /* Direct 32 bit. */
-#define R_M32R_24 3 /* Direct 24 bit. */
-#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */
-#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */
-#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */
-#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */
-#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */
-#define R_M32R_LO16 9 /* Low 16 bit. */
-#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */
-#define R_M32R_GNU_VTINHERIT 11
-#define R_M32R_GNU_VTENTRY 12
-/* M32R relocs use SHT_RELA. */
-#define R_M32R_16_RELA 33 /* Direct 16 bit. */
-#define R_M32R_32_RELA 34 /* Direct 32 bit. */
-#define R_M32R_24_RELA 35 /* Direct 24 bit. */
-#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */
-#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */
-#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */
-#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */
-#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */
-#define R_M32R_LO16_RELA 41 /* Low 16 bit */
-#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */
-#define R_M32R_RELA_GNU_VTINHERIT 43
-#define R_M32R_RELA_GNU_VTENTRY 44
-#define R_M32R_REL32 45 /* PC relative 32 bit. */
-
-#define R_M32R_GOT24 48 /* 24 bit GOT entry */
-#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */
-#define R_M32R_COPY 50 /* Copy symbol at runtime */
-#define R_M32R_GLOB_DAT 51 /* Create GOT entry */
-#define R_M32R_JMP_SLOT 52 /* Create PLT entry */
-#define R_M32R_RELATIVE 53 /* Adjust by program base */
-#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */
-#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */
-#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned
- low */
-#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed
- low */
-#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */
-#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to
- GOT with unsigned low */
-#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to
- GOT with signed low */
-#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to
- GOT */
-#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT
- with unsigned low */
-#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT
- with signed low */
-#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */
-#define R_M32R_NUM 256 /* Keep this the last entry. */
-
-/* MicroBlaze relocations */
-#define R_MICROBLAZE_NONE 0 /* No reloc. */
-#define R_MICROBLAZE_32 1 /* Direct 32 bit. */
-#define R_MICROBLAZE_32_PCREL 2 /* PC relative 32 bit. */
-#define R_MICROBLAZE_64_PCREL 3 /* PC relative 64 bit. */
-#define R_MICROBLAZE_32_PCREL_LO 4 /* Low 16 bits of PCREL32. */
-#define R_MICROBLAZE_64 5 /* Direct 64 bit. */
-#define R_MICROBLAZE_32_LO 6 /* Low 16 bit. */
-#define R_MICROBLAZE_SRO32 7 /* Read-only small data area. */
-#define R_MICROBLAZE_SRW32 8 /* Read-write small data area. */
-#define R_MICROBLAZE_64_NONE 9 /* No reloc. */
-#define R_MICROBLAZE_32_SYM_OP_SYM 10 /* Symbol Op Symbol relocation. */
-#define R_MICROBLAZE_GNU_VTINHERIT 11 /* GNU C++ vtable hierarchy. */
-#define R_MICROBLAZE_GNU_VTENTRY 12 /* GNU C++ vtable member usage. */
-#define R_MICROBLAZE_GOTPC_64 13 /* PC-relative GOT offset. */
-#define R_MICROBLAZE_GOT_64 14 /* GOT entry offset. */
-#define R_MICROBLAZE_PLT_64 15 /* PLT offset (PC-relative). */
-#define R_MICROBLAZE_REL 16 /* Adjust by program base. */
-#define R_MICROBLAZE_JUMP_SLOT 17 /* Create PLT entry. */
-#define R_MICROBLAZE_GLOB_DAT 18 /* Create GOT entry. */
-#define R_MICROBLAZE_GOTOFF_64 19 /* 64 bit offset to GOT. */
-#define R_MICROBLAZE_GOTOFF_32 20 /* 32 bit offset to GOT. */
-#define R_MICROBLAZE_COPY 21 /* Runtime copy. */
-#define R_MICROBLAZE_TLS 22 /* TLS Reloc. */
-#define R_MICROBLAZE_TLSGD 23 /* TLS General Dynamic. */
-#define R_MICROBLAZE_TLSLD 24 /* TLS Local Dynamic. */
-#define R_MICROBLAZE_TLSDTPMOD32 25 /* TLS Module ID. */
-#define R_MICROBLAZE_TLSDTPREL32 26 /* TLS Offset Within TLS Block. */
-#define R_MICROBLAZE_TLSDTPREL64 27 /* TLS Offset Within TLS Block. */
-#define R_MICROBLAZE_TLSGOTTPREL32 28 /* TLS Offset From Thread Pointer. */
-#define R_MICROBLAZE_TLSTPREL32 29 /* TLS Offset From Thread Pointer. */
-
-/* Legal values for d_tag (dynamic entry type). */
-#define DT_NIOS2_GP 0x70000002 /* Address of _gp. */
-
-/* Nios II relocations. */
-#define R_NIOS2_NONE 0 /* No reloc. */
-#define R_NIOS2_S16 1 /* Direct signed 16 bit. */
-#define R_NIOS2_U16 2 /* Direct unsigned 16 bit. */
-#define R_NIOS2_PCREL16 3 /* PC relative 16 bit. */
-#define R_NIOS2_CALL26 4 /* Direct call. */
-#define R_NIOS2_IMM5 5 /* 5 bit constant expression. */
-#define R_NIOS2_CACHE_OPX 6 /* 5 bit expression, shift 22. */
-#define R_NIOS2_IMM6 7 /* 6 bit constant expression. */
-#define R_NIOS2_IMM8 8 /* 8 bit constant expression. */
-#define R_NIOS2_HI16 9 /* High 16 bit. */
-#define R_NIOS2_LO16 10 /* Low 16 bit. */
-#define R_NIOS2_HIADJ16 11 /* High 16 bit, adjusted. */
-#define R_NIOS2_BFD_RELOC_32 12 /* 32 bit symbol value + addend. */
-#define R_NIOS2_BFD_RELOC_16 13 /* 16 bit symbol value + addend. */
-#define R_NIOS2_BFD_RELOC_8 14 /* 8 bit symbol value + addend. */
-#define R_NIOS2_GPREL 15 /* 16 bit GP pointer offset. */
-#define R_NIOS2_GNU_VTINHERIT 16 /* GNU C++ vtable hierarchy. */
-#define R_NIOS2_GNU_VTENTRY 17 /* GNU C++ vtable member usage. */
-#define R_NIOS2_UJMP 18 /* Unconditional branch. */
-#define R_NIOS2_CJMP 19 /* Conditional branch. */
-#define R_NIOS2_CALLR 20 /* Indirect call through register. */
-#define R_NIOS2_ALIGN 21 /* Alignment requirement for
- linker relaxation. */
-#define R_NIOS2_GOT16 22 /* 16 bit GOT entry. */
-#define R_NIOS2_CALL16 23 /* 16 bit GOT entry for function. */
-#define R_NIOS2_GOTOFF_LO 24 /* %lo of offset to GOT pointer. */
-#define R_NIOS2_GOTOFF_HA 25 /* %hiadj of offset to GOT pointer. */
-#define R_NIOS2_PCREL_LO 26 /* %lo of PC relative offset. */
-#define R_NIOS2_PCREL_HA 27 /* %hiadj of PC relative offset. */
-#define R_NIOS2_TLS_GD16 28 /* 16 bit GOT offset for TLS GD. */
-#define R_NIOS2_TLS_LDM16 29 /* 16 bit GOT offset for TLS LDM. */
-#define R_NIOS2_TLS_LDO16 30 /* 16 bit module relative offset. */
-#define R_NIOS2_TLS_IE16 31 /* 16 bit GOT offset for TLS IE. */
-#define R_NIOS2_TLS_LE16 32 /* 16 bit LE TP-relative offset. */
-#define R_NIOS2_TLS_DTPMOD 33 /* Module number. */
-#define R_NIOS2_TLS_DTPREL 34 /* Module-relative offset. */
-#define R_NIOS2_TLS_TPREL 35 /* TP-relative offset. */
-#define R_NIOS2_COPY 36 /* Copy symbol at runtime. */
-#define R_NIOS2_GLOB_DAT 37 /* Create GOT entry. */
-#define R_NIOS2_JUMP_SLOT 38 /* Create PLT entry. */
-#define R_NIOS2_RELATIVE 39 /* Adjust by program base. */
-#define R_NIOS2_GOTOFF 40 /* 16 bit offset to GOT pointer. */
-#define R_NIOS2_CALL26_NOAT 41 /* Direct call in .noat section. */
-#define R_NIOS2_GOT_LO 42 /* %lo() of GOT entry. */
-#define R_NIOS2_GOT_HA 43 /* %hiadj() of GOT entry. */
-#define R_NIOS2_CALL_LO 44 /* %lo() of function GOT entry. */
-#define R_NIOS2_CALL_HA 45 /* %hiadj() of function GOT entry. */
-
-/* TILEPro relocations. */
-#define R_TILEPRO_NONE 0 /* No reloc */
-#define R_TILEPRO_32 1 /* Direct 32 bit */
-#define R_TILEPRO_16 2 /* Direct 16 bit */
-#define R_TILEPRO_8 3 /* Direct 8 bit */
-#define R_TILEPRO_32_PCREL 4 /* PC relative 32 bit */
-#define R_TILEPRO_16_PCREL 5 /* PC relative 16 bit */
-#define R_TILEPRO_8_PCREL 6 /* PC relative 8 bit */
-#define R_TILEPRO_LO16 7 /* Low 16 bit */
-#define R_TILEPRO_HI16 8 /* High 16 bit */
-#define R_TILEPRO_HA16 9 /* High 16 bit, adjusted */
-#define R_TILEPRO_COPY 10 /* Copy relocation */
-#define R_TILEPRO_GLOB_DAT 11 /* Create GOT entry */
-#define R_TILEPRO_JMP_SLOT 12 /* Create PLT entry */
-#define R_TILEPRO_RELATIVE 13 /* Adjust by program base */
-#define R_TILEPRO_BROFF_X1 14 /* X1 pipe branch offset */
-#define R_TILEPRO_JOFFLONG_X1 15 /* X1 pipe jump offset */
-#define R_TILEPRO_JOFFLONG_X1_PLT 16 /* X1 pipe jump offset to PLT */
-#define R_TILEPRO_IMM8_X0 17 /* X0 pipe 8-bit */
-#define R_TILEPRO_IMM8_Y0 18 /* Y0 pipe 8-bit */
-#define R_TILEPRO_IMM8_X1 19 /* X1 pipe 8-bit */
-#define R_TILEPRO_IMM8_Y1 20 /* Y1 pipe 8-bit */
-#define R_TILEPRO_MT_IMM15_X1 21 /* X1 pipe mtspr */
-#define R_TILEPRO_MF_IMM15_X1 22 /* X1 pipe mfspr */
-#define R_TILEPRO_IMM16_X0 23 /* X0 pipe 16-bit */
-#define R_TILEPRO_IMM16_X1 24 /* X1 pipe 16-bit */
-#define R_TILEPRO_IMM16_X0_LO 25 /* X0 pipe low 16-bit */
-#define R_TILEPRO_IMM16_X1_LO 26 /* X1 pipe low 16-bit */
-#define R_TILEPRO_IMM16_X0_HI 27 /* X0 pipe high 16-bit */
-#define R_TILEPRO_IMM16_X1_HI 28 /* X1 pipe high 16-bit */
-#define R_TILEPRO_IMM16_X0_HA 29 /* X0 pipe high 16-bit, adjusted */
-#define R_TILEPRO_IMM16_X1_HA 30 /* X1 pipe high 16-bit, adjusted */
-#define R_TILEPRO_IMM16_X0_PCREL 31 /* X0 pipe PC relative 16 bit */
-#define R_TILEPRO_IMM16_X1_PCREL 32 /* X1 pipe PC relative 16 bit */
-#define R_TILEPRO_IMM16_X0_LO_PCREL 33 /* X0 pipe PC relative low 16 bit */
-#define R_TILEPRO_IMM16_X1_LO_PCREL 34 /* X1 pipe PC relative low 16 bit */
-#define R_TILEPRO_IMM16_X0_HI_PCREL 35 /* X0 pipe PC relative high 16 bit */
-#define R_TILEPRO_IMM16_X1_HI_PCREL 36 /* X1 pipe PC relative high 16 bit */
-#define R_TILEPRO_IMM16_X0_HA_PCREL 37 /* X0 pipe PC relative ha() 16 bit */
-#define R_TILEPRO_IMM16_X1_HA_PCREL 38 /* X1 pipe PC relative ha() 16 bit */
-#define R_TILEPRO_IMM16_X0_GOT 39 /* X0 pipe 16-bit GOT offset */
-#define R_TILEPRO_IMM16_X1_GOT 40 /* X1 pipe 16-bit GOT offset */
-#define R_TILEPRO_IMM16_X0_GOT_LO 41 /* X0 pipe low 16-bit GOT offset */
-#define R_TILEPRO_IMM16_X1_GOT_LO 42 /* X1 pipe low 16-bit GOT offset */
-#define R_TILEPRO_IMM16_X0_GOT_HI 43 /* X0 pipe high 16-bit GOT offset */
-#define R_TILEPRO_IMM16_X1_GOT_HI 44 /* X1 pipe high 16-bit GOT offset */
-#define R_TILEPRO_IMM16_X0_GOT_HA 45 /* X0 pipe ha() 16-bit GOT offset */
-#define R_TILEPRO_IMM16_X1_GOT_HA 46 /* X1 pipe ha() 16-bit GOT offset */
-#define R_TILEPRO_MMSTART_X0 47 /* X0 pipe mm "start" */
-#define R_TILEPRO_MMEND_X0 48 /* X0 pipe mm "end" */
-#define R_TILEPRO_MMSTART_X1 49 /* X1 pipe mm "start" */
-#define R_TILEPRO_MMEND_X1 50 /* X1 pipe mm "end" */
-#define R_TILEPRO_SHAMT_X0 51 /* X0 pipe shift amount */
-#define R_TILEPRO_SHAMT_X1 52 /* X1 pipe shift amount */
-#define R_TILEPRO_SHAMT_Y0 53 /* Y0 pipe shift amount */
-#define R_TILEPRO_SHAMT_Y1 54 /* Y1 pipe shift amount */
-#define R_TILEPRO_DEST_IMM8_X1 55 /* X1 pipe destination 8-bit */
-/* Relocs 56-59 are currently not defined. */
-#define R_TILEPRO_TLS_GD_CALL 60 /* "jal" for TLS GD */
-#define R_TILEPRO_IMM8_X0_TLS_GD_ADD 61 /* X0 pipe "addi" for TLS GD */
-#define R_TILEPRO_IMM8_X1_TLS_GD_ADD 62 /* X1 pipe "addi" for TLS GD */
-#define R_TILEPRO_IMM8_Y0_TLS_GD_ADD 63 /* Y0 pipe "addi" for TLS GD */
-#define R_TILEPRO_IMM8_Y1_TLS_GD_ADD 64 /* Y1 pipe "addi" for TLS GD */
-#define R_TILEPRO_TLS_IE_LOAD 65 /* "lw_tls" for TLS IE */
-#define R_TILEPRO_IMM16_X0_TLS_GD 66 /* X0 pipe 16-bit TLS GD offset */
-#define R_TILEPRO_IMM16_X1_TLS_GD 67 /* X1 pipe 16-bit TLS GD offset */
-#define R_TILEPRO_IMM16_X0_TLS_GD_LO 68 /* X0 pipe low 16-bit TLS GD offset */
-#define R_TILEPRO_IMM16_X1_TLS_GD_LO 69 /* X1 pipe low 16-bit TLS GD offset */
-#define R_TILEPRO_IMM16_X0_TLS_GD_HI 70 /* X0 pipe high 16-bit TLS GD offset */
-#define R_TILEPRO_IMM16_X1_TLS_GD_HI 71 /* X1 pipe high 16-bit TLS GD offset */
-#define R_TILEPRO_IMM16_X0_TLS_GD_HA 72 /* X0 pipe ha() 16-bit TLS GD offset */
-#define R_TILEPRO_IMM16_X1_TLS_GD_HA 73 /* X1 pipe ha() 16-bit TLS GD offset */
-#define R_TILEPRO_IMM16_X0_TLS_IE 74 /* X0 pipe 16-bit TLS IE offset */
-#define R_TILEPRO_IMM16_X1_TLS_IE 75 /* X1 pipe 16-bit TLS IE offset */
-#define R_TILEPRO_IMM16_X0_TLS_IE_LO 76 /* X0 pipe low 16-bit TLS IE offset */
-#define R_TILEPRO_IMM16_X1_TLS_IE_LO 77 /* X1 pipe low 16-bit TLS IE offset */
-#define R_TILEPRO_IMM16_X0_TLS_IE_HI 78 /* X0 pipe high 16-bit TLS IE offset */
-#define R_TILEPRO_IMM16_X1_TLS_IE_HI 79 /* X1 pipe high 16-bit TLS IE offset */
-#define R_TILEPRO_IMM16_X0_TLS_IE_HA 80 /* X0 pipe ha() 16-bit TLS IE offset */
-#define R_TILEPRO_IMM16_X1_TLS_IE_HA 81 /* X1 pipe ha() 16-bit TLS IE offset */
-#define R_TILEPRO_TLS_DTPMOD32 82 /* ID of module containing symbol */
-#define R_TILEPRO_TLS_DTPOFF32 83 /* Offset in TLS block */
-#define R_TILEPRO_TLS_TPOFF32 84 /* Offset in static TLS block */
-#define R_TILEPRO_IMM16_X0_TLS_LE 85 /* X0 pipe 16-bit TLS LE offset */
-#define R_TILEPRO_IMM16_X1_TLS_LE 86 /* X1 pipe 16-bit TLS LE offset */
-#define R_TILEPRO_IMM16_X0_TLS_LE_LO 87 /* X0 pipe low 16-bit TLS LE offset */
-#define R_TILEPRO_IMM16_X1_TLS_LE_LO 88 /* X1 pipe low 16-bit TLS LE offset */
-#define R_TILEPRO_IMM16_X0_TLS_LE_HI 89 /* X0 pipe high 16-bit TLS LE offset */
-#define R_TILEPRO_IMM16_X1_TLS_LE_HI 90 /* X1 pipe high 16-bit TLS LE offset */
-#define R_TILEPRO_IMM16_X0_TLS_LE_HA 91 /* X0 pipe ha() 16-bit TLS LE offset */
-#define R_TILEPRO_IMM16_X1_TLS_LE_HA 92 /* X1 pipe ha() 16-bit TLS LE offset */
-
-#define R_TILEPRO_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */
-#define R_TILEPRO_GNU_VTENTRY 129 /* GNU C++ vtable member usage */
-
-#define R_TILEPRO_NUM 130
-
-
-/* TILE-Gx relocations. */
-#define R_TILEGX_NONE 0 /* No reloc */
-#define R_TILEGX_64 1 /* Direct 64 bit */
-#define R_TILEGX_32 2 /* Direct 32 bit */
-#define R_TILEGX_16 3 /* Direct 16 bit */
-#define R_TILEGX_8 4 /* Direct 8 bit */
-#define R_TILEGX_64_PCREL 5 /* PC relative 64 bit */
-#define R_TILEGX_32_PCREL 6 /* PC relative 32 bit */
-#define R_TILEGX_16_PCREL 7 /* PC relative 16 bit */
-#define R_TILEGX_8_PCREL 8 /* PC relative 8 bit */
-#define R_TILEGX_HW0 9 /* hword 0 16-bit */
-#define R_TILEGX_HW1 10 /* hword 1 16-bit */
-#define R_TILEGX_HW2 11 /* hword 2 16-bit */
-#define R_TILEGX_HW3 12 /* hword 3 16-bit */
-#define R_TILEGX_HW0_LAST 13 /* last hword 0 16-bit */
-#define R_TILEGX_HW1_LAST 14 /* last hword 1 16-bit */
-#define R_TILEGX_HW2_LAST 15 /* last hword 2 16-bit */
-#define R_TILEGX_COPY 16 /* Copy relocation */
-#define R_TILEGX_GLOB_DAT 17 /* Create GOT entry */
-#define R_TILEGX_JMP_SLOT 18 /* Create PLT entry */
-#define R_TILEGX_RELATIVE 19 /* Adjust by program base */
-#define R_TILEGX_BROFF_X1 20 /* X1 pipe branch offset */
-#define R_TILEGX_JUMPOFF_X1 21 /* X1 pipe jump offset */
-#define R_TILEGX_JUMPOFF_X1_PLT 22 /* X1 pipe jump offset to PLT */
-#define R_TILEGX_IMM8_X0 23 /* X0 pipe 8-bit */
-#define R_TILEGX_IMM8_Y0 24 /* Y0 pipe 8-bit */
-#define R_TILEGX_IMM8_X1 25 /* X1 pipe 8-bit */
-#define R_TILEGX_IMM8_Y1 26 /* Y1 pipe 8-bit */
-#define R_TILEGX_DEST_IMM8_X1 27 /* X1 pipe destination 8-bit */
-#define R_TILEGX_MT_IMM14_X1 28 /* X1 pipe mtspr */
-#define R_TILEGX_MF_IMM14_X1 29 /* X1 pipe mfspr */
-#define R_TILEGX_MMSTART_X0 30 /* X0 pipe mm "start" */
-#define R_TILEGX_MMEND_X0 31 /* X0 pipe mm "end" */
-#define R_TILEGX_SHAMT_X0 32 /* X0 pipe shift amount */
-#define R_TILEGX_SHAMT_X1 33 /* X1 pipe shift amount */
-#define R_TILEGX_SHAMT_Y0 34 /* Y0 pipe shift amount */
-#define R_TILEGX_SHAMT_Y1 35 /* Y1 pipe shift amount */
-#define R_TILEGX_IMM16_X0_HW0 36 /* X0 pipe hword 0 */
-#define R_TILEGX_IMM16_X1_HW0 37 /* X1 pipe hword 0 */
-#define R_TILEGX_IMM16_X0_HW1 38 /* X0 pipe hword 1 */
-#define R_TILEGX_IMM16_X1_HW1 39 /* X1 pipe hword 1 */
-#define R_TILEGX_IMM16_X0_HW2 40 /* X0 pipe hword 2 */
-#define R_TILEGX_IMM16_X1_HW2 41 /* X1 pipe hword 2 */
-#define R_TILEGX_IMM16_X0_HW3 42 /* X0 pipe hword 3 */
-#define R_TILEGX_IMM16_X1_HW3 43 /* X1 pipe hword 3 */
-#define R_TILEGX_IMM16_X0_HW0_LAST 44 /* X0 pipe last hword 0 */
-#define R_TILEGX_IMM16_X1_HW0_LAST 45 /* X1 pipe last hword 0 */
-#define R_TILEGX_IMM16_X0_HW1_LAST 46 /* X0 pipe last hword 1 */
-#define R_TILEGX_IMM16_X1_HW1_LAST 47 /* X1 pipe last hword 1 */
-#define R_TILEGX_IMM16_X0_HW2_LAST 48 /* X0 pipe last hword 2 */
-#define R_TILEGX_IMM16_X1_HW2_LAST 49 /* X1 pipe last hword 2 */
-#define R_TILEGX_IMM16_X0_HW0_PCREL 50 /* X0 pipe PC relative hword 0 */
-#define R_TILEGX_IMM16_X1_HW0_PCREL 51 /* X1 pipe PC relative hword 0 */
-#define R_TILEGX_IMM16_X0_HW1_PCREL 52 /* X0 pipe PC relative hword 1 */
-#define R_TILEGX_IMM16_X1_HW1_PCREL 53 /* X1 pipe PC relative hword 1 */
-#define R_TILEGX_IMM16_X0_HW2_PCREL 54 /* X0 pipe PC relative hword 2 */
-#define R_TILEGX_IMM16_X1_HW2_PCREL 55 /* X1 pipe PC relative hword 2 */
-#define R_TILEGX_IMM16_X0_HW3_PCREL 56 /* X0 pipe PC relative hword 3 */
-#define R_TILEGX_IMM16_X1_HW3_PCREL 57 /* X1 pipe PC relative hword 3 */
-#define R_TILEGX_IMM16_X0_HW0_LAST_PCREL 58 /* X0 pipe PC-rel last hword 0 */
-#define R_TILEGX_IMM16_X1_HW0_LAST_PCREL 59 /* X1 pipe PC-rel last hword 0 */
-#define R_TILEGX_IMM16_X0_HW1_LAST_PCREL 60 /* X0 pipe PC-rel last hword 1 */
-#define R_TILEGX_IMM16_X1_HW1_LAST_PCREL 61 /* X1 pipe PC-rel last hword 1 */
-#define R_TILEGX_IMM16_X0_HW2_LAST_PCREL 62 /* X0 pipe PC-rel last hword 2 */
-#define R_TILEGX_IMM16_X1_HW2_LAST_PCREL 63 /* X1 pipe PC-rel last hword 2 */
-#define R_TILEGX_IMM16_X0_HW0_GOT 64 /* X0 pipe hword 0 GOT offset */
-#define R_TILEGX_IMM16_X1_HW0_GOT 65 /* X1 pipe hword 0 GOT offset */
-#define R_TILEGX_IMM16_X0_HW0_PLT_PCREL 66 /* X0 pipe PC-rel PLT hword 0 */
-#define R_TILEGX_IMM16_X1_HW0_PLT_PCREL 67 /* X1 pipe PC-rel PLT hword 0 */
-#define R_TILEGX_IMM16_X0_HW1_PLT_PCREL 68 /* X0 pipe PC-rel PLT hword 1 */
-#define R_TILEGX_IMM16_X1_HW1_PLT_PCREL 69 /* X1 pipe PC-rel PLT hword 1 */
-#define R_TILEGX_IMM16_X0_HW2_PLT_PCREL 70 /* X0 pipe PC-rel PLT hword 2 */
-#define R_TILEGX_IMM16_X1_HW2_PLT_PCREL 71 /* X1 pipe PC-rel PLT hword 2 */
-#define R_TILEGX_IMM16_X0_HW0_LAST_GOT 72 /* X0 pipe last hword 0 GOT offset */
-#define R_TILEGX_IMM16_X1_HW0_LAST_GOT 73 /* X1 pipe last hword 0 GOT offset */
-#define R_TILEGX_IMM16_X0_HW1_LAST_GOT 74 /* X0 pipe last hword 1 GOT offset */
-#define R_TILEGX_IMM16_X1_HW1_LAST_GOT 75 /* X1 pipe last hword 1 GOT offset */
-#define R_TILEGX_IMM16_X0_HW3_PLT_PCREL 76 /* X0 pipe PC-rel PLT hword 3 */
-#define R_TILEGX_IMM16_X1_HW3_PLT_PCREL 77 /* X1 pipe PC-rel PLT hword 3 */
-#define R_TILEGX_IMM16_X0_HW0_TLS_GD 78 /* X0 pipe hword 0 TLS GD offset */
-#define R_TILEGX_IMM16_X1_HW0_TLS_GD 79 /* X1 pipe hword 0 TLS GD offset */
-#define R_TILEGX_IMM16_X0_HW0_TLS_LE 80 /* X0 pipe hword 0 TLS LE offset */
-#define R_TILEGX_IMM16_X1_HW0_TLS_LE 81 /* X1 pipe hword 0 TLS LE offset */
-#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE 82 /* X0 pipe last hword 0 LE off */
-#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE 83 /* X1 pipe last hword 0 LE off */
-#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE 84 /* X0 pipe last hword 1 LE off */
-#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE 85 /* X1 pipe last hword 1 LE off */
-#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD 86 /* X0 pipe last hword 0 GD off */
-#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD 87 /* X1 pipe last hword 0 GD off */
-#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD 88 /* X0 pipe last hword 1 GD off */
-#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD 89 /* X1 pipe last hword 1 GD off */
-/* Relocs 90-91 are currently not defined. */
-#define R_TILEGX_IMM16_X0_HW0_TLS_IE 92 /* X0 pipe hword 0 TLS IE offset */
-#define R_TILEGX_IMM16_X1_HW0_TLS_IE 93 /* X1 pipe hword 0 TLS IE offset */
-#define R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL 94 /* X0 pipe PC-rel PLT last hword 0 */
-#define R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL 95 /* X1 pipe PC-rel PLT last hword 0 */
-#define R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL 96 /* X0 pipe PC-rel PLT last hword 1 */
-#define R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL 97 /* X1 pipe PC-rel PLT last hword 1 */
-#define R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL 98 /* X0 pipe PC-rel PLT last hword 2 */
-#define R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL 99 /* X1 pipe PC-rel PLT last hword 2 */
-#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE 100 /* X0 pipe last hword 0 IE off */
-#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE 101 /* X1 pipe last hword 0 IE off */
-#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE 102 /* X0 pipe last hword 1 IE off */
-#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE 103 /* X1 pipe last hword 1 IE off */
-/* Relocs 104-105 are currently not defined. */
-#define R_TILEGX_TLS_DTPMOD64 106 /* 64-bit ID of symbol's module */
-#define R_TILEGX_TLS_DTPOFF64 107 /* 64-bit offset in TLS block */
-#define R_TILEGX_TLS_TPOFF64 108 /* 64-bit offset in static TLS block */
-#define R_TILEGX_TLS_DTPMOD32 109 /* 32-bit ID of symbol's module */
-#define R_TILEGX_TLS_DTPOFF32 110 /* 32-bit offset in TLS block */
-#define R_TILEGX_TLS_TPOFF32 111 /* 32-bit offset in static TLS block */
-#define R_TILEGX_TLS_GD_CALL 112 /* "jal" for TLS GD */
-#define R_TILEGX_IMM8_X0_TLS_GD_ADD 113 /* X0 pipe "addi" for TLS GD */
-#define R_TILEGX_IMM8_X1_TLS_GD_ADD 114 /* X1 pipe "addi" for TLS GD */
-#define R_TILEGX_IMM8_Y0_TLS_GD_ADD 115 /* Y0 pipe "addi" for TLS GD */
-#define R_TILEGX_IMM8_Y1_TLS_GD_ADD 116 /* Y1 pipe "addi" for TLS GD */
-#define R_TILEGX_TLS_IE_LOAD 117 /* "ld_tls" for TLS IE */
-#define R_TILEGX_IMM8_X0_TLS_ADD 118 /* X0 pipe "addi" for TLS GD/IE */
-#define R_TILEGX_IMM8_X1_TLS_ADD 119 /* X1 pipe "addi" for TLS GD/IE */
-#define R_TILEGX_IMM8_Y0_TLS_ADD 120 /* Y0 pipe "addi" for TLS GD/IE */
-#define R_TILEGX_IMM8_Y1_TLS_ADD 121 /* Y1 pipe "addi" for TLS GD/IE */
-
-#define R_TILEGX_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */
-#define R_TILEGX_GNU_VTENTRY 129 /* GNU C++ vtable member usage */
-
-#define R_TILEGX_NUM 130
-
-
-__END_DECLS
-
-#endif /* elf.h */
diff --git a/src/execstack.c b/src/execstack.c
index dda6bc7..97fb453 100644
--- a/src/execstack.c
+++ b/src/execstack.c
@@ -116,7 +116,7 @@ execstack_make_rdwr (DSO *dso, int flag)
header we've created. */
sprintf (filename, "%s.#execstack#.XXXXXX", dso->filename);
- fd = wrap_mkstemp (filename);
+ fd = mkstemp (filename);
if (fd == -1)
{
error (0, 0, "%s: Cannot create temporary file",
@@ -197,7 +197,7 @@ execstack_make_rdwr (DSO *dso, int flag)
ndso->filename = p;
p = NULL;
- wrap_unlink (filename);
+ unlink (filename);
fsync (fd);
close (fd);
fd = -1;
@@ -210,7 +210,7 @@ error_out:
close_dso (ndso);
if (fd != -1)
{
- wrap_unlink (filename);
+ unlink (filename);
fsync (fd);
close (fd);
}
diff --git a/src/gather.c b/src/gather.c
index 751822c..277f1b5 100644
--- a/src/gather.c
+++ b/src/gather.c
@@ -61,7 +61,7 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
{
int i, j, seen = 0;
FILE *f = NULL;
- const char *argv[8];
+ const char *argv[5];
const char *envp[5];
char *line = NULL, *p, *q = NULL;
const char **depends = NULL, **depends_temp;
@@ -144,6 +144,11 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
i = 0;
argv[i++] = dl;
+ if (ld_library_path)
+ {
+ argv[i++] = "--library-path";
+ argv[i++] = ld_library_path;
+ }
if (strchr (ent->filename, '/') != NULL)
ent_filename = ent->filename;
else
@@ -155,69 +160,23 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
ent_filename = tp;
}
- if (prelink_rtld == NULL)
+ argv[i++] = ent_filename;
+ argv[i] = NULL;
+
+ j = 0;
+ if(etype == ET_EXEC && ld_preload)
{
- i = 0;
- argv[i++] = dl;
- if (ld_library_path)
- {
- argv[i++] = "--library-path";
- argv[i++] = ld_library_path;
- }
- argv[i++] = ent_filename;
- argv[i] = NULL;
-
- j = 0;
- if(etype == ET_EXEC && ld_preload)
- {
- p = alloca (sizeof "LD_PRELOAD=" + strlen (ld_preload) + 1);
- strcpy (stpcpy (p, "LD_PRELOAD="), ld_preload);
- envp[j++] = p;
- }
-
- envp[j++] = "LD_TRACE_LOADED_OBJECTS=1";
- envp[j++] = "LD_TRACE_PRELINKING=1";
- envp[j++] = "LD_WARN=";
- envp[j] = NULL;
-
- f = execve_open (dl, (char * const *)argv, (char * const *)envp);
+ p = alloca (sizeof "LD_PRELOAD=" + strlen (ld_preload) + 1);
+ strcpy (stpcpy (p, "LD_PRELOAD="), ld_preload);
+ envp[j++] = p;
}
- else
- {
- char *path;
- i = 0;
- argv[i++] = prelink_rtld;
- if (ld_library_path)
- {
- argv[i++] = "--library-path";
- argv[i++] = ld_library_path;
- }
-
- if(etype == ET_EXEC && ld_preload) {
- argv[i++] = "--ld-preload";
- argv[i++] = ld_preload;
- }
- argv[i++] = "--target-paths";
- argv[i++] = ent_filename;
- argv[i] = NULL;
- envp[0] = "RTLD_TRACE_PRELINKING=1";
- envp[1] = "RTLD_WARN=";
- path = alloca (sizeof "PATH=" + strlen (getenv ("PATH")));
- sprintf (path, "PATH=%s", getenv ("PATH"));
- envp[2] = path;
-
- if (sysroot)
- {
- envp[3] = alloca (sizeof "PRELINK_SYSROOT=" + strlen (sysroot));
- sprintf ((char *) envp[3], "PRELINK_SYSROOT=%s", sysroot);
- envp[4] = NULL;
- }
- else
- envp[3] = NULL;
- f = execve_open (prelink_rtld, (char * const *)argv, (char * const *)envp);
- }
+ envp[j++] = "LD_TRACE_LOADED_OBJECTS=1";
+ envp[j++] = "LD_TRACE_PRELINKING=1";
+ envp[j++] = "LD_WARN=";
+ envp[j] = NULL;
+ f = execve_open (dl, (char * const *)argv, (char * const *)envp);
if (f == NULL)
goto error_out;
@@ -826,7 +785,7 @@ gather_func (const char *name, const struct stat64 *st, int type,
if (st->st_size < sizeof (e_ident))
return FTW_CONTINUE;
- fd = wrap_open (name, O_RDONLY);
+ fd = open (name, O_RDONLY);
if (fd == -1)
return FTW_CONTINUE;
@@ -984,7 +943,7 @@ gather_binlib (const char *name, const struct stat64 *st)
return 0;
}
- fd = wrap_open (name, O_RDONLY);
+ fd = open (name, O_RDONLY);
if (fd == -1)
{
error (0, errno, "Could not open %s", name);
@@ -1075,7 +1034,7 @@ gather_object (const char *name, int deref, int onefs)
{
struct stat64 st;
- if (wrap_stat64 (name, &st) < 0)
+ if (stat64 (name, &st) < 0)
{
if (implicit)
return 0;
@@ -1098,7 +1057,7 @@ gather_object (const char *name, int deref, int onefs)
if (!all && implicit && ! deref)
return 0;
++implicit;
- ret = wrap_nftw64 (name, gather_func, 20, flags | FTW_ACTIONRETVAL);
+ ret = nftw64 (name, gather_func, 20, flags | FTW_ACTIONRETVAL);
--implicit;
if (ret < 0)
error (0, errno, "Failed searching %s", name);
@@ -1154,7 +1113,7 @@ read_config (const char *config)
glob_t g;
p += 2 + strspn (p + 2, " \t");
- if (!wrap_glob (p, GLOB_BRACE, NULL, &g))
+ if (!glob (p, GLOB_BRACE, NULL, &g))
{
size_t n;
@@ -1236,7 +1195,7 @@ gather_config (void)
{
glob_t g;
- if (!wrap_glob (p, GLOB_BRACE, NULL, &g))
+ if (!glob (p, GLOB_BRACE, NULL, &g))
{
size_t n;
@@ -1361,7 +1320,7 @@ add_to_blacklist (const char *name, int deref, int onefs)
size_t len;
struct stat64 st;
- if (wrap_stat64 (name, &st) < 0)
+ if (stat64 (name, &st) < 0)
{
if (implicit)
return 0;
@@ -1480,7 +1439,7 @@ blacklist_from_config (void)
{
glob_t g;
- if (!wrap_glob (p, GLOB_BRACE | GLOB_PERIOD, NULL, &g))
+ if (!glob (p, GLOB_BRACE | GLOB_PERIOD, NULL, &g))
{
size_t n;
diff --git a/src/get.c b/src/get.c
index 4db1ae2..0659962 100644
--- a/src/get.c
+++ b/src/get.c
@@ -167,7 +167,7 @@ prelink_record_relocations (struct prelink_info *info, FILE *f,
{
struct stat64 st;
- if (wrap_stat64 (filename, &st) < 0)
+ if (stat64 (filename, &st) < 0)
{
error (0, errno, "%s: Could not stat %s",
info->ent->filename, filename);
@@ -642,7 +642,7 @@ prelink_get_relocations (struct prelink_info *info)
{
FILE *f;
DSO *dso = info->dso;
- const char *argv[8];
+ const char *argv[5];
const char *envp[5];
int i, j, ret, status;
char *p;
@@ -672,6 +672,13 @@ prelink_get_relocations (struct prelink_info *info)
/ info->symtab_entsize;
info->symbols = calloc (sizeof (struct prelink_symbol), info->symbol_count);
+ i = 0;
+ argv[i++] = dl;
+ if (ld_library_path)
+ {
+ argv[i++] = "--library-path";
+ argv[i++] = ld_library_path;
+ }
if (strchr (info->ent->filename, '/') != NULL)
ent_filename = info->ent->filename;
else
@@ -682,71 +689,25 @@ prelink_get_relocations (struct prelink_info *info)
memcpy (p + 2, info->ent->filename, flen + 1);
ent_filename = p;
}
- if (prelink_rtld == NULL)
- {
- i = 0;
- argv[i++] = dl;
- if (ld_library_path)
- {
- argv[i++] = "--library-path";
- argv[i++] = ld_library_path;
- }
- argv[i++] = ent_filename;
- argv[i] = NULL;
-
- j = 0;
- if(etype == ET_EXEC && ld_preload)
- {
- p = alloca (sizeof "LD_PRELOAD=" + strlen (ld_preload));
- strcpy (stpcpy (p, "LD_PRELOAD="), ld_preload);
- envp[j++] = p;
- }
- envp[j++] = "LD_TRACE_LOADED_OBJECTS=1";
- envp[j++] = "LD_BIND_NOW=1";
- p = alloca (sizeof "LD_TRACE_PRELINKING=" + strlen (info->ent->filename));
- strcpy (stpcpy (p, "LD_TRACE_PRELINKING="), info->ent->filename);
- envp[j++] = p;
- envp[j] = NULL;
+ argv[i++] = ent_filename;
+ argv[i] = NULL;
- ret = 2;
- f = execve_open (dl, (char * const *)argv, (char * const *)envp);
- }
- else
+ j = 0;
+ if(etype == ET_EXEC && ld_preload)
{
- i = 0;
- argv[i++] = prelink_rtld;
- if (ld_library_path)
- {
- argv[i++] = "--library-path";
- argv[i++] = ld_library_path;
- }
-
- if(etype == ET_EXEC && ld_preload) {
- argv[i++] = "--ld-preload";
- argv[i++] = ld_preload;
- }
-
- argv[i++] = "--target-paths";
- argv[i++] = ent_filename;
- argv[i] = NULL;
- p = alloca (sizeof "RTLD_TRACE_PRELINKING=" + strlen (info->ent->filename));
- strcpy (stpcpy (p, "RTLD_TRACE_PRELINKING="), info->ent->filename);
- envp[0] = p;
- p = alloca (sizeof "PATH=" + strlen (getenv ("PATH")));
- sprintf (p, "PATH=%s", getenv ("PATH"));
- envp[1] = p;
- envp[2] = NULL;
- if (sysroot)
- {
- p = alloca (sizeof "PRELINK_SYSROOT=" + strlen (sysroot));
- sprintf (p, "PRELINK_SYSROOT=%s", sysroot);
- envp[2] = p;
- envp[3] = NULL;
- }
- ret = 2;
- f = execve_open (prelink_rtld, (char * const *)argv, (char * const *)envp);
+ p = alloca (sizeof "LD_PRELOAD=" + strlen (ld_preload));
+ strcpy (stpcpy (p, "LD_PRELOAD="), ld_preload);
+ envp[j++] = p;
}
-
+ envp[j++] = "LD_TRACE_LOADED_OBJECTS=1";
+ envp[j++] = "LD_BIND_NOW=1";
+ p = alloca (sizeof "LD_TRACE_PRELINKING=" + strlen (info->ent->filename));
+ strcpy (stpcpy (p, "LD_TRACE_PRELINKING="), info->ent->filename);
+ envp[j++] = p;
+ envp[j] = NULL;
+
+ ret = 2;
+ f = execve_open (dl, (char * const *)argv, (char * const *)envp);
if (f == NULL)
{
error (0, errno, "%s: Could not trace symbol resolving",
diff --git a/src/main.c b/src/main.c
index c879d62..0cea86d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -82,10 +82,8 @@ static char argp_doc[] = PRELINK_PROG " -- program to relocate and prelink ELF s
#define OPT_SHA 0x8a
#define OPT_COMPUTE_CHECKSUM 0x8b
#define OPT_LAYOUT_PAGE_SIZE 0x8c
-#define OPT_SYSROOT 0x8d
-#define OPT_RTLD 0x8e
-#define OPT_ALLOW_TEXTREL 0x8f
-#define OPT_LD_PRELOAD 0x90
+#define OPT_ALLOW_TEXTREL 0x8d
+#define OPT_LD_PRELOAD 0x8e
static struct argp_option options[] = {
{"all", 'a', 0, 0, "Prelink all binaries" },
@@ -103,7 +101,6 @@ static struct argp_option options[] = {
{"quick", 'q', 0, 0, "Quick scan" },
{"random", 'R', 0, 0, "Choose random base for libraries" },
{"reloc-only", 'r', "BASE_ADDRESS", 0, "Relocate library to given address, don't prelink" },
- {"root", OPT_SYSROOT, "ROOT_PATH", 0, "Prefix all paths with ROOT_PATH" },
{"undo", 'u', 0, 0, "Undo prelink" },
{"verbose", 'v', 0, 0, "Produce verbose output" },
{"verify", 'y', 0, 0, "Verify file consistency by undoing and redoing prelink and printing original to standard output" },
@@ -123,7 +120,6 @@ static struct argp_option options[] = {
{"mmap-region-end", OPT_MMAP_REG_END, "BASE_ADDRESS", OPTION_HIDDEN, "" },
{"seed", OPT_SEED, "SEED", OPTION_HIDDEN, "" },
{"compute-checksum", OPT_COMPUTE_CHECKSUM, 0, OPTION_HIDDEN, "" },
- {"rtld", OPT_RTLD, "RTLD", OPTION_HIDDEN, "" },
{"init", 'i', 0, 0, "Do not re-execute init" },
{"allow-textrel", OPT_ALLOW_TEXTREL, 0, 0, "Allow text relocations even on architectures where they may not work" },
{ 0 }
@@ -241,12 +237,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
layout_page_size = strtoull (arg, &endarg, 0);
if (endarg != strchr (arg, '\0') || (layout_page_size & (layout_page_size - 1)))
error (EXIT_FAILURE, 0, "--layout-page-size option requires numberic power-of-two argument");
- case OPT_SYSROOT:
- sysroot = arg;
- break;
- case OPT_RTLD:
- prelink_rtld = arg;
- break;
case 'i':
noreexecinit=1;
break;
@@ -278,8 +268,6 @@ void checkinit() {
static struct argp argp = { options, parse_opt, "[FILES]", argp_doc };
-const char *prelink_rtld = NULL;
-
/* Disable detection, this is not appropriate when cross prelinking. */
#if 0 && (defined (__i386__) || defined (__x86_64__)) && defined (__GNUC__)
static void
@@ -358,38 +346,12 @@ main (int argc, char *argv[])
/* Set the default for exec_shield. */
if (exec_shield == 2)
{
- if (sysroot == NULL && ! access ("/proc/sys/kernel/exec-shield", F_OK))
+ if (! access ("/proc/sys/kernel/exec-shield", F_OK))
exec_shield = 1;
else
exec_shield = 0;
}
-#ifdef DEFAULT_SYSROOT
- if (sysroot == NULL)
- {
- extern char *make_relative_prefix (const char *, const char *, const char *);
- sysroot = make_relative_prefix (argv[0], BINDIR, DEFAULT_SYSROOT);
- }
-#endif
-
- if (sysroot)
- {
- sysroot = canonicalize_file_name (sysroot);
- if (sysroot == NULL)
- error (EXIT_FAILURE, 0, "Could not canonicalize --root argument");
- asprintf ((char **) &prelink_conf, "%s%s", sysroot, prelink_conf);
- }
- if (prelink_rtld != NULL && prelink_rtld[0] == 0)
- prelink_rtld = NULL;
- else
- if (prelink_rtld == NULL)
- {
- extern char *make_relative_prefix (const char *, const char *, const char *);
- const char *path = make_relative_prefix (argv[0], BINDIR, BINDIR);
- asprintf ((char **) &prelink_rtld, "%s/%s", path,
- PRELINK_RTLD_PROG EXEEXT);
- }
-
if (print_cache)
{
prelink_load_cache ();
diff --git a/src/prelink.h b/src/prelink.h
index de757df..93dbf7a 100644
--- a/src/prelink.h
+++ b/src/prelink.h
@@ -604,33 +604,6 @@ extern long long seed;
extern GElf_Addr mmap_reg_start, mmap_reg_end, layout_page_size;
extern char *ld_preload;
-extern const char *sysroot;
-
extern int allow_bad_textrel;
-int wrap_readlink (const char *path, char *buf, int len);
-int wrap_lstat64 (const char *file, struct stat64 *buf);
-int wrap_stat64 (const char *file, struct stat64 *buf);
-int wrap_open (const char *file, int mode, ...);
-int wrap_access (const char *file, int mode);
-int wrap_rename (const char *old, const char *new);
-int wrap_link (const char *old, const char *new);
-int wrap_nftw64 (const char *dir, __nftw64_func_t func,
- int descriptors, int flag);
-int wrap_utime (const char *file, struct utimbuf *file_times);
-int wrap_mkstemp (char *filename);
-int wrap_unlink (const char *filename);
-ssize_t wrap_listxattr (const char *path, char *list, size_t size);
-ssize_t wrap_getxattr (const char *path, const char *name, void *value,
- size_t size);
-int wrap_setxattr (const char *path, const char *name, const void *value,
- size_t size, int flags);
-int wrap_glob (const char *pattern, int flags,
- int (*errfunc) (const char *epath, int eerrno),
- glob_t *pglob);
-
-char *sysroot_file_name (const char *name, int allow_last_link);
-
-extern const char *prelink_rtld;
-
#endif /* PRELINK_H */
diff --git a/src/rtld/COPYING b/src/rtld/COPYING
deleted file mode 100644
index d159169..0000000
--- a/src/rtld/COPYING
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 of the License, 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.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/src/rtld/COPYING.LIB b/src/rtld/COPYING.LIB
deleted file mode 100644
index 4362b49..0000000
--- a/src/rtld/COPYING.LIB
+++ /dev/null
@@ -1,502 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/src/rtld/ChangeLog b/src/rtld/ChangeLog
deleted file mode 100644
index c53c6dd..0000000
--- a/src/rtld/ChangeLog
+++ /dev/null
@@ -1,296 +0,0 @@
-2016-03-18 Donn Seeley <donn.seeley@windriver.com>
- * rtld.c: rewrite build_local_scope to ensure breadth-first
- processing
-
-2016-03-18 Mark Hatle <mark.hatle@windriver.com>
- * dl-open.c, rtld.h, Makefile.am: Add _dl_show_scope function
- * rtld.c: Use _dl_show_scope if RTLD_DEBUG=scopes defined
- Generate a scope for the exectuable
- * rtld.h, ../dso.c: Fix compilation warning
-
-
-2016-03-10 Mark Hatle <mark.hatle@windriver.com>
- * rtld/: Rsync to glibc-2.23 (no functional changes)
- * dl-load.c: Fix segfault on empty dso entry
-
-2015-10-28 Mark Hatle <mark.hatle@windriver.com>
- * dl-lookupX.h: Sync with glibc fix for ld.so / prelink mismatch
-
- 2015-10-28 H.J. Lu <hongjiu.lu@intel.com>
-
- [BZ #19178]
- * elf/dl-lookup.c (RTYPE_CLASS_VALID): New.
- (RTYPE_CLASS_PLT): Likewise.
- (RTYPE_CLASS_COPY): Likewise.
- (RTYPE_CLASS_TLS): Likewise.
- (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID
- to set relocation type class for DL_DEBUG_PRELINK. Clear the
- ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA bit for DL_DEBUG_PRELINK.
-
-2015-10-21 Mark Hatle <mark.hatle@windriver.com>
- * rtld/: Resync to glibc-2.22
- * rtld/*: Update copyright dates to match glibc-2.22
- * rtld/rtld.c: Update the elf_machine_type class entries
- Add support for ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA via
- new extern_protected_data function.
- rename reloc_typeclass to elf_machine_type_class
- add machine_no_rela, machine_no_rel funcs
- Update debug msg
- Fix missing dso_list->map = NULL
- * rtld/dl-tls.c: (rtld_determine_tlsoffsets) add NIOS2 definition
- * rtld/dl-lookup.c: Add EXTERN_PROTECTED_DATA support
- * rtld/dl-lookupX.h: Add EXTERN_PROTECTED_DATA support
- update debug msgs
- * rtld/dl-load.c: (create_map_object_from_dso_ent) Add ld.so like debug
- When an executable sets a load address use it
- Update the load address calculation, prevents visual overlaps
- * rtld/dl-version.c: update debug msgs
- * rtld/rtld.h: define _dl_debug_printf to act like ld.so debug
- define RTLD_DEBUG_PID to set the debug prefix
-
- * glibc changes directly affecting the implementation:
-
- 2013-12-04 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
- Alan Modra <amodra@gmail.com>
- * libc/sysdeps/powerpc/powerpc64/dl-machine.h
- (elf_machine_type_class): Use SHN_UNDEF PLT handling for ELFv2 ABI.
-
- 2015-01-18 Chung-Lin Tang <cltang@codesourcery.com>
- Sandra Loosemore <sandra@codesourcery.com>
- Andrew Jenner <andrew@codesourcery.com>
- Joseph Myers <joseph@codesourcery.com>
- Nathan Sidwell <nathan@codesourcery.com>
- * sysdeps/nios2/dl-machine.h: New file.
-
- 2015-03-31 H.J. Lu <hongjiu.lu@intel.com>
- * elf/dl-lookup.c (do_lookup_x): When UNDEF_MAP is NULL, which
- indicates it is called from do_lookup_x on relocation against
- protected data, skip the data definion in the executable from
- copy reloc.
- (_dl_lookup_symbol_x): Pass ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA,
- instead of ELF_RTYPE_CLASS_PLT, to do_lookup_x for
- EXTERN_PROTECTED_DATA relocation against STT_OBJECT symbol.
- * sysdeps/i386/dl-machine.h (elf_machine_type_class): Set class
- to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for R_386_GLOB_DAT.
- * sysdeps/x86_64/dl-machine.h (elf_machine_type_class): Set class
- to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for R_X86_64_GLOB_DAT.
-
- 2015-07-24 Szabolcs Nagy <szabolcs.nagy@arm.com>
- * sysdeps/aarch64/dl-machine.h (elf_machine_type_class): Handle
- ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA.
- * sysdeps/arm/dl-machine.h (elf_machine_type_class): Handle
- ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA.
-
-2015-09-11 Vaneet Narang <v.narang@samsung.com>
- * rtld/rtld.c: Add ability to specify preloaded libraries
-
-2015-09-09 Maninder Singh <maninder1.s@samsung.com>
- Mark Hatle <mark.hatle@windriver.com>
- * rtld/rtld.c: dso null pointer check fix
-
-2015-04-06 Mark Hatle <mark.hatle@windriver.com>
- Maninder Singh <maninder1.s@samsung.com>
- * rtld/dl-version.c: Add debug for mising ld-linux or libc.so
-
-2014-12-10 Mark Hatle <mark.hatle@windriver.com>
- * rtld/rtld.c: Sync aarch64 elf_machine_type_class (dl-machine.h)
- (do_relocs): fix comparison pltrel_end >= rel_end
- * rtld/dl-tls.c: Add basic aarch64 support
-
-2014-12-10 Mark Hatle <mark.hatle@windriver.com>
- * rtld/: Resync to glibc-2.20
- Replace referenced to GLRO_dl_debug_mask to
- GLRO(dl_debug_mask)
-
- * rtld/rtld.h: Sync DL_DEBUG_* defines from ldsodefs.h
- add DSO_FILENAME and RTLD_PROGNAME definitions
- Move to __glibc_unlikely/likely instead of __builtin_expect
- rename link_map and update unique_sym_table to match glibc
-
- * rtld/dl-hash.h:
- Apply glibc changes:
- 2011-12-03 Ulrich Drepper <drepper@gmail.com>
- Fix more warnings
-
- 2011-12-04 Ulrich Drepper <drepper@gmail.com>
- Fix attreibute for _dl_elf_hash
-
- 2011-12-04 Ulrich Drepper <drepper@gmail.com>
- Small optimization of generic ELF hash function
-
- 2011-12-10 Ulrich Drepper <drepper@gmail.com>
- Optimize generic ELF hash function a bit more
-
- 2012-02-09 Paul Eggert <eggert@cs.ucla.edu>
- Replace FSF snail mail address with URLs.
-
- 2013-01-02 Joseph Myers <joseph@codesourcery.com>
- Update copyright notices with scripts/update-copyrights.
-
- 2014-01-01 Allan McRae <allan@archlinux.org>
- Update copyright notices with scripts/update-copyrights
-
- * rtld/dl-load.c: split (_dl_new_object) move to dl-object
- Remove VERSYMIDX, already defined in rtld.h
-
- Apply glibc changes:
- 2012-02-09 Paul Eggert <eggert@cs.ucla.edu>
- Replace FSF snail mail address with URLs.
-
- 2012-04-04 Siddhesh Poyarekar <siddhesh@redhat.com>
- (Updated copyright date)
-
- 2013-01-02 Joseph Myers <joseph@codesourcery.com>
- Update copyright notices with scripts/update-copyrights.
-
- 2014-01-01 Allan McRae <allan@archlinux.org>
- Update copyright notices with scripts/update-copyrights
-
- 2014-02-10 Ond<C5><99>ej B<C3><AD>lka <neleai@seznam.cz>
- Use glibc_likely instead __builtin_expect.
-
- * rtld/dl-object.c:
- Apply glibc changes:
- 2013-11-11 Jan Kratochvil <jan.kratochvil@redhat.com>
- [BZ #387]
- * elf/dl-object.c (_dl_new_object): Initialize L_NAME from NEWNAME if
- it is empty.
-
- * rtld/dl-lookup.c, rtld/dl-lookupX.h:
- Apply glibc changes:
- 2012-02-09 Paul Eggert <eggert@cs.ucla.edu>
- Replace FSF snail mail address with URLs.
-
- 2012-04-05 David S. Miller <davem@davemloft.net>
- * elf/dl-lookup (_dl_lookup_symbol_x): If DL_DEBUG_UNUSED, ignore
- undefined symbol errors.
-
- 2012-08-14 Roland McGrath <roland@hack.frob.com>
- (Updated copyright date)
-
- 2013-01-02 Joseph Myers <joseph@codesourcery.com>
- Update copyright notices with scripts/update-copyrights.
-
- 2013-05-29 Siddhesh Poyarekar <siddhesh@redhat.com>
- Avoid crashing in LD_DEBUG when program name is unavailable
-
- 2013-11-13 Marcus Shawcroft <marcus.shawcroft@linaro.org>
- Avoid passing NULL to DSO_FILENAME.
-
- 2014-01-01 Allan McRae <allan@archlinux.org>
- Update copyright notices with scripts/update-copyrights
-
- 2014-02-10 Ond<C5><99>ej B<C3><AD>lka <neleai@seznam.cz>
- Use glibc_likely instead __builtin_expect.
-
- 2014-02-11 Joseph Myers <joseph@codesourcery.com>
- Merge MIPS dl-lookup.c into generic file.
- * elf/dl-lookup.c (ELF_MACHINE_SYM_NO_MATCH): Define if not
- already defined.
- (do_lookup_x): Use ELF_MACHINE_SYM_NO_MATCH.
- * sysdeps/mips/dl-lookup.c: Remove.
- * sysdeps/mips/dl-machine.h (ELF_MACHINE_SYM_NO_MATCH): New macro.
-
- 2014-02-28 Carlos O'Donell <carlos@redhat.com>
- Promote do_lookup_x:check_match to a full function.
-
- 2014-04-02 Will Newton <will.newton@linaro.org>
- elf/dl-lookup.c: Remove obsolete comment about nested function
- * elf/dl-lookup.c (do_lookup_x): Remove comment
- referring to nested function and move variable
- declarations down to before first use.
-
- 2014-04-04 Will Newton <will.newton@linaro.org>
- elf/dl-lookup.c: Remove unnecessary static variable
- * elf/dl-lookup.c (undefined_msg): Remove variable.
- (_dl_lookup_symbol_x): Replace undefined_msg with string
- literal.
-
- 2014-04-11 Will Newton <will.newton@linaro.org>
- elf/dl-lookup.c: Use __glibc_likely and __glibc_unlikely
-
- * rtld/dl-misc.c:
- Apply glibc changes:
- 2012-02-09 Paul Eggert <eggert@cs.ucla.edu>
- Replace FSF snail mail address with URLs.
-
- 2013-01-02 Joseph Myers <joseph@codesourcery.com>
- Update copyright notices with scripts/update-copyrights.
-
- 2014-01-01 Allan McRae <allan@archlinux.org>
- Update copyright notices with scripts/update-copyrights
-
- * rtld/dl-tls.c:
- Sync spacing with glibc for easier diffs (content remained the same)
-
- Apply glibc changes:
- 2012-02-09 Paul Eggert <eggert@cs.ucla.edu>
- Replace FSF snail mail address with URLs.
-
- 2014-01-01 Allan McRae <allan@archlinux.org>
- Update copyright notices with scripts/update-copyrights
-
- * rtld/dl-version:
- Apply glibc changes:
- 2012-02-09 Paul Eggert <eggert@cs.ucla.edu>
- Replace FSF snail mail address with URLs.
-
- 2013-01-02 Joseph Myers <joseph@codesourcery.com>
- Update copyright notices with scripts/update-copyrights.
-
- 2013-05-29 Siddhesh Poyarekar <siddhesh@redhat.com>
- Avoid crashing in LD_DEBUG when program name is unavailable
-
- 2014-01-01 Allan McRae <allan@archlinux.org>
- Update copyright notices with scripts/update-copyrights
-
- 2014-02-10 Ond<C5><99>ej B<C3><AD>lka <neleai@seznam.cz>
- Use glibc_likely instead __builtin_expect.
-
-2014-12-10 Mark Hatle <mark.hatle@windriver.com>
- * rtld/COPYING, rtld/COPYING.LIB,
- rtld/ChangeLog, rtld/README-rtld: Add local history
- information to setup for a resync to glibc-2.20
-
-2012-09-12 Joseph Myers <joseph@codesourcery.com>
- * rtld/dl-lookup.c: Fix variable copy reloc when host/target
- byte size is different
-
-2012-04-10 Maxim Kuvyrkov <maxim@codesourcery.com>
- * rtld/rtld.c (find_lib_by_soname): Follow ld.so's behavior of
- pulling its name from PT_INTERP.
-
-2012-01-26 Mark Hatle <mark.hatle@windriver.com>
- * elf.h, rtld/dl-lookupX.h, rtld/rtld.c: Sync to eglibc 2.15
-
-2011-12-08 Mark Hatle <mark.hatle@windriver.com>
- * rtld/rtld.c: Add support for $ORIGIN, $PLATFORM and $LIB.
- Note: $PLATFORM = ""
-
-2011-12-08 Mark Hatle <mark.hatle@windriver.com>
- * rtld/rtld.c: Fix an issue where missing objects would trigger
- an assert in dl-version.c
- * rtld/rtld.h: Add _dl_new_object prototype
-
-2011-09-13 Mark Hatle <mark.hatle@windriver.com>
- * Fix printf problem causing prelink-rtld issues on x86 (32-bit)
- and arm
-
-2011-08-26 Mark Hatle <mark.hatle@windriver.com>
- * Add a special check for invalid GNU_HASH entries
-
-2011-08-26 Mark Hatle <mark.hatle@windriver.com>
- * Sync to eglibc 2.13 ld.so code
- * sync elf_machine_type_class macros for supports archs
-
-2011-08-26 Mark Hatle <mark.hatle@windriver.com>
- * Sync to eglibc 2.13 ld.so code
- * mips specific items from ports
-
-2011-08-26 Mark Hatle <mark.hatle@windriver.com>
- * Rename ld-libs.c to rtld.c
- * Sync to eglibc 2.13 ld.so code
-
-2011-08-18 Mark Hatle <mark.hatle@windriver.com>
- * Move prelink-rtld specific components to rtld
-
diff --git a/src/rtld/Makefile.am b/src/rtld/Makefile.am
deleted file mode 100644
index ea3c28a..0000000
--- a/src/rtld/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-## Process this file with automake to create Makefile.in
-
-PKGVERSION = "\"@PKGVERSION@\""
-REPORT_BUGS_TO = "\"@REPORT_BUGS_TO@\""
-
-DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall -Wno-pointer-sign
-AM_CFLAGS = -Wall -Wno-pointer-sign
-AM_CPPFLAGS = -DSBINDIR='"@sbindir@"' -DBINDIR='"@bindir@"' \
- -DEXECSTACK_PROG="\"`echo execstack | sed '$(transform)'`\"" \
- -DPRELINK_PROG="\"`echo prelink | sed '$(transform)'`\"" \
- -DPRELINK_RTLD_PROG="\"`echo prelink-rtld | \
- sed '$(transform)'`\"" \
- -DEXEEXT='"$(EXEEXT)"' \
- -DPKGVERSION=$(PKGVERSION) \
- -DREPORT_BUGS_TO=$(REPORT_BUGS_TO)
-AM_CPPFLAGS += -I$(top_srcdir)/src @GELFINCLUDE@
-
-sbin_PROGRAMS = prelink-rtld
-
-prelink_rtld_SOURCES = ../data.c ../dso.c \
- ../canonicalize.c ../wrap-file.c \
- ../reloc-info.c ../src/reloc-info.h \
- rtld.c ld-libs.h \
- dl-hash.h dl-object.c dl-load.c \
- dl-tls.c dl-version.c dl-misc.c \
- dl-lookup.c dl-lookupX.h dl-open.c
-
-prelink_rtld_LDADD = @LIBGELF@ -liberty
-prelink_rtld_CFLAGS = -DDSO_READONLY
-prelink_rtld_LDFLAGS =
diff --git a/src/rtld/README-rtld b/src/rtld/README-rtld
deleted file mode 100644
index fa737dc..0000000
--- a/src/rtld/README-rtld
+++ /dev/null
@@ -1,18 +0,0 @@
-The rtld emulation is based on the system libc ld.so code.
-
-The original version of this code was written by Daniel Jacobowitz in
-2003. It needed little modification/updating until recently (2011) when
-new constructs, such as STB_GNU_UNIQUE, were introduced into the dynamic
-linking.
-
-The 2011 work was done by Mark Hatle and based on eglibc-2.13. I
-attempted to document all of the code that had origins in eglibc and where
-the code originated from.
-
-As eglibc continues to advance, similar resyncs will be needed over time.
-Hopefully not such a dramatic resync will be required in the future.
-
-Mark Hatle <mark.hatle@windriver.com>,
-August 2011
-
-See the ChangeLog for additional changes.
diff --git a/src/rtld/dl-hash.h b/src/rtld/dl-hash.h
deleted file mode 100644
index 8ce043b..0000000
--- a/src/rtld/dl-hash.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* glibc-2.23: sysdeps/generic/dl-hash.h */
-
-/* Compute hash value for given string according to ELF standard.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _DL_HASH_H
-#define _DL_HASH_H 1
-
-#define _dl_elf_hash rtld_elf_hash
-
-/* This is the hashing function specified by the ELF ABI. In the
- first five operations no overflow is possible so we optimized it a
- bit. */
-static unsigned int
-_dl_elf_hash (const char *name_arg)
-{
- const unsigned char *name = (const unsigned char *) name_arg;
- unsigned long int hash = *name;
- if (hash != 0 && name[1] != '\0')
- {
- hash = (hash << 4) + name[1];
- if (name[2] != '\0')
- {
- hash = (hash << 4) + name[2];
- if (name[3] != '\0')
- {
- hash = (hash << 4) + name[3];
- if (name[4] != '\0')
- {
- hash = (hash << 4) + name[4];
- name += 5;
- while (*name != '\0')
- {
- unsigned long int hi;
- hash = (hash << 4) + *name++;
- hi = hash & 0xf0000000;
-
- /* The algorithm specified in the ELF ABI is as
- follows:
-
- if (hi != 0)
- hash ^= hi >> 24;
-
- hash &= ~hi;
-
- But the following is equivalent and a lot
- faster, especially on modern processors. */
-
- hash ^= hi >> 24;
- }
-
- /* Second part of the modified formula. This
- operation can be lifted outside the loop. */
- hash &= 0x0fffffff;
- }
- }
- }
- }
- return hash;
-}
-
-#endif /* dl-hash.h */
diff --git a/src/rtld/dl-load.c b/src/rtld/dl-load.c
deleted file mode 100644
index ae894b6..0000000
--- a/src/rtld/dl-load.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/* Restructure code containing the original statement:
- Copyright (C) 2003 MontaVista Software, Inc.
- Written by Daniel Jacobowitz <drow@mvista.com>, 2003
-
- Restructed and synced to latest eglibc 2.13 by
- Mark Hatle <mark.hatle@windriver.com>, 2011
-
- 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. */
-
-/* glibc-2.23: elf/dl-load.c */
-
-/* Map in a shared object's segments from the file.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <assert.h>
-#include <error.h>
-#include <errno.h>
-#include <string.h>
-#include "rtld.h"
-
-/* Add `name' to the list of names for a particular shared object.
- `name' is expected to have been allocated with malloc and will
- be freed if the shared object already has this name.
- Returns false if the object already had this name. */
-static void
-add_name_to_object (struct link_map *l, const char *name)
-{
- struct libname_list *lnp, *lastp;
- struct libname_list *newname;
- size_t name_len;
-
- lastp = NULL;
- for (lnp = l->l_libname; lnp != NULL; lastp = lnp, lnp = lnp->next)
- if (strcmp (name, lnp->name) == 0)
- return;
-
- name_len = strlen (name) + 1;
- newname = (struct libname_list *) malloc (sizeof *newname + name_len);
- if (newname == NULL)
- {
- /* No more memory. */
- _dl_signal_error (ENOMEM, name, NULL, ("cannot allocate name record"));
- return;
- }
- /* The object should have a libname set from _dl_new_object. */
- assert (lastp != NULL);
-
- newname->name = memcpy (newname + 1, name, name_len);
- newname->next = NULL;
- lastp->next = newname;
-}
-
-const char *rtld_progname;
-
-static Elf64_Addr load_addr = 0xdead0000;
-static Elf64_Addr dynamic_addr = 0xfeed0000;
-
-/* mimic behavior of _dl_map_object_from_fd(...)
- Note: this is not a copy of the function! */
-void
-create_map_object_from_dso_ent (struct dso_list *cur_dso_ent)
-{
- struct link_map *l = NULL;
- DSO *dso = cur_dso_ent->dso;
-
- int i;
- Elf_Data *data;
-
-
- const char * realname, * name, *soname;
- int l_type;
-
- soname = dso->soname;
- realname = dso->filename;
- name = dso->filename;
-
- l_type = (dso->ehdr.e_type == ET_EXEC ? lt_executable : lt_library);
-
-
- /* Print debug message. */
- if ((l_type == lt_library && !is_ldso_soname(soname)) &&
- __glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
- _dl_debug_printf("file=%s [0]; generating link map\n", soname);
-
-
- l = _dl_new_object (realname, name, l_type);
- if (l == NULL)
- {
- _dl_signal_error(errno, name, NULL, "cannot create shared object descriptor");
- }
-
- if (soname)
- add_name_to_object(l, soname);
-
- if (name)
- add_name_to_object(l, name);
-
- l->filename = dso->filename;
-
- /* Set the elfclass */
- l->elfclass = gelf_getclass (dso->elf);
-
- /*** Setup the l_info as if this had been loaded into memory ***/
-
- /* FIXME: gelfify, endianness issues */
- /* and leaks? */
- i = addr_to_sec (dso, dso->info[DT_SYMTAB]);
- if (i != -1)
- {
- data = elf_getdata (dso->scn[i], NULL);
- l->l_info[DT_SYMTAB] = data->d_buf;
- }
-
- i = addr_to_sec (dso, dso->info[DT_STRTAB]);
- if (i != -1)
- {
- data = elf_getdata (dso->scn[i], NULL);
- l->l_info[DT_STRTAB] = data->d_buf;
- }
-
- if (dynamic_info_is_set (dso, DT_GNU_HASH_BIT))
- {
- i = addr_to_sec (dso, dso->info_DT_GNU_HASH);
- if (i != -1)
- {
- data = elf_getdata (dso->scn[i], NULL);
-
-#if 0
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
- printf("l_info DT_GNU_HASH: offset %d -- addr %p (0x%lx) - type %d\n",
- (DT_ADDRTAGIDX(DT_GNU_HASH) + DT_NUM
- + DT_THISPROCNUM + DT_VERSIONTAGNUM
- + DT_EXTRANUM + DT_VALNUM),
- data->d_buf, (unsigned long) data->d_size);
-#endif
-
- l->l_info[DT_ADDRTAGIDX(DT_GNU_HASH) + DT_NUM
- + DT_THISPROCNUM + DT_VERSIONTAGNUM
- + DT_EXTRANUM + DT_VALNUM] = data->d_buf;
-
- /* PPC64 workaround */
- l->l_buckets_start = data->d_buf;
- l->l_buckets_end = (char *)data->d_buf + data->d_size;
- /* end workaround */
- }
- }
-
- i = addr_to_sec (dso, dso->info[DT_HASH]);
- if (i != -1)
- {
- data = elf_getdata (dso->scn[i], NULL);
- l->l_info[DT_HASH] = data->d_buf;
- }
-
- if (dynamic_info_is_set (dso, DT_VERNEED_BIT))
- {
- i = addr_to_sec (dso, dso->info_DT_VERNEED);
- if (i != -1)
- {
- data = elf_getdata (dso->scn[i], NULL);
- l->l_info[VERSYMIDX (DT_VERNEED)] = data->d_buf;
- }
- }
-
- if (dynamic_info_is_set (dso, DT_VERDEF_BIT))
- {
- i = addr_to_sec (dso, dso->info_DT_VERDEF);
- if (i != -1)
- {
- data = elf_getdata (dso->scn[i], NULL);
- l->l_info[VERSYMIDX (DT_VERDEF)] = data->d_buf;
- }
- }
-
- if (dynamic_info_is_set (dso, DT_VERSYM_BIT))
- {
- i = addr_to_sec (dso, dso->info_DT_VERSYM);
- if (i != -1)
- {
- data = elf_getdata (dso->scn[i], NULL);
- l->l_info[VERSYMIDX (DT_VERSYM)] = data->d_buf;
- }
- }
-
- if (dso->base) {
- l->l_map_start = dso->base;
-
- /* We need to ensure that we don't have two DSOs loading at the same place! */
- struct dso_list * dso_list_ptr;
- for (dso_list_ptr = cur_dso_ent->prev; dso_list_ptr; dso_list_ptr = dso_list_ptr->prev)
- {
- /* This looks for fairly obvious overlaps... */
- if (dso_list_ptr->dso && \
- ((dso_list_ptr->dso->base <= dso->base && dso->base <= dso_list_ptr->dso->end) || \
- (dso->base <= dso_list_ptr->dso->base && dso_list_ptr->dso->base <= dso->end)) \
- )
- {
- l->l_map_start = (Elf64_Addr)NULL;
- break;
- }
- }
- }
-
- if (l->l_map_start == (Elf64_Addr)NULL)
- {
- l->l_map_start = load_addr;
- load_addr += ( ((dso->end - dso->base) + (0x1000 - 1)) & (~(0x1000-1)) );
- }
-
- l->sym_base = dso->info[DT_SYMTAB] - dso->base;
-
- if ((l_type == lt_library && !is_ldso_soname(soname))
- && (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))) {
- _dl_debug_printf ("\
- dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n",
- (int) sizeof (void *) * (gelf_getclass (dso->elf) == ELFCLASS64 ? 2 : 1),
- (unsigned long int) dynamic_addr,
- (int) sizeof (void *) * (gelf_getclass (dso->elf) == ELFCLASS64 ? 2 : 1),
- (unsigned long int) l->l_map_start,
- (int) sizeof (void *) * (gelf_getclass (dso->elf) == ELFCLASS64 ? 2 : 1),
- (dso->end - dso->base));
- _dl_debug_printf ("\
- entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n",
- (int) sizeof (void *) * (gelf_getclass (dso->elf) == ELFCLASS64 ? 2 : 1),
- (unsigned long int) l->l_map_start + dso->ehdr.e_entry,
- (int) sizeof (void *) * (gelf_getclass (dso->elf) == ELFCLASS64 ? 2 : 1),
- (unsigned long int) l->l_map_start + dso->ehdr.e_ehsize,
- (int) sizeof (void *) * (gelf_getclass (dso->elf) == ELFCLASS64 ? 2 : 1),
- dso->ehdr.e_phnum);
- _dl_debug_printf ("\n");
-
- /* Only used for debugging output */
- dynamic_addr += ( ((dso->end - dso->base) + (0x1000 - 1)) & (~(0x1000-1)) );
- }
-
- /* Set up the symbol hash table. */
- _dl_setup_hash (l);
-
- for (i = 0; i < dso->ehdr.e_phnum; ++i)
- if (dso->phdr[i].p_type == PT_TLS)
- {
- l->l_tls_blocksize = dso->phdr[i].p_memsz;
- l->l_tls_align = dso->phdr[i].p_align;
- if (l->l_tls_align == 0)
- l->l_tls_firstbyte_offset = 0;
- else
- l->l_tls_firstbyte_offset = dso->phdr[i].p_vaddr & (l->l_tls_align - 1);
- break;
- }
-
- l->machine = dso->ehdr.e_machine;
-
- cur_dso_ent->map = l;
-}
diff --git a/src/rtld/dl-lookup.c b/src/rtld/dl-lookup.c
deleted file mode 100644
index 5557cbd..0000000
--- a/src/rtld/dl-lookup.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* glibc-2.23: elf/dl-lookup.c */
-
-/* Look up a symbol in the loaded objects.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-/* This file is based on the original eglibc-2.13 libc/elf/dl-lookup.c
- code.
-
- It has been split into two pieces dl-lookup.c and dl-lookupX.c,
- the purpose of the split is to enable both 32-bit and 64-bit ELF
- processing in the same application. This file contains the ELF
- size neutral routines.
- */
-
-#include <config.h>
-#include <alloca.h>
-#include <libintl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <dl-hash.h>
-
-#include <assert.h>
-
-#include <errno.h>
-
-#include <elf.h>
-
-#include <inttypes.h>
-
-#include "prelinktab.h"
-#include "reloc.h"
-
-#include "rtld.h"
-
-/* Return nonzero if check_match should consider SYM to fail to match a
- symbol reference for some machine-specific reason. */
-#ifndef ELF_MACHINE_SYM_NO_MATCH
-/* glibc-2.23: sysdeps/mips/dl-machine.h */
-/* The semantics of zero/non-zero values of undefined symbols differs
- depending on whether the non-PIC ABI is in use. Under the non-PIC
- ABI, a non-zero value indicates that there is an address reference
- to the symbol and thus it must always be resolved (except when
- resolving a jump slot relocation) to the PLT entry whose address is
- provided as the symbol's value; a zero value indicates that this
- canonical-address behaviour is not required. Yet under the classic
- MIPS psABI, a zero value indicates that there is an address
- reference to the function and the dynamic linker must resolve the
- symbol immediately upon loading. To avoid conflict, symbols for
- which the dynamic linker must assume the non-PIC ABI semantics are
- marked with the STO_MIPS_PLT flag. */
-#define ELF_MACHINE_SYM_NO_MATCH(sym) \
- (map->machine == EM_MIPS && \
- ((sym)->st_shndx == SHN_UNDEF && !((sym)->st_other & STO_MIPS_PLT)) \
- )
-#endif
-
-struct unique_sym_table * _ns_unique_sym_table = NULL;
-
-/* This file is from eglibc 2.13, libc/elf/dl-lookup.c
- It has been split into two pieces dl-lookup.c and dl-lookupX.c,
- the purpose of the split is to enable both 32-bit and 64-bit ELF
- processing in the same application. This file contains the common
- routines ... and is the entry to the overall set of files.
- */
-
-#define make_string(string, rest...) \
- ({ \
- const char *all[] = { string, ## rest }; \
- size_t len, cnt; \
- char *result, *cp; \
- \
- len = 1; \
- for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \
- len += strlen (all[cnt]); \
- \
- cp = result = alloca (len); \
- for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \
- cp = __stpcpy (cp, all[cnt]); \
- \
- result; \
- })
-
-static uint_fast32_t
-dl_new_hash (const char *s)
-{
- uint_fast32_t h = 5381;
- unsigned char c = *s;
- for (c = *s; c != '\0'; c = *++s)
- h = h * 33 + c;
- return h & 0xffffffff;
-}
-
-#undef RTLD_ELF_SIZE
-#define RTLD_ELF_SIZE 32
-#include "dl-lookupX.h"
-
-#undef RTLD_ELF_SIZE
-#define RTLD_ELF_SIZE 64
-#include "dl-lookupX.h"
-
-#undef RTLD_ELF_SIZE
-
-void
-_dl_setup_hash (struct link_map *map)
-{
- if (map)
- {
- if (map->elfclass == ELFCLASS32)
- rtld_setup_hash32(map);
- else if (map->elfclass == ELFCLASS64)
- rtld_setup_hash64(map);
- else
- _dl_signal_error(EINVAL, map->l_name, NULL, "elfclass is not defined 32-bit or 64-bit!");
- }
-}
diff --git a/src/rtld/dl-lookupX.h b/src/rtld/dl-lookupX.h
deleted file mode 100644
index 425bb4b..0000000
--- a/src/rtld/dl-lookupX.h
+++ /dev/null
@@ -1,915 +0,0 @@
-/* glibc-2.23: elf/dl-lookup.c */
-
-/* Look up a symbol in the loaded objects.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-/* This file is from eglibc 2.15, libc/elf/dl-lookup.c
- It has been split into two pieces dl-lookup.c and dl-lookupX.c,
- the purpose of the split is to enable both 32-bit and 64-bit ELF
- processing in the same application. This file contains the ELF
- size specific routines. It must be included from dl-lookup.c and
- not used directly!
- */
-
-#if RTLD_ELF_SIZE == 32
- #define enter_unique_sym enter_unique_sym_val32
- #define sym_val sym_val32
- #define check_match check_match32
- #define do_lookup_unique do_lookup_unique32
- #define do_lookup_x do_lookup_x32
- #undef _dl_setup_hash
- #define _dl_setup_hash rtld_setup_hash32
- #define _dl_debug_bindings rtld_debug_bindings32
- #define _dl_lookup_symbol_x rtld_lookup_symbol_x32
- #define rtld_size_t uint32_t
- #define rtld_size_fmtx PRIx32
-
-#elif RTLD_ELF_SIZE == 64
- #define enter_unique_sym enter_unique_sym_val64
- #define sym_val sym_val64
- #define check_match check_match64
- #define do_lookup_unique do_lookup_unique64
- #define do_lookup_x do_lookup_x64
- #undef _dl_setup_hash
- #define _dl_setup_hash rtld_setup_hash64
- #define _dl_debug_bindings rtld_debug_bindings64
- #define _dl_lookup_symbol_x rtld_lookup_symbol_x64
- #define rtld_size_t uint64_t
- #define rtld_size_fmtx PRIx64
-
-#else
- #error "You must declare RTLD_ELF_SIZE to be either 32 or 64"
-#endif
-
-#define __ELF_NATIVE_CLASS RTLD_ELF_SIZE
-
-/* From eglibc 2.15 - elf/link.h */
-
-/* We use this macro to refer to ELF types independent of the native wordsize.
- `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */
-#define ELFW(type) _ElfW (ELF, __ELF_NATIVE_CLASS, type)
-#define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type)
-#define _ElfW(e,w,t) _ElfW_1 (e, w, _##t)
-#define _ElfW_1(e,w,t) e##w##t
-
-struct sym_val
- {
- const ElfW(Sym) *s;
- struct link_map *m;
- };
-
-/* Utility function for do_lookup_x. The caller is called with undef_name,
- ref, version, flags and type_class, and those are passed as the first
- five arguments. The caller then computes sym, symidx, strtab, and map
- and passes them as the next four arguments. Lastly the caller passes in
- versioned_sym and num_versions which are modified by check_match during
- the checking process. */
-static const ElfW(Sym) *
-check_match (const char *const undef_name,
- const ElfW(Sym) *const ref,
- const struct r_found_version *const version,
- const int flags,
- const int type_class,
- const ElfW(Sym) *const sym,
- const Elf_Symndx symidx,
- const char *const strtab,
- const struct link_map *const map,
- const ElfW(Sym) **const versioned_sym,
- int *const num_versions)
-{
- unsigned int stt = ELFW(ST_TYPE) (sym->st_info);
- assert (ELF_RTYPE_CLASS_PLT == 1);
- if (__glibc_unlikely ((sym->st_value == 0 /* No value. */
- && stt != STT_TLS)
- || ELF_MACHINE_SYM_NO_MATCH (sym)
- || (type_class & (sym->st_shndx == SHN_UNDEF))))
- return NULL;
-
- /* Ignore all but STT_NOTYPE, STT_OBJECT, STT_FUNC,
- STT_COMMON, STT_TLS, and STT_GNU_IFUNC since these are no
- code/data definitions. */
-#define ALLOWED_STT \
- ((1 << STT_NOTYPE) | (1 << STT_OBJECT) | (1 << STT_FUNC) \
- | (1 << STT_COMMON) | (1 << STT_TLS) | (1 << STT_GNU_IFUNC))
- if (__glibc_unlikely (((1 << stt) & ALLOWED_STT) == 0))
- return NULL;
-
- if (sym != ref && strcmp (strtab + sym->st_name, undef_name))
- /* Not the symbol we are looking for. */
- return NULL;
-
- const ElfW(Half) *verstab = map->l_versyms;
- if (version != NULL)
- {
- if (__glibc_unlikely (verstab == NULL))
- {
- /* We need a versioned symbol but haven't found any. If
- this is the object which is referenced in the verneed
- entry it is a bug in the library since a symbol must
- not simply disappear.
-
- It would also be a bug in the object since it means that
- the list of required versions is incomplete and so the
- tests in dl-version.c haven't found a problem.*/
- assert (version->filename == NULL
- || ! _dl_name_match_p (version->filename, map));
-
- /* Otherwise we accept the symbol. */
- }
- else
- {
- /* We can match the version information or use the
- default one if it is not hidden. */
- ElfW(Half) ndx = verstab[symidx] & 0x7fff;
- if ((map->l_versions[ndx].hash != version->hash
- || strcmp (map->l_versions[ndx].name, version->name))
- && (version->hidden || map->l_versions[ndx].hash
- || (verstab[symidx] & 0x8000)))
- /* It's not the version we want. */
- return NULL;
- }
- }
- else
- {
- /* No specific version is selected. There are two ways we
- can got here:
-
- - a binary which does not include versioning information
- is loaded
-
- - dlsym() instead of dlvsym() is used to get a symbol which
- might exist in more than one form
-
- If the library does not provide symbol version information
- there is no problem at all: we simply use the symbol if it
- is defined.
-
- These two lookups need to be handled differently if the
- library defines versions. In the case of the old
- unversioned application the oldest (default) version
- should be used. In case of a dlsym() call the latest and
- public interface should be returned. */
- if (verstab != NULL)
- {
- if ((verstab[symidx] & 0x7fff)
- >= ((flags & DL_LOOKUP_RETURN_NEWEST) ? 2 : 3))
- {
- /* Don't accept hidden symbols. */
- if ((verstab[symidx] & 0x8000) == 0
- && (*num_versions)++ == 0)
- /* No version so far. */
- *versioned_sym = sym;
-
- return NULL;
- }
- }
- }
-
- /* There cannot be another entry for this symbol so stop here. */
- return sym;
-}
-
-/* Utility function for do_lookup_unique. Add a symbol to TABLE. */
-static void
-enter_unique_sym (struct unique_sym *table, size_t size,
- unsigned int hash, const char *name,
- const ElfW(Sym) *sym, const struct link_map *map)
-{
- size_t idx = hash % size;
- size_t hash2 = 1 + hash % (size - 2);
- while (table[idx].name != NULL)
- {
- idx += hash2;
- if (idx >= size)
- idx -= size;
- }
-
- table[idx].hashval = hash;
- table[idx].name = name;
- table[idx].sym = sym;
- table[idx].map = map;
-}
-
-/* Utility function for do_lookup_x. Lookup an STB_GNU_UNIQUE symbol
- in the unique symbol table, creating a new entry if necessary.
- Return the matching symbol in RESULT. */
-static void
-do_lookup_unique (const char *undef_name, uint_fast32_t new_hash,
- const struct link_map *map, struct sym_val *result,
- int type_class, const ElfW(Sym) *sym, const char *strtab,
- const ElfW(Sym) *ref, const struct link_map *undef_map)
-{
- /* We have to determine whether we already found a symbol with this
- name before. If not then we have to add it to the search table.
- If we already found a definition we have to use it. */
-
- struct unique_sym_table *tab
- = _ns_unique_sym_table;
-
- __rtld_lock_lock_recursive (tab->lock);
-
- struct unique_sym *entries = tab->entries;
- size_t size = tab->size;
- if (entries != NULL)
- {
- size_t idx = new_hash % size;
- size_t hash2 = 1 + new_hash % (size - 2);
- while (1)
- {
- if (entries[idx].hashval == new_hash
- && strcmp (entries[idx].name, undef_name) == 0)
- {
- if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
- {
- /* We possibly have to initialize the central
- copy from the copy addressed through the
- relocation. */
- result->s = sym;
- result->m = (struct link_map *) map;
- }
- else
- {
- result->s = entries[idx].sym;
- result->m = (struct link_map *) entries[idx].map;
- }
- __rtld_lock_unlock_recursive (tab->lock);
- return;
- }
-
- if (entries[idx].name == NULL)
- break;
-
- idx += hash2;
- if (idx >= size)
- idx -= size;
- }
-
- if (size * 3 <= tab->n_elements * 4)
- {
- /* Expand the table. */
-#ifdef RTLD_CHECK_FOREIGN_CALL
- /* This must not happen during runtime relocations. */
- assert (!RTLD_CHECK_FOREIGN_CALL);
-#endif
- size_t newsize = _dl_higher_prime_number (size + 1);
- struct unique_sym *newentries
- = calloc (sizeof (struct unique_sym), newsize);
- if (newentries == NULL)
- {
- nomem:
- __rtld_lock_unlock_recursive (tab->lock);
- _dl_fatal_printf ("out of memory\n");
- }
-
- for (idx = 0; idx < size; ++idx)
- if (entries[idx].name != NULL)
- enter_unique_sym (newentries, newsize, entries[idx].hashval,
- entries[idx].name, entries[idx].sym,
- entries[idx].map);
-
- tab->free (entries);
- tab->size = newsize;
- size = newsize;
- entries = tab->entries = newentries;
- tab->free = free;
- }
- }
- else
- {
-#ifdef RTLD_CHECK_FOREIGN_CALL
- /* This must not happen during runtime relocations. */
- assert (!RTLD_CHECK_FOREIGN_CALL);
-#endif
-
-#if 1
- /* If tab->entries is NULL, but tab->size is not, it means
- this is the second, conflict finding, lookup for
- LD_TRACE_PRELINKING in _dl_debug_bindings. Don't
- allocate anything and don't enter anything into the
- hash table. */
- if (__glibc_unlikely (tab->size))
- {
- assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK);
- goto success;
- }
-#endif
-
-#define INITIAL_NUNIQUE_SYM_TABLE 31
- size = INITIAL_NUNIQUE_SYM_TABLE;
- entries = calloc (sizeof (struct unique_sym), size);
- if (entries == NULL)
- goto nomem;
-
- tab->entries = entries;
- tab->size = size;
- tab->free = free;
- }
-
- if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
- enter_unique_sym (entries, size, new_hash, strtab + sym->st_name, ref,
- undef_map);
- else
- {
- enter_unique_sym (entries, size,
- new_hash, strtab + sym->st_name, sym, map);
-
-#if 0
- if (map->l_type == lt_loaded)
- /* Make sure we don't unload this object by
- setting the appropriate flag. */
- ((struct link_map *) map)->l_flags_1 |= DF_1_NODELETE;
-#endif
- }
- ++tab->n_elements;
-
-#if 1
- success:
-#endif
-
- result->s = sym;
- result->m = (struct link_map *) map;
-}
-
-/* Inner part of the lookup functions. We return a value > 0 if we
- found the symbol, the value 0 if nothing is found and < 0 if
- something bad happened. */
-static int
-do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
- unsigned long int *old_hash, const ElfW(Sym) *ref,
- struct sym_val *result, struct r_scope_elem *scope, size_t i,
- const struct r_found_version *const version, int flags,
- struct link_map *skip, int type_class, struct link_map *undef_map)
-{
- size_t n = scope->r_nlist;
- /* Make sure we read the value before proceeding. Otherwise we
- might use r_list pointing to the initial scope and r_nlist being
- the value after a resize. That is the only path in dl-open.c not
- protected by GSCOPE. A read barrier here might be to expensive. */
- __asm volatile ("" : "+r" (n), "+m" (scope->r_list));
- struct link_map **list = scope->r_list;
-
- do
- {
- const struct link_map *map = list[i];
-
- /* Here come the extra test needed for `_dl_lookup_symbol_skip'. */
- if (map == skip)
- continue;
-
- /* Don't search the executable when resolving a copy reloc. */
- if ((type_class & ELF_RTYPE_CLASS_COPY) && map->l_type == lt_executable)
- continue;
-
- /* Print some debugging info if wanted. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS))
- _dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n",
- undef_name, DSO_FILENAME (map->l_name),
- 0UL);
-
- /* If the hash table is empty there is nothing to do here. */
- if (map->l_nbuckets == 0)
- continue;
-
- Elf_Symndx symidx;
- int num_versions = 0;
- const ElfW(Sym) *versioned_sym = NULL;
-
- /* The tables for this map. */
- const ElfW(Sym) *symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
- const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-
- const ElfW(Sym) *sym;
- const ElfW(Addr) *bitmask = map->l_gnu_bitmask;
- if (__glibc_likely (bitmask != NULL))
- {
- ElfW(Addr) bitmask_word
- = bitmask[(new_hash / __ELF_NATIVE_CLASS)
- & map->l_gnu_bitmask_idxbits];
-
- unsigned int hashbit1 = new_hash & (__ELF_NATIVE_CLASS - 1);
- unsigned int hashbit2 = ((new_hash >> map->l_gnu_shift)
- & (__ELF_NATIVE_CLASS - 1));
-
- if (__glibc_unlikely ((bitmask_word >> hashbit1)
- & (bitmask_word >> hashbit2) & 1))
- {
- Elf32_Word bucket = map->l_gnu_buckets[new_hash
- % map->l_nbuckets];
-
-/* PPC64 workaround */
- /* There is a bad hash entry and it's pointing beyond
- the end of the bucket list. */
- assert ((void *)&map->l_gnu_chain_zero[bucket] < map->l_buckets_end);
-/* END PPC64 workaround */
- if (bucket != 0)
- {
- const Elf32_Word *hasharr = &map->l_gnu_chain_zero[bucket];
-
- do
- if (((*hasharr ^ new_hash) >> 1) == 0)
- {
- symidx = hasharr - map->l_gnu_chain_zero;
- sym = check_match (undef_name, ref, version, flags,
- type_class, &symtab[symidx], symidx,
- strtab, map, &versioned_sym,
- &num_versions);
- if (sym != NULL)
- goto found_it;
- }
- while ((*hasharr++ & 1u) == 0);
- }
- }
- /* No symbol found. */
- symidx = SHN_UNDEF;
- }
- else
- {
- if (*old_hash == 0xffffffff)
- *old_hash = _dl_elf_hash (undef_name);
-
- /* Use the old SysV-style hash table. Search the appropriate
- hash bucket in this object's symbol table for a definition
- for the same symbol name. */
- for (symidx = map->l_buckets[*old_hash % map->l_nbuckets];
- symidx != STN_UNDEF;
- symidx = map->l_chain[symidx])
- {
- sym = check_match (undef_name, ref, version, flags,
- type_class, &symtab[symidx], symidx,
- strtab, map, &versioned_sym,
- &num_versions);
- if (sym != NULL)
- goto found_it;
- }
- }
-
- /* If we have seen exactly one versioned symbol while we are
- looking for an unversioned symbol and the version is not the
- default version we still accept this symbol since there are
- no possible ambiguities. */
- sym = num_versions == 1 ? versioned_sym : NULL;
-
- if (sym != NULL)
- {
- found_it:
- /* When UNDEF_MAP is NULL, which indicates we are called from
- do_lookup_x on relocation against protected data, we skip
- the data definion in the executable from copy reloc. */
- if (ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(map->machine)
- && undef_map == NULL
- && map->l_type == lt_executable
- && type_class == ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(map->machine))
- {
- const ElfW(Sym) *s;
- unsigned int i;
-
-if (!ELF_MACHINE_NO_RELA(map->machine)) { /* #if ! ELF_MACHINE_NO_RELA */
- if (map->l_info[DT_RELA] != NULL
- && map->l_info[DT_RELASZ] != NULL
- && ((ElfW(Dyn) *)(map->l_info[DT_RELASZ]))->d_un.d_val != 0)
- {
- const ElfW(Rela) *rela
- = (const ElfW(Rela) *) D_PTR (map, l_info[DT_RELA]);
- unsigned int rela_count
- = ((ElfW(Dyn) *)(map->l_info[DT_RELASZ]))->d_un.d_val / sizeof (*rela);
-
- for (i = 0; i < rela_count; i++, rela++)
- if (elf_machine_type_class (ELFW(R_TYPE) (rela->r_info), map->machine)
- == ELF_RTYPE_CLASS_COPY)
- {
- s = &symtab[ELFW(R_SYM) (rela->r_info)];
- if (!strcmp (strtab + s->st_name, undef_name))
- goto skip;
- }
- }
-} /* #endif */
-if (!ELF_MACHINE_NO_REL(map->machine)) { /* #if ! ELF_MACHINE_NO_REL */
- if (map->l_info[DT_REL] != NULL
- && map->l_info[DT_RELSZ] != NULL
- && ((ElfW(Dyn) *)(map->l_info[DT_RELSZ]))->d_un.d_val != 0)
- {
- const ElfW(Rel) *rel
- = (const ElfW(Rel) *) D_PTR (map, l_info[DT_REL]);
- unsigned int rel_count
- = ((ElfW(Dyn) *)(map->l_info[DT_RELSZ]))->d_un.d_val / sizeof (*rel);
-
- for (i = 0; i < rel_count; i++, rel++)
- if (elf_machine_type_class (ELFW(R_TYPE) (rel->r_info), map->machine)
- == ELF_RTYPE_CLASS_COPY)
- {
- s = &symtab[ELFW(R_SYM) (rel->r_info)];
- if (!strcmp (strtab + s->st_name, undef_name))
- goto skip;
- }
- }
-} /* #endif */
- }
-
- switch (ELFW(ST_BIND) (sym->st_info))
- {
- case STB_WEAK:
- /* Weak definition. Use this value if we don't find another. */
- if (__glibc_unlikely (GLRO(dl_dynamic_weak)))
- {
- if (! result->s)
- {
- result->s = sym;
- result->m = (struct link_map *) map;
- }
- break;
- }
- /* FALLTHROUGH */
- case STB_GLOBAL:
- /* Global definition. Just what we need. */
- result->s = sym;
- result->m = (struct link_map *) map;
- return 1;
-
- case STB_GNU_UNIQUE:;
- do_lookup_unique (undef_name, new_hash, map, result, type_class,
- sym, strtab, ref, undef_map);
- return 1;
-
- default:
- /* Local symbols are ignored. */
- break;
- }
- }
-
-skip:
- /* If this current map is the one mentioned in the verneed entry
- and we have not found a weak entry, it is a bug. */
- if (symidx == STN_UNDEF && version != NULL && version->filename != NULL
- && __glibc_unlikely (_dl_name_match_p (version->filename, map)))
- return -1;
- }
- while (++i < n);
-
- /* We have not found anything until now. */
- return 0;
-}
-
-
-static void
-_dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
- const ElfW(Sym) **ref, struct sym_val *value,
- const struct r_found_version *version, int type_class,
- int protected);
-
-
-/* Search loaded objects' symbol tables for a definition of the symbol
- UNDEF_NAME, perhaps with a requested version for the symbol.
-
- We must never have calls to the audit functions inside this function
- or in any function which gets called. If this would happen the audit
- code might create a thread which can throw off all the scope locking. */
-lookup_t
-_dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
- const ElfW(Sym) **ref,
- struct r_scope_elem *symbol_scope[],
- const struct r_found_version *version,
- int type_class, int flags, struct link_map *skip_map)
-{
- const uint_fast32_t new_hash = dl_new_hash (undef_name);
- unsigned long int old_hash = 0xffffffff;
- struct sym_val current_value = { NULL, NULL };
- struct r_scope_elem **scope = symbol_scope;
-
- /* No other flag than DL_LOOKUP_ADD_DEPENDENCY or DL_LOOKUP_GSCOPE_LOCK
- is allowed if we look up a versioned symbol. */
- assert (version == NULL
- || (flags & ~(DL_LOOKUP_ADD_DEPENDENCY | DL_LOOKUP_GSCOPE_LOCK))
- == 0);
-
- size_t i = 0;
- if (__glibc_unlikely (skip_map != NULL))
- /* Search the relevant loaded objects for a definition. */
- while ((*scope)->r_list[i] != skip_map)
- ++i;
-
- /* Search the relevant loaded objects for a definition. */
- size_t start; /* requires C99 to put it into the loop */
- for (start = i; *scope != NULL; start = 0, ++scope)
- {
- int res = do_lookup_x (undef_name, new_hash, &old_hash, *ref,
- &current_value, *scope, start, version, flags,
- skip_map, type_class, undef_map);
- if (res > 0)
- break;
-
- if (__glibc_unlikely (res < 0) && skip_map == NULL)
- {
- /* Oh, oh. The file named in the relocation entry does not
- contain the needed symbol. This code is never reached
- for unversioned lookups. */
- assert (version != NULL);
- const char *reference_name = undef_map ? undef_map->l_name : "";
-
- /* XXX We cannot translate the message. */
- _dl_signal_cerror (0, DSO_FILENAME (reference_name),
- "relocation error",
- make_string ("symbol ", undef_name, ", version ",
- version->name,
- " not defined in file ",
- version->filename,
- " with link time reference",
- res == -2
- ? " (no version symbols)" : ""));
- *ref = NULL;
- return 0;
- }
- }
-
- if (__glibc_unlikely (current_value.s == NULL))
- {
- if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
- && skip_map == NULL
- && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
- {
- /* We could find no value for a strong reference. */
- const char *reference_name = undef_map ? undef_map->l_name : "";
- const char *versionstr = version ? ", version " : "";
- const char *versionname = (version && version->name
- ? version->name : "");
-
- /* XXX We cannot translate the message. */
- _dl_signal_cerror (0, DSO_FILENAME (reference_name),
- ("symbol lookup error"),
- make_string ("undefined symbol: ", undef_name,
- versionstr, versionname));
- }
- *ref = NULL;
- return 0;
- }
-
- int protected = (*ref
- && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED);
- if (__glibc_unlikely (protected != 0))
- {
- /* It is very tricky. We need to figure out what value to
- return for the protected symbol. */
- if (type_class == ELF_RTYPE_CLASS_PLT)
- {
- if (current_value.s != NULL && current_value.m != undef_map)
- {
- current_value.s = *ref;
- current_value.m = undef_map;
- }
- }
- else
- {
- struct sym_val protected_value = { NULL, NULL };
-
- for (scope = symbol_scope; *scope != NULL; i = 0, ++scope)
- if (do_lookup_x (undef_name, new_hash, &old_hash, *ref,
- &protected_value, *scope, i, version, flags,
- skip_map,
- (ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(skip_map->machine)
- && ELFW(ST_TYPE) ((*ref)->st_info) == STT_OBJECT
- && type_class == ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(skip_map->machine))
- ? ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(skip_map->machine)
- : ELF_RTYPE_CLASS_PLT, NULL) != 0)
- break;
-
- if (protected_value.s != NULL && protected_value.m != undef_map)
- {
- current_value.s = *ref;
- current_value.m = undef_map;
- }
- }
- }
-
-#if 0
- /* We have to check whether this would bind UNDEF_MAP to an object
- in the global scope which was dynamically loaded. In this case
- we have to prevent the latter from being unloaded unless the
- UNDEF_MAP object is also unloaded. */
- if (__glibc_unlikely (current_value.m->l_type == lt_loaded)
- /* Don't do this for explicit lookups as opposed to implicit
- runtime lookups. */
- && (flags & DL_LOOKUP_ADD_DEPENDENCY) != 0
- /* Add UNDEF_MAP to the dependencies. */
- && add_dependency (undef_map, current_value.m, flags) < 0)
- /* Something went wrong. Perhaps the object we tried to reference
- was just removed. Try finding another definition. */
- return _dl_lookup_symbol_x (undef_name, undef_map, ref,
- symbol_scope,
- version, type_class, flags, skip_map);
-#endif
-
- if (__glibc_unlikely (GLRO(dl_debug_mask)
- & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK)))
- _dl_debug_bindings (undef_name, undef_map, ref,
- &current_value, version, type_class, protected);
-
- *ref = current_value.s;
- return LOOKUP_VALUE (current_value.m);
-}
-
-
-/* Cache the location of MAP's hash table. */
-
-void
-_dl_setup_hash (struct link_map *map)
-{
- Elf_Symndx *hash;
-
- if (__glibc_likely (map->l_info[DT_ADDRTAGIDX (DT_GNU_HASH) + DT_NUM
- + DT_THISPROCNUM + DT_VERSIONTAGNUM
- + DT_EXTRANUM + DT_VALNUM] != NULL))
- {
- Elf32_Word *hash32
- = (void *) D_PTR (map, l_info[DT_ADDRTAGIDX (DT_GNU_HASH) + DT_NUM
- + DT_THISPROCNUM + DT_VERSIONTAGNUM
- + DT_EXTRANUM + DT_VALNUM]);
- map->l_nbuckets = *hash32++;
- Elf32_Word symbias = *hash32++;
- Elf32_Word bitmask_nwords = *hash32++;
- /* Must be a power of two. */
- assert ((bitmask_nwords & (bitmask_nwords - 1)) == 0);
- map->l_gnu_bitmask_idxbits = bitmask_nwords - 1;
- map->l_gnu_shift = *hash32++;
-
- map->l_gnu_bitmask = (ElfW(Addr) *) hash32;
- hash32 += __ELF_NATIVE_CLASS / 32 * bitmask_nwords;
-
- map->l_gnu_buckets = hash32;
- hash32 += map->l_nbuckets;
- map->l_gnu_chain_zero = hash32 - symbias;
- return;
- }
-
- if (!map->l_info[DT_HASH])
- return;
- hash = (void *) D_PTR (map, l_info[DT_HASH]);
-
- map->l_nbuckets = *hash++;
- /* Skip nchain. */
- hash++;
- map->l_buckets = hash;
- hash += map->l_nbuckets;
- map->l_chain = hash;
-}
-
-
-static void
-_dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
- const ElfW(Sym) **ref, struct sym_val *value,
- const struct r_found_version *version, int type_class,
- int protected)
-{
- const char *reference_name = undef_map->l_name;
-
- if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS)
- {
- _dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'",
- DSO_FILENAME (reference_name),
- 0UL,
- DSO_FILENAME (value->m->l_name),
- 0UL,
- protected ? "protected" : "normal", undef_name);
- if (version)
- printf (" [%s]\n", version->name);
- else
- printf ("\n");
- }
-#if 1
- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
- {
-/* ELF_RTYPE_CLASS_XXX must match RTYPE_CLASS_XXX used by prelink with
- LD_TRACE_PRELINKING. */
-#ifndef RTYPE_CLASS_VALID
-#define RTYPE_CLASS_VALID 8
-#define RTYPE_CLASS_PLT (8|1)
-#define RTYPE_CLASS_COPY (8|2)
-#define RTYPE_CLASS_TLS (8|4)
-#if ELF_RTYPE_CLASS_PLT != 0 && ELF_RTYPE_CLASS_PLT != 1
-# error ELF_RTYPE_CLASS_PLT must be 0 or 1!
-#endif
-#if ELF_RTYPE_CLASS_COPY != 0 && ELF_RTYPE_CLASS_COPY != 2
-# error ELF_RTYPE_CLASS_COPY must be 0 or 2!
-#endif
-#endif
- int conflict = 0;
- struct sym_val val = { NULL, NULL };
-
- /* We need to always process these or we can miss conflict symbols when
- RTLD_TRACE_PRELINKING=<library> */
- if (1)
- {
- const uint_fast32_t new_hash = dl_new_hash (undef_name);
- unsigned long int old_hash = 0xffffffff;
- struct unique_sym *saved_entries
- = _ns_unique_sym_table->entries;
-
- _ns_unique_sym_table->entries = NULL;
- do_lookup_x (undef_name, new_hash, &old_hash, *ref, &val,
- undef_map->l_local_scope[0], 0, version, 0, NULL,
- type_class, undef_map);
- if (val.s != value->s || val.m != value->m)
- conflict = 1;
- else if (1
- && val.s
- && __glibc_unlikely (ELFW(ST_BIND) (val.s->st_info)
- == STB_GNU_UNIQUE))
- {
- /* If it is STB_GNU_UNIQUE and undef_map's l_local_scope
- contains any DT_SYMBOLIC libraries, unfortunately there
- can be conflicts even if the above is equal. As symbol
- resolution goes from the last library to the first and
- if a STB_GNU_UNIQUE symbol is found in some late DT_SYMBOLIC
- library, it would be the one that is looked up. */
- struct sym_val val2 = { NULL, NULL };
- size_t n;
- struct r_scope_elem *scope = undef_map->l_local_scope[0];
-
- for (n = 0; n < scope->r_nlist; n++)
- if (scope->r_list[n] == val.m)
- break;
-
- for (n++; n < scope->r_nlist; n++)
- if (scope->r_list[n]->l_info[DT_SYMBOLIC] != NULL
- && do_lookup_x (undef_name, new_hash, &old_hash, *ref,
- &val2,
- scope,
- 0, version, 0, NULL, type_class,
- undef_map) > 0)
- {
- conflict = 1;
- val = val2;
- break;
- }
- }
- _ns_unique_sym_table->entries = saved_entries;
- }
-
- if (value->s)
- {
- /* Clear the ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA bit since
- it isn't used by prelink. */
- type_class &= ~ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(undef_map->machine);
- if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
- == STT_TLS))
- /* Clear the RTYPE_CLASS_VALID bit in RTYPE_CLASS_TLS. */
- type_class = RTYPE_CLASS_TLS & ~RTYPE_CLASS_VALID;
- else if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
- == STT_GNU_IFUNC))
- /* Set the RTYPE_CLASS_VALID bit. */
- type_class |= RTYPE_CLASS_VALID;
- }
-
- if (conflict
- || GLRO(dl_trace_prelink_map) == undef_map
- || GLRO(dl_trace_prelink_map) == NULL
- || type_class >= 4)
- {
- printf ("%s 0x%0*"rtld_size_fmtx" 0x%0*"rtld_size_fmtx" -> 0x%0*"rtld_size_fmtx" 0x%0*"rtld_size_fmtx" ",
- conflict ? "conflict" : "lookup",
- (int) sizeof (ElfW(Addr)) * 2,
- (rtld_size_t) undef_map->l_map_start,
- (int) sizeof (ElfW(Addr)) * 2,
- (rtld_size_t) (((char *)*ref) - ((char *)undef_map->l_info[DT_SYMTAB]) + (char *)undef_map->sym_base),
- (int) sizeof (ElfW(Addr)) * 2,
- (rtld_size_t) (value->s ? value->m->l_map_start : 0),
- (int) sizeof (ElfW(Addr)) * 2,
- (rtld_size_t) (value->s ? value->s->st_value : 0));
-
- if (conflict)
- printf ("x 0x%0*"rtld_size_fmtx" 0x%0*"rtld_size_fmtx" ",
- (int) sizeof (ElfW(Addr)) * 2,
- (rtld_size_t) (val.s ? val.m->l_map_start : 0),
- (int) sizeof (ElfW(Addr)) * 2,
- (rtld_size_t) (val.s ? val.s->st_value : 0));
-
- printf ("/%x %s\n", type_class, undef_name);
- }
- }
-#endif
-}
-
-#undef enter_unique_sym
-#undef sym_val
-#undef check_match
-#undef do_lookup_unique
-#undef do_lookup_x
-#undef _dl_setup_hash
-#define _dl_setup_hash rtld_setup_hash
-#undef _dl_debug_bindings
-#undef _dl_lookup_symbol_x
-#undef rtld_size_t
-#undef rtld_size_fmtx
diff --git a/src/rtld/dl-misc.c b/src/rtld/dl-misc.c
deleted file mode 100644
index c70956d..0000000
--- a/src/rtld/dl-misc.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* glibc 2.22, elf/dl-misc.c */
-
-/* Miscellaneous support functions for dynamic linker
- Copyright (C) 1997-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <assert.h>
-#include <error.h>
-#include <errno.h>
-#include <string.h>
-#include "rtld.h"
-
-/* Test whether given NAME matches any of the names of the given object. */
-int
-_dl_name_match_p (const char *name, const struct link_map *map)
-{
- if (strcmp (name, map->l_name) == 0)
- return 1;
-
- struct libname_list *runp = map->l_libname;
-
- while (runp != NULL)
- if (strcmp (name, runp->name) == 0)
- return 1;
- else
- runp = runp->next;
-
- return 0;
-}
-
-unsigned long int
-_dl_higher_prime_number (unsigned long int n)
-{
- /* These are primes that are near, but slightly smaller than, a
- power of two. */
- static const uint32_t primes[] = {
- UINT32_C (7),
- UINT32_C (13),
- UINT32_C (31),
- UINT32_C (61),
- UINT32_C (127),
- UINT32_C (251),
- UINT32_C (509),
- UINT32_C (1021),
- UINT32_C (2039),
- UINT32_C (4093),
- UINT32_C (8191),
- UINT32_C (16381),
- UINT32_C (32749),
- UINT32_C (65521),
- UINT32_C (131071),
- UINT32_C (262139),
- UINT32_C (524287),
- UINT32_C (1048573),
- UINT32_C (2097143),
- UINT32_C (4194301),
- UINT32_C (8388593),
- UINT32_C (16777213),
- UINT32_C (33554393),
- UINT32_C (67108859),
- UINT32_C (134217689),
- UINT32_C (268435399),
- UINT32_C (536870909),
- UINT32_C (1073741789),
- UINT32_C (2147483647),
- /* 4294967291L */
- UINT32_C (2147483647) + UINT32_C (2147483644)
- };
-
- const uint32_t *low = &primes[0];
- const uint32_t *high = &primes[sizeof (primes) / sizeof (primes[0])];
-
- while (low != high)
- {
- const uint32_t *mid = low + (high - low) / 2;
- if (n > *mid)
- low = mid + 1;
- else
- high = mid;
- }
-
-#if 0
- /* If we've run out of primes, abort. */
- if (n > *low)
- {
- fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
- abort ();
- }
-#endif
-
- return *low;
-}
diff --git a/src/rtld/dl-object.c b/src/rtld/dl-object.c
deleted file mode 100644
index 871441c..0000000
--- a/src/rtld/dl-object.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* glibc-2.23: elf/dl-object.c */
-
-/* Storage management for the chain of loaded shared objects.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <assert.h>
-#include <error.h>
-#include <errno.h>
-#include <string.h>
-#include "rtld.h"
-
-/* Allocate a `struct link_map' for a new object being loaded,
- and enter it into the _dl_loaded list. */
-struct link_map *
-_dl_new_object (const char *realname, const char *libname, int type)
-{
- size_t libname_len = strlen (libname) + 1;
- struct link_map *new;
- struct libname_list *newname;
-
- new = (struct link_map *) calloc (sizeof (*new) +
- + sizeof (*newname) + libname_len, 1);
-
- if (new == NULL)
- return NULL;
-
- new->l_libname = newname
- = (struct libname_list *) ((char *) (new + 1));
- newname->name = (char *) memcpy (newname + 1, libname, libname_len);
- /* newname->next = NULL; We use calloc therefore not necessary. */
-
- /* When we create the executable link map, or a VDSO link map, we start
- with "" for the l_name. In these cases "" points to ld.so rodata
- and won't get dumped during core file generation. Therefore to assist
- gdb and to create more self-contained core files we adjust l_name to
- point at the newly allocated copy (which will get dumped) instead of
- the ld.so rodata copy. */
- new->l_name = *realname ? realname : (char *) newname->name + libname_len - 1;
- new->l_type = type;
-
- return new;
-}
diff --git a/src/rtld/dl-open.c b/src/rtld/dl-open.c
deleted file mode 100644
index 070a3f5..0000000
--- a/src/rtld/dl-open.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* glibc-2.23: elf/dl-open.c */
-
-/* Load a shared object at runtime, relocate it, and run its initializer.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include "rtld.h"
-
-void
-_dl_show_scope (struct link_map *l, int from)
-{
- _dl_debug_printf ("object=%s [%lu]\n",
- DSO_FILENAME (l->l_name), 0UL);
- if (l->l_local_scope != NULL)
- for (int scope_cnt = from; l->l_local_scope[scope_cnt] != NULL; ++scope_cnt)
- {
- _dl_debug_printf (" scope %u:", scope_cnt);
-
- for (unsigned int cnt = 0; cnt < l->l_local_scope[scope_cnt]->r_nlist; ++cnt)
- if (*l->l_local_scope[scope_cnt]->r_list[cnt]->l_name)
- _dl_debug_printf_c (" %s",
- l->l_local_scope[scope_cnt]->r_list[cnt]->l_name);
- else
- _dl_debug_printf_c (" %s", RTLD_PROGNAME);
-
- _dl_debug_printf_c ("\n");
- }
- else
- _dl_debug_printf (" no scope\n");
- _dl_debug_printf ("\n");
-}
diff --git a/src/rtld/dl-tls.c b/src/rtld/dl-tls.c
deleted file mode 100644
index 8b972ff..0000000
--- a/src/rtld/dl-tls.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* Copyright (C) 2011 Wind River Systems, Inc.
-
- Code reorganized from original code bearing the following copyright:
- Copyright (C) 2003 MontaVista Software, Inc.
- Written by Daniel Jacobowitz <drow@mvista.com>, 2003
-
- Code updated by Mark Hatle <mark.hatle@windriver.com>, 2011
- to sync to eglibc 2.13 tls behavior...
-
- 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. */
-
-/* glibc 2.22: elf/dl-tls.c */
-
-/* Thread-local storage handling in the ELF dynamic linker. Generic version.
- Copyright (C) 2002-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "rtld.h"
-
-/* Assign TLS offsets for every loaded library. This code is taken
- almost directly from glibc! */
-
-#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
-
-/* The following function needs to mimic the _dl_determine_tlsoffset in eglibc */
-void
-rtld_determine_tlsoffsets (int e_machine, struct r_scope_elem *search_list)
-{
- uint64_t modid = 1;
-
- uint64_t i;
-
- /* skip max_align */
- uint64_t freetop = 0;
- uint64_t freebottom = 0;
-
- /* This comes from each architecture's ABI. If TLS_TCB_AT_TP, then
- set offset to -1; if TLS_DTV_AT_TP, then set offset to
- TLS_TCB_SIZE. */
-
- int tls_tcb_at_tp = 0;
- int tls_dtv_at_tp = 0;
- uint64_t tls_tcb_size;
-
- switch (e_machine)
- {
- case EM_X86_64:
- tls_tcb_at_tp = 1;
- tls_tcb_size = -1;
- break;
-
- case EM_386:
- tls_tcb_at_tp = 1;
- tls_tcb_size = -1;
- break;
-
- case EM_SH:
- tls_dtv_at_tp = 1;
- tls_tcb_size = 8;
- break;
-
- case EM_PPC:
- tls_dtv_at_tp = 1;
- tls_tcb_size = 0;
- break;
-
- case EM_PPC64:
- tls_dtv_at_tp = 1;
- tls_tcb_size = 0;
- break;
-
- case EM_ARM:
- tls_dtv_at_tp = 1;
- tls_tcb_size = 8;
- break;
-
- case EM_AARCH64:
- tls_dtv_at_tp = 1;
- tls_tcb_size = 16;
- break;
-
- case EM_MIPS:
- tls_dtv_at_tp = 1;
- tls_tcb_size = 0;
- break;
-
- case EM_SPARC:
- case EM_SPARC32PLUS:
- tls_tcb_at_tp = 1;
- tls_tcb_size = -1;
- break;
-
- case EM_SPARCV9:
- tls_tcb_at_tp = 1;
- tls_tcb_size = -1;
- break;
-
- case EM_ALTERA_NIOS2:
- tls_dtv_at_tp = 1;
- tls_tcb_size = 0;
- break;
-
- default:
- /* Hope there's no TLS! */
- for (i = 0; i < search_list->r_nlist; i++)
- {
- struct link_map *map = search_list->r_list[i];
-
- if (map->l_tls_blocksize > 0)
- _dl_signal_error(0, map->l_name, NULL, "cannot handle TLS data");
- }
-
- return;
- }
-
- /* eglibc 2.20: elf/dl-tls.c: _dl_determine_tlsoffset (void) */
- /* Determining the offset of the various parts of the static TLS
- block has several dependencies. In addition we have to work
- around bugs in some toolchains.
-
- Each TLS block from the objects available at link time has a size
- and an alignment requirement. The GNU ld computes the alignment
- requirements for the data at the positions *in the file*, though.
- I.e, it is not simply possible to allocate a block with the size
- of the TLS program header entry. The data is layed out assuming
- that the first byte of the TLS block fulfills
-
- p_vaddr mod p_align == &TLS_BLOCK mod p_align
-
- This means we have to add artificial padding at the beginning of
- the TLS block. These bytes are never used for the TLS data in
- this module but the first byte allocated must be aligned
- according to mod p_align == 0 so that the first byte of the TLS
- block is aligned according to p_vaddr mod p_align. This is ugly
- and the linker can help by computing the offsets in the TLS block
- assuming the first byte of the TLS block is aligned according to
- p_align.
-
- The extra space which might be allocated before the first byte of
- the TLS block need not go unused. The code below tries to use
- that memory for the next TLS block. This can work if the total
- memory requirement for the next TLS block is smaller than the
- gap. */
-
- /* Loop over the loaded DSOs. We use the symbol search order; this
- should be the same as glibc's ordering, which traverses l_next.
- It's somewhat important that we use both the same ordering to
- assign module IDs and the same algorithm to assign offsets,
- because the prelinker will resolve all relocations using these
- offsets... and then glibc will recalculate them. Future dynamic
- relocations in any loaded modules will use glibc's values. Also
- if we take too much space here, glibc won't allocate enough
- static TLS area to hold it. */
-
-/* #if TLS_TCB_AT_TP */ if (tls_tcb_at_tp == 1) {
- /* We simply start with zero. */
- uint64_t offset = 0;
-
- for (i = 0; i < search_list->r_nlist; i++)
- {
- struct link_map *map = search_list->r_list[i];
-
- uint64_t firstbyte = (-map->l_tls_firstbyte_offset
- & (map->l_tls_align - 1));
- uint64_t off;
-
- /* elf/rtld.c would have caused us to skip this block.. so emulate this */
- if (map->l_tls_blocksize == 0)
- continue;
-
- /* allocate_tls_init would nomrally Increment the module id */
- map->l_tls_modid = modid++;
-
- if (freebottom - freetop >= map->l_tls_blocksize)
- {
- off = roundup (freetop + map->l_tls_blocksize
- - firstbyte, map->l_tls_align)
- + firstbyte;
- if (off <= freebottom)
- {
- freetop = off;
-
- /* XXX For some architectures we perhaps should store the
- negative offset. */
- map->l_tls_offset = off;
- continue;
- }
- }
-
- off = roundup (offset + map->l_tls_blocksize - firstbyte,
- map->l_tls_align) + firstbyte;
- if (off > offset + map->l_tls_blocksize
- + (freebottom - freetop))
- {
- freetop = offset;
- freebottom = off - map->l_tls_blocksize;
- }
- offset = off;
-
- /* XXX For some architectures we perhaps should store the
- negative offset. */
- map->l_tls_offset = off;
- }
-/* #elif TLS_DTV_AT_TP */ } else if (tls_dtv_at_tp == 1) {
- /* The TLS blocks start right after the TCB. */
- uint64_t offset = tls_tcb_size;
-
- for (i = 0; i < search_list->r_nlist; i++)
- {
- struct link_map *map = search_list->r_list[i];
-
- uint64_t firstbyte = (-map->l_tls_firstbyte_offset
- & (map->l_tls_align - 1));
- uint64_t off;
-
- /* elf/rtld.c would have caused us to skip this block.. so emulate this */
- if (map->l_tls_blocksize == 0)
- continue;
-
- /* allocate_tls_init would nomrally Increment the module id */
- map->l_tls_modid = modid++;
-
- if (map->l_tls_blocksize <= freetop - freebottom)
- {
- off = roundup (freebottom, map->l_tls_align);
- if (off - freebottom < firstbyte)
- off += map->l_tls_align;
- if (off + map->l_tls_blocksize - firstbyte <= freetop)
- {
- map->l_tls_offset = off - firstbyte;
- freebottom = (off + map->l_tls_blocksize
- - firstbyte);
- continue;
- }
- }
-
- off = roundup (offset, map->l_tls_align);
- if (off - offset < firstbyte)
- off += map->l_tls_align;
-
- map->l_tls_offset = off - firstbyte;
- if (off - firstbyte - offset > freetop - freebottom)
- {
- freebottom = offset;
- freetop = off - firstbyte;
- }
-
- offset = off + map->l_tls_blocksize - firstbyte;
- }
-/* #else */ } else {
- /* Should never happen... */
- _dl_signal_error(0, NULL, NULL, "Neither TLS_TCB_AT_TP nor TLS_DTV_AT_TP is defined for this architecture");
-/* #endif */ }
-}
diff --git a/src/rtld/dl-version.c b/src/rtld/dl-version.c
deleted file mode 100644
index 042a70f..0000000
--- a/src/rtld/dl-version.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/* Based on code originally in eglibc 2.13, libc/elf/dl-version.c */
-
-/* Handle symbol and library versioning.
- Copyright (C) 1997-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <assert.h>
-#include <error.h>
-#include <errno.h>
-#include <string.h>
-#include "rtld.h"
-
-#define make_string(string, rest...) \
- ({ \
- const char *all[] = { string, ## rest }; \
- size_t len, cnt; \
- char *result, *cp; \
- \
- len = 1; \
- for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \
- len += strlen (all[cnt]); \
- \
- cp = result = alloca (len); \
- for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \
- cp = __stpcpy (cp, all[cnt]); \
- \
- result; \
- })
-
-
-static inline struct link_map *
-find_needed (const char *name, struct link_map *map)
-{
- struct link_map *tmap = map;
- unsigned int n = 0;
-
- for (n = 0; n < map->l_local_scope[0]->r_nlist; n++)
- {
- tmap = map->l_local_scope[0]->r_list[n];
- if (_dl_name_match_p (name, tmap))
- return tmap;
- }
-
- if (_dl_name_match_p (name, map))
- return map;
-
- /* Should never happen. */
- return NULL;
-}
-
-
-static int
-match_symbol (const char *name, Elf64_Word hash, const char *string,
- struct link_map *map, int verbose, int weak)
-{
- const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
- Elf64_Verdef *def;
- /* Initialize to make the compiler happy. */
- const char *errstring = NULL;
- int result = 0;
-
- /* Display information about what we are doing while debugging. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS))
- _dl_debug_printf ("\
-checking for version `%s' in file %s [0] required by file %s [0]\n",
- string, DSO_FILENAME (map->l_name),
- name);
-
- if (__glibc_unlikely (map->l_info[VERSYMIDX (DT_VERDEF)] == NULL))
- {
- /* The file has no symbol versioning. I.e., the dependent
- object was linked against another version of this file. We
- only print a message if verbose output is requested. */
- if (verbose)
- {
- /* XXX We cannot translate the messages. */
- errstring = make_string ("\
-no version information available (required by ", name, ")");
- goto call_cerror;
- }
- return 0;
- }
-
- def = (Elf64_Verdef *) ((char *) map->l_info[VERSYMIDX (DT_VERDEF)]);
- while (1)
- {
- /* Currently the version number of the definition entry is 1.
- Make sure all we see is this version. */
- if (__builtin_expect (def->vd_version, 1) != 1)
- {
- char buf[20];
- buf[sizeof (buf) - 1] = '\0';
- /* XXX We cannot translate the message. */
- /* _itoa (def->vd_version,
- &buf[sizeof (buf) - 1], 10, 0), */
- errstring = make_string ("unsupported version ",
- " of Verdef record");
- result = 1;
- goto call_cerror;
- }
-
- /* Compare the hash values. */
- if (hash == def->vd_hash)
- {
- Elf64_Verdaux *aux = (Elf64_Verdaux *) ((char *) def + def->vd_aux);
-
- /* To be safe, compare the string as well. */
- if (__builtin_expect (strcmp (string, strtab + aux->vda_name), 0)
- == 0)
- /* Bingo! */
- return 0;
- }
-
- /* If no more definitions we failed to find what we want. */
- if (def->vd_next == 0)
- break;
-
- /* Next definition. */
- def = (Elf64_Verdef *) ((char *) def + def->vd_next);
- }
-
- /* Symbol not found. If it was a weak reference it is not fatal. */
- if (__glibc_likely (weak))
- {
- if (verbose)
- {
- /* XXX We cannot translate the message. */
- errstring = make_string ("weak version `", string,
- "' not found (required by ", name, ")");
- goto call_cerror;
- }
- return 0;
- }
-
- /* XXX We cannot translate the message. */
- errstring = make_string ("version `", string, "' not found (required by ",
- name, ")");
- result = 1;
- call_cerror:
- _dl_signal_cerror (0, DSO_FILENAME (map->l_name),
- ("version lookup error"), errstring);
- return result;
-}
-
-
-int
-_dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
-{
- int result = 0;
- const char *strtab;
- /* Pointer to section with needed versions. */
- Elf64_Verneed *dyn;
- /* This file may require special versions from its dependencies. */
- Elf64_Verneed *ent;
- /* Pointer to dynamic section with definitions. */
- Elf64_Verdef *def;
- /* We need to find out which is the highest version index used
- in a dependecy. */
- unsigned int ndx_high = 0;
- /* Initialize to make the compiler happy. */
- const char *errstring = NULL;
- int errval = 0;
-
- /* If we don't have a string table, we must be ok. */
- if (map->l_info[DT_STRTAB] == NULL)
- return 0;
- strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-
- dyn = map->l_info[VERSYMIDX (DT_VERNEED)];
- def = map->l_info[VERSYMIDX (DT_VERDEF)];
- ent = (Elf64_Verneed *) (dyn);
-
- if (dyn != NULL)
- {
-
- /* Currently the version number of the needed entry is 1.
- Make sure all we see is this version. */
- if (__builtin_expect (ent->vn_version, 1) != 1)
- {
- char buf[20];
- buf[sizeof (buf) - 1] = '\0';
- /* XXX We cannot translate the message. */
- /* _itoa (def->vn_version,
- &buf[sizeof (buf) - 1], 10, 0), */
- errstring = make_string ("unsupported version ",
- " of Verneed record\n");
- call_error:
- _dl_signal_error (errval, DSO_FILENAME (map->l_name),
- NULL, errstring);
- }
-
- while (1)
- {
- Elf64_Vernaux *aux;
- struct link_map *needed = find_needed (strtab + ent->vn_file, map);
-
- /* If NEEDED is NULL this means a dependency was not found
- and no stub entry was created. This should never happen. */
- if (needed == NULL)
- {
- _dl_signal_error (errval, NULL, NULL, strtab + ent->vn_file);
- printf("error while loading shared libraries: %s", strtab + ent->vn_file);
- exit (1);
- }
- assert (needed != NULL);
-
- /* Make sure this is no stub we created because of a missing
- dependency. */
- if (__builtin_expect (! trace_mode, 1))
- {
- /* NEEDED is the map for the file we need. Now look for the
- dependency symbols. */
- aux = (Elf64_Vernaux *) ((char *) ent + ent->vn_aux);
- while (1)
- {
- /* Match the symbol. */
- result |= match_symbol (DSO_FILENAME (map->l_name),
- aux->vna_hash,
- strtab + aux->vna_name,
- needed, verbose,
- aux->vna_flags & VER_FLG_WEAK);
-
- /* Compare the version index. */
- if ((unsigned int) (aux->vna_other & 0x7fff) > ndx_high)
- ndx_high = aux->vna_other & 0x7fff;
-
- if (aux->vna_next == 0)
- /* No more symbols. */
- break;
-
- /* Next symbol. */
- aux = (Elf64_Vernaux *) ((char *) aux + aux->vna_next);
- }
- }
-
- if (ent->vn_next == 0)
- /* No more dependencies. */
- break;
-
- /* Next dependency. */
- ent = (Elf64_Verneed *) ((char *) ent + ent->vn_next);
- }
- }
-
- /* We also must store the names of the defined versions. Determine
- the maximum index here as well.
-
- XXX We could avoid the loop by just taking the number of definitions
- as an upper bound of new indeces. */
- if (def != NULL)
- {
- Elf64_Verdef *ent;
- ent = (Elf64_Verdef *) (def);
- while (1)
- {
- if ((unsigned int) (ent->vd_ndx & 0x7fff) > ndx_high)
- ndx_high = ent->vd_ndx & 0x7fff;
-
- if (ent->vd_next == 0)
- /* No more definitions. */
- break;
-
- ent = (Elf64_Verdef *) ((char *) ent + ent->vd_next);
- }
- }
-
- if (ndx_high > 0)
- {
- /* Now we are ready to build the array with the version names
- which can be indexed by the version index in the VERSYM
- section. */
- map->l_versions = (struct r_found_version *)
- calloc (ndx_high + 1, sizeof (*map->l_versions));
- if (__glibc_unlikely (map->l_versions == NULL))
- {
- errstring = ("cannot allocate version reference table");
- errval = ENOMEM;
- goto call_error;
- }
-
- /* Store the number of available symbols. */
- map->l_nversions = ndx_high + 1;
-
- /* Compute the pointer to the version symbols. */
- map->l_versyms = (void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]);
-
- if (dyn != NULL)
- {
- Elf64_Verneed *ent;
- ent = (Elf64_Verneed *) (dyn);
- while (1)
- {
- Elf64_Vernaux *aux;
- aux = (Elf64_Vernaux *) ((char *) ent + ent->vn_aux);
- while (1)
- {
- Elf64_Half ndx = aux->vna_other & 0x7fff;
- /* In trace mode, dependencies may be missing. */
- if (__glibc_likely (ndx < map->l_nversions))
- {
- map->l_versions[ndx].hash = aux->vna_hash;
- map->l_versions[ndx].hidden = aux->vna_other & 0x8000;
- map->l_versions[ndx].name = &strtab[aux->vna_name];
- map->l_versions[ndx].filename = &strtab[ent->vn_file];
- }
-
- if (aux->vna_next == 0)
- /* No more symbols. */
- break;
-
- /* Advance to next symbol. */
- aux = (Elf64_Vernaux *) ((char *) aux + aux->vna_next);
- }
-
- if (ent->vn_next == 0)
- /* No more dependencies. */
- break;
-
- /* Advance to next dependency. */
- ent = (Elf64_Verneed *) ((char *) ent + ent->vn_next);
- }
- }
-
- /* And insert the defined versions. */
- if (def != NULL)
- {
- Elf64_Verdef *ent;
- ent = (Elf64_Verdef *) (def);
- while (1)
- {
- Elf64_Verdaux *aux;
- aux = (Elf64_Verdaux *) ((char *) ent + ent->vd_aux);
-
- if ((ent->vd_flags & VER_FLG_BASE) == 0)
- {
- /* The name of the base version should not be
- available for matching a versioned symbol. */
- Elf64_Half ndx = ent->vd_ndx & 0x7fff;
- map->l_versions[ndx].hash = ent->vd_hash;
- map->l_versions[ndx].name = &strtab[aux->vda_name];
- map->l_versions[ndx].filename = NULL;
- }
-
- if (ent->vd_next == 0)
- /* No more definitions. */
- break;
-
- ent = (Elf64_Verdef *) ((char *) ent + ent->vd_next);
- }
- }
- }
-
- return result;
-}
diff --git a/src/rtld/rtld.c b/src/rtld/rtld.c
deleted file mode 100644
index 8d7d760..0000000
--- a/src/rtld/rtld.c
+++ /dev/null
@@ -1,1446 +0,0 @@
-/* Copyright (C) 2003 MontaVista Software, Inc.
- Written by Daniel Jacobowitz <drow@mvista.com>, 2003
-
- Copyright (C) 2011 Wind River Systems, Inc.
- Significantly updated by Mark Hatle <mark.hatle@windriver.com>, 2011
-
- 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. */
-
-#include <config.h>
-#include <assert.h>
-#include <ctype.h>
-#include <error.h>
-#include <errno.h>
-#include <argp.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <libgen.h>
-
-#include <inttypes.h>
-
-#include "prelinktab.h"
-#include "reloc.h"
-#include "reloc-info.h"
-
-#include "rtld.h"
-
-unsigned int static_binary = 0;
-
-unsigned int _dl_debug_mask = 0;
-
-/* LD_DYNAMIC_WEAK option. Default is off, changing to 1
- is equivalent to setting LD_DYNAMIC_WEAK. */
-unsigned int _dl_dynamic_weak = 0;
-#define MAX_PRELOADED_LIBS 20
-
-struct search_path
-{
- int maxlen, count, allocated;
- char **dirs;
-};
-
-struct search_path ld_dirs, ld_library_search_path;
-int host_paths;
-
-char * dst_ORIGIN;
-char * dst_PLATFORM = ""; /* undefined */
-char * dst_LIB = "lib";
-char * ld_preload = NULL;
-
-
-void string_to_path (struct search_path *path, const char *string);
-
-const char *argp_program_version = PRELINK_RTLD_PROG PKGVERSION " 1.0";
-
-const char *argp_program_bug_address = REPORT_BUGS_TO;
-
-static char argp_doc[] = PRELINK_RTLD_PROG " -- program to simulate the runtime linker";
-
-#define OPT_SYSROOT 0x8c
-#define OPT_LIBRARY_PATH 0x8e
-#define OPT_TARGET_PATHS 0x8f
-#define OPT_LD_PRELOAD 0x90
-
-static struct argp_option options[] = {
- {"library-path", OPT_LIBRARY_PATH, "LIBRARY_PATH", 0, "Set library search path to LIBRARY_PATH" },
- {"root", OPT_SYSROOT, "ROOT_PATH", 0, "Prefix all paths with ROOT_PATH" },
- {"target-paths", OPT_TARGET_PATHS, 0, 0, "Specified paths are based on ROOT_PATH" },
- {"ld-preload", OPT_LD_PRELOAD, "PATHLIST", 0, "List of LD_PRELOAD libraries"},
- { 0 }
-};
-
-static error_t
-parse_opt (int key, char *arg, struct argp_state *state)
-{
- switch (key)
- {
- case OPT_SYSROOT:
- sysroot = arg;
- break;
- case OPT_LIBRARY_PATH:
- string_to_path(&ld_library_search_path, arg);
- break;
- case OPT_TARGET_PATHS:
- host_paths = 0;
- break;
- case OPT_LD_PRELOAD:
- ld_preload = arg;
- break;
- default:
- return ARGP_ERR_UNKNOWN;
- }
- return 0;
-}
-
-/* This function returns the same constants expected by glibc's
- symbol lookup routines. This is slightly different from the
- equivalent routines in prelink. It should return PLT for any
- relocation where an undefined symbol in the application should
- be ignored: typically, this means any jump slot or TLS relocations,
- but not copy relocations. Don't return the prelinker's
- RTYPE_CLASS_TLS. */
-
-/* The following needs to be kept in sync with the
- sysdeps/.../dl-machine.h: elf_machine_type_class macro */
-
-/* From glibc-2.23: sysdeps/i386/dl-machine.h */
-# define i386_elf_machine_type_class(type) \
- ((((type) == R_386_JMP_SLOT || (type) == R_386_TLS_DTPMOD32 \
- || (type) == R_386_TLS_DTPOFF32 || (type) == R_386_TLS_TPOFF32 \
- || (type) == R_386_TLS_TPOFF || (type) == R_386_TLS_DESC) \
- * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_386_COPY) * ELF_RTYPE_CLASS_COPY) \
- | (((type) == R_386_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(EM_386)))
-
-/* From glibc-2.23: sysdeps/x86_64/dl-machine.h */
-# define x86_64_elf_machine_type_class(type) \
- ((((type) == R_X86_64_JUMP_SLOT \
- || (type) == R_X86_64_DTPMOD64 \
- || (type) == R_X86_64_DTPOFF64 \
- || (type) == R_X86_64_TPOFF64 \
- || (type) == R_X86_64_TLSDESC) \
- * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_X86_64_COPY) * ELF_RTYPE_CLASS_COPY) \
- | (((type) == R_X86_64_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(EM_X86_64)))
-
-/* From glibc-2.23: ports/sysdeps/arm/dl-machine.h */
-# define arm_elf_machine_type_class(type) \
- ((((type) == R_ARM_JUMP_SLOT || (type) == R_ARM_TLS_DTPMOD32 \
- || (type) == R_ARM_TLS_DTPOFF32 || (type) == R_ARM_TLS_TPOFF32 \
- || (type) == R_ARM_TLS_DESC) \
- * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY) \
- | (((type) == R_ARM_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(EM_ARM)))
-
-/* From glibc-2.23: ports/sysdeps/aarch64/dl-machine.h */
-# define aarch64_elf_machine_type_class(type) \
- ((((type) == R_AARCH64_JUMP_SLOT || \
- (type) == R_AARCH64_TLS_DTPMOD || \
- (type) == R_AARCH64_TLS_DTPREL || \
- (type) == R_AARCH64_TLS_TPREL || \
- (type) == R_AARCH64_TLSDESC) * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_AARCH64_COPY) * ELF_RTYPE_CLASS_COPY) \
- | (((type) == R_AARCH64_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(EM_AARCH64)))
-
-/* From glibc-2.23: sysdeps/sh/dl-machine.h */
-# define sh_elf_machine_type_class(type) \
- ((((type) == R_SH_JMP_SLOT || (type) == R_SH_TLS_DTPMOD32 \
- || (type) == R_SH_TLS_DTPOFF32 || (type) == R_SH_TLS_TPOFF32) \
- * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_SH_COPY) * ELF_RTYPE_CLASS_COPY))
-
-/* From glibc-2.23: sysdeps/powerpc/powerpc32/dl-machine.h */
-#define powerpc32_elf_machine_type_class(type) \
- ((((type) == R_PPC_JMP_SLOT \
- || (type) == R_PPC_REL24 \
- || ((type) >= R_PPC_DTPMOD32 /* contiguous TLS */ \
- && (type) <= R_PPC_DTPREL32) \
- || (type) == R_PPC_ADDR24) * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_PPC_COPY) * ELF_RTYPE_CLASS_COPY))
-
-/* From glibc-2.23: sysdeps/powerpc/powerpc64/dl-machine.h */
-/* we only support ELFv2 at this point */
-#define IS_PPC64_TLS_RELOC(R) \
- (((R) >= R_PPC64_TLS && (R) <= R_PPC64_DTPREL16_HIGHESTA) \
- || ((R) >= R_PPC64_TPREL16_HIGH && (R) <= R_PPC64_DTPREL16_HIGHA))
-
-#define powerpc64_elf_machine_type_class(type) \
- ((((type) == R_PPC64_JMP_SLOT \
- || (type) == R_PPC64_ADDR24 \
- || IS_PPC64_TLS_RELOC (type)) * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_PPC64_COPY) * ELF_RTYPE_CLASS_COPY))
-
-/* From glibc-2.23: sysdeps/mips/dl-machine.h */
-#define ELF_MACHINE_JMP_SLOT R_MIPS_JUMP_SLOT
-#define mips_elf_machine_type_class(type) \
- ((((type) == ELF_MACHINE_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_MIPS_COPY) * ELF_RTYPE_CLASS_COPY))
-
-/* From glibc-2.23: sysdeps/sparc/sparc32/dl-machine.h */
-#define sparc_elf_machine_type_class(type) \
- ((((type) == R_SPARC_JMP_SLOT \
- || ((type) >= R_SPARC_TLS_GD_HI22 && (type) <= R_SPARC_TLS_TPOFF64)) \
- * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
-
-/* From glibc-2.23: sysdeps/sparc/sparc64/dl-machine.h */
-# define sparc64_elf_machine_type_class(type) \
- ((((type) == R_SPARC_JMP_SLOT \
- || ((type) >= R_SPARC_TLS_GD_HI22 && (type) <= R_SPARC_TLS_TPOFF64)) \
- * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
-
-/* From glibc-2.23: sysdeps/nios2/dl-machine.h */
-# define nios2_elf_machine_type_class(type) \
- ((((type) == R_NIOS2_JUMP_SLOT \
- || (type) == R_NIOS2_TLS_DTPMOD \
- || (type) == R_NIOS2_TLS_DTPREL \
- || (type) == R_NIOS2_TLS_TPREL) * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_NIOS2_COPY) * ELF_RTYPE_CLASS_COPY) \
- | (((type) == R_NIOS2_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(EM_ALTERA_NIOS2)))
-
-int
-elf_machine_type_class (int type, int machine)
-{
- switch (machine)
- {
- case EM_386:
- return i386_elf_machine_type_class(type);
- case EM_X86_64:
- return x86_64_elf_machine_type_class(type);
- case EM_ARM:
- return arm_elf_machine_type_class(type);
- case EM_AARCH64:
- return aarch64_elf_machine_type_class(type);
- case EM_SH:
- return sh_elf_machine_type_class(type);
- case EM_PPC:
- return powerpc32_elf_machine_type_class(type);
- case EM_PPC64:
- return powerpc64_elf_machine_type_class(type);
- case EM_MIPS:
- return mips_elf_machine_type_class(type);
- case EM_SPARC:
- case EM_SPARC32PLUS:
- return sparc_elf_machine_type_class(type);
- case EM_SPARCV9:
- return sparc64_elf_machine_type_class(type);
- case EM_ALTERA_NIOS2:
- return nios2_elf_machine_type_class(type);
-
- default:
- printf ("Unknown architecture!\n");
- exit (1);
- return 0;
- }
-}
-
-int
-extern_protected_data(int machine)
-{
- switch (machine)
- {
- case EM_386:
- case EM_X86_64:
- case EM_ARM:
- case EM_AARCH64:
- case EM_ALTERA_NIOS2:
- return 4;
- default:
- return 0;
- }
-}
-
-int
-machine_no_rela (int machine)
-{
- switch (machine)
- {
- case EM_386:
- case EM_X86_64:
- case EM_ARM:
- case EM_AARCH64:
- case EM_SH:
- case EM_PPC:
- case EM_PPC64:
- case EM_MIPS:
- case EM_SPARC:
- case EM_SPARC32PLUS:
- case EM_SPARCV9:
- case EM_ALTERA_NIOS2:
- return 0;
- default:
- return 1;
- }
-}
-
-int
-machine_no_rel (int machine)
-{
- switch (machine)
- {
- case EM_386:
- case EM_MIPS:
- case EM_ARM:
- return 0;
- default:
- return 1;
- }
-}
-
-int
-is_ldso_soname (const char *soname)
-{
- if ( ! strcmp (soname, "ld-linux.so.2")
- || ! strcmp (soname, "ld-linux.so.3")
- || ! strcmp (soname, "ld.so.1")
- || ! strcmp (soname, "ld-linux-ia64.so.2")
- || ! strcmp (soname, "ld-linux-x86-64.so.2")
- || ! strcmp (soname, "ld64.so.2")
- || ! strcmp (soname, "ld-linux-armhf.so.3")
- || ! strcmp (soname, "ld-linux-aarch64.so.1")
- || ! strcmp (soname, "ld-linux-aarch64_be.so.1")
- || ! strcmp (soname, "ld-linux-nios2.so.1")
- )
- return 1;
- return 0;
-}
-
-static int dso_open_error = 0;
-
-static void
-free_needed (struct needed_list *p)
-{
- struct needed_list *old_p = p;
- while (old_p)
- {
- old_p = p->next;
- free (p);
- p = old_p;
- }
-}
-
-static struct dso_list *
-in_dso_list (struct dso_list *dso_list, const char *soname, const char *filename)
-{
- while (dso_list != NULL)
- {
- if (dso_list->dso != NULL)
- {
- if (strcmp (dso_list->dso->soname, soname) == 0)
- return dso_list;
- }
-
- if (strcmp (dso_list->name, soname) == 0)
- return dso_list;
-
- if (filename && dso_list->canon_filename
- && strcmp (dso_list->canon_filename, filename) == 0)
- return dso_list;
-
- dso_list = dso_list->next;
- }
- return NULL;
-}
-
-static int
-in_needed_list (struct needed_list *needed_list, const char *soname)
-{
- while (needed_list != NULL)
- {
- if (needed_list->ent->dso != NULL
- && strcmp (needed_list->ent->dso->soname, soname) == 0)
- return 1;
- needed_list = needed_list->next;
- }
- return 0;
-}
-
-
-/****/
-
-void
-add_dir (struct search_path *path, const char *dir, int dirlen)
-{
- if (path->allocated == 0)
- {
- path->allocated = 5;
- path->dirs = malloc (sizeof (char *) * 5);
- }
- else if (path->count == path->allocated)
- {
- path->allocated *= 2;
- path->dirs = realloc (path->dirs, sizeof (char *) * path->allocated);
- }
- path->dirs[path->count] = malloc (dirlen + 1);
- memcpy (path->dirs[path->count], dir, dirlen);
- path->dirs[path->count++][dirlen] = 0;
-
- if (path->maxlen < dirlen)
- path->maxlen = dirlen;
-}
-
-void
-free_path (struct search_path *path)
-{
- if (path->allocated)
- {
- int i;
- for (i = 0; i < path->count; i++)
- free (path->dirs[i]);
- free (path->dirs);
- }
-}
-
-void
-load_ld_so_conf (int use_64bit, int use_mipsn32)
-{
- int fd;
- FILE *conf;
- char buf[1024];
-
- memset (&ld_dirs, 0, sizeof (ld_dirs));
-
- /* Only use the correct machine, to prevent mismatches if we
- have both /lib/ld.so and /lib64/ld.so on x86-64. */
- if (use_64bit)
- {
- dst_LIB = "lib64";
- add_dir (&ld_dirs, "/lib64/tls", strlen ("/lib64/tls"));
- add_dir (&ld_dirs, "/lib64", strlen ("/lib64"));
- add_dir (&ld_dirs, "/usr/lib64/tls", strlen ("/usr/lib64/tls"));
- add_dir (&ld_dirs, "/usr/lib64", strlen ("/usr/lib64"));
- }
- else if (use_mipsn32)
- {
- dst_LIB = "lib32";
- add_dir (&ld_dirs, "/lib32/tls", strlen ("/lib32/tls"));
- add_dir (&ld_dirs, "/lib32", strlen ("/lib32"));
- add_dir (&ld_dirs, "/usr/lib32/tls", strlen ("/usr/lib32/tls"));
- add_dir (&ld_dirs, "/usr/lib32", strlen ("/usr/lib32"));
- }
- else
- {
- dst_LIB = "lib";
- add_dir (&ld_dirs, "/lib/tls", strlen ("/lib/tls"));
- add_dir (&ld_dirs, "/lib", strlen ("/lib"));
- add_dir (&ld_dirs, "/usr/lib/tls", strlen ("/usr/lib/tls"));
- add_dir (&ld_dirs, "/usr/lib", strlen ("/usr/lib"));
- }
-
- fd = wrap_open ("/etc/ld.so.conf", O_RDONLY);
- if (fd == -1)
- return;
- conf = fdopen (fd, "r");
- while (fgets (buf, 1024, conf) != NULL)
- {
- int len;
- char *p;
-
- p = strchr (buf, '#');
- if (p)
- *p = 0;
- len = strlen (buf);
- while (len > 0 && isspace (buf[len - 1]))
- buf[--len] = 0;
-
- if (len > 0)
- add_dir (&ld_dirs, buf, len);
- }
- fclose (conf);
-}
-
-void
-string_to_path (struct search_path *path, const char *string)
-{
- const char *start, *end, *end_tmp;
-
- start = string;
- while (1) {
- end = start;
- while (*end && *end != ':' && *end != ';')
- end ++;
-
- /* Eliminate any trailing '/' characters, but be sure to leave a
- leading slash if someeone wants / in their RPATH. */
- end_tmp = end;
- while (end_tmp > start + 1 && end_tmp[-1] == '/')
- end_tmp --;
-
- add_dir (path, start, end_tmp - start);
-
- if (*end == 0)
- break;
-
- /* Skip the separator. */
- start = end + 1;
- }
-}
-
-char *
-find_lib_in_path (struct search_path *path, const char *soname,
- int elfclass, int machine)
-{
- char *ret = NULL;
- int i;
- int alt_machine;
-
- switch (machine)
- {
- case EM_SPARC:
- alt_machine = EM_SPARC32PLUS;
- break;
- case EM_SPARC32PLUS:
- alt_machine = EM_SPARC;
- break;
- default:
- alt_machine = machine;
- break;
- }
-
- for (i = 0; i < path->count; i++)
- {
- char * fixup_path, * path_string;
-
- path_string = fixup_path = strdup(path->dirs[i]);
-
- while ((path_string = strchr (path_string, '$')))
- {
- char * replace = NULL;
- size_t len = 0;
-
- if (strncmp("$ORIGIN", path_string, 7) == 0) {
- replace = dst_ORIGIN;
- len = 7;
- } else if (strncmp("${ORIGIN}", path_string, 9) == 0) {
- replace = dst_ORIGIN;
- len = 9;
- } else if (strncmp("$PLATFORM", path_string, 9) == 0) {
- replace = dst_PLATFORM;
- len = 9;
- } else if (strncmp("${PLATFORM}", path_string, 11) == 0) {
- replace = dst_PLATFORM;
- len = 11;
- } else if (strncmp("$LIB", path_string, 4) == 0) {
- replace = dst_LIB;
- len = 4;
- } else if (strncmp("${LIB}", path_string, 6) == 0) {
- replace = dst_LIB;
- len = 6;
- } else {
- /* Not a defined item, so we skip to the next character */
- path_string += 1;
- }
-
- if (replace) {
- size_t new_path_len = strlen(fixup_path) - len + strlen(replace) + 1;
- char * new_path = malloc(new_path_len);
-
- /* Calculate the new path_string position based on the old position */
- size_t new_path_pos = (path_string - fixup_path) + strlen(replace);
-
- snprintf(new_path, new_path_len, "%.*s%s%s", (int)(path_string-fixup_path),
- fixup_path, replace, path_string + len);
-
- free(fixup_path);
-
- fixup_path = new_path;
- path_string = fixup_path + new_path_pos;
- }
- }
-
- ret = malloc (strlen (soname) + 2 + strlen(fixup_path));
- sprintf (ret, "%s/%s", fixup_path, soname);
-
- if (wrap_access (ret, F_OK) == 0)
- {
- DSO *dso = open_dso (ret);
- int dso_class, dso_machine;
-
- if (dso == NULL)
- continue;
-
- dso_class = gelf_getclass (dso->elf);
- dso_machine = (dso_class == ELFCLASS32) ?
- elf32_getehdr (dso->elf)->e_machine :
- elf64_getehdr (dso->elf)->e_machine;
-
- /* Skip 32-bit libraries when looking for 64-bit. Also
- skip libraries for alternative machines. */
- if (gelf_getclass (dso->elf) != elfclass
- || (dso_machine != machine && dso_machine != alt_machine))
- {
- close_dso (dso);
- continue;
- }
-
- close_dso (dso);
- return ret;
- }
- }
-
- free (ret);
- return NULL;
-}
-
-char *
-find_lib_by_soname (const char *soname, struct dso_list *loader,
- int elfclass, int machine)
-{
- char *ret;
-
- if (strchr (soname, '/'))
- return strdup (soname);
-
- if (is_ldso_soname (soname))
- /* For dynamic linker, pull the path out of PT_INTERP header.
- When loading an executable the dynamic linker creates an entry for
- itself under the name stored in PT_INTERP, and the name that we
- record in .gnu.liblist should match that exactly. */
- {
- struct dso_list *loader_p = loader;
-
- while (loader_p)
- {
- if (loader_p->dso->ehdr.e_type == ET_EXEC)
- {
- int i;
-
- for (i = 0; i < loader_p->dso->ehdr.e_phnum; ++i)
- if (loader_p->dso->phdr[i].p_type == PT_INTERP)
- {
- const char *interp;
- interp = get_data (loader_p->dso,
- loader_p->dso->phdr[i].p_vaddr,
- NULL, NULL);
- return strdup (interp);
- }
- }
- loader_p = loader_p->loader;
- }
- }
-
- if (loader->dso->info[DT_RUNPATH] == 0)
- {
- /* Search DT_RPATH all the way up. */
- struct dso_list *loader_p = loader;
- while (loader_p)
- {
- if (loader_p->dso->info[DT_RPATH])
- {
- struct search_path r_path;
- const char *rpath = get_data (loader_p->dso,
- loader_p->dso->info[DT_STRTAB]
- + loader_p->dso->info[DT_RPATH],
- NULL, NULL);
- memset (&r_path, 0, sizeof (r_path));
- string_to_path (&r_path, rpath);
- ret = find_lib_in_path (&r_path, soname, elfclass, machine);
- free_path (&r_path);
- if (ret)
- return ret;
- }
- loader_p = loader_p->loader;
- }
- }
-
- ret = find_lib_in_path (&ld_library_search_path, soname, elfclass, machine);
- if (ret)
- return ret;
-
- if (loader->dso->info[DT_RUNPATH])
- {
- struct search_path r_path;
- const char *rpath = get_data (loader->dso,
- loader->dso->info[DT_STRTAB]
- + loader->dso->info[DT_RUNPATH],
- NULL, NULL);
- memset (&r_path, 0, sizeof (r_path));
- string_to_path (&r_path, rpath);
- ret = find_lib_in_path (&r_path, soname, elfclass, machine);
- free_path (&r_path);
- if (ret)
- return ret;
- }
-
- ret = find_lib_in_path (&ld_dirs, soname, elfclass, machine);
- if (ret)
- return ret;
-
- return NULL;
-}
-
-static struct dso_list *
-load_dsos (DSO *dso, int host_paths)
-{
- struct dso_list *dso_list, *dso_list_tail, *cur_dso_ent, *new_dso_ent;
- struct stat64 st;
- int total_preload = 0;
- char * libname[MAX_PRELOADED_LIBS] = {NULL};
-
- /* Assume it's static unless we find DT_NEEDED entries */
- static_binary = 1;
-
- dso_list = malloc (sizeof (struct dso_list));
- dso_list->dso = dso;
- dso_list->map = NULL;
- dso_list->next = NULL;
- dso_list->prev = NULL;
- dso_list->needed = NULL;
- dso_list->name = dso->filename;
- dso_list->loader = NULL;
-
- if (host_paths)
- dso_list->canon_filename = canonicalize_file_name (dso->filename);
- else
- dso_list->canon_filename = prelink_canonicalize (dso->filename, &st);
-
- if (dso_list->canon_filename == NULL)
- dso_list->canon_filename = strdup (dso->filename);
-
- cur_dso_ent = dso_list_tail = dso_list;
-
- if(dso->ehdr.e_type == ET_EXEC && ld_preload) {
- char *next_lib = ld_preload;
- libname[total_preload] = ld_preload;
- total_preload++;
- next_lib=strchr(ld_preload,':');
- while(next_lib!=NULL){
- *next_lib = '\0';
- next_lib++;
- libname[total_preload] = next_lib;
- total_preload++;
- next_lib=strchr(next_lib,':');
- }
- }
- else {
- total_preload = 0;
- }
- while (cur_dso_ent != NULL)
- {
- DSO *cur_dso, *new_dso;
- Elf_Scn *scn;
- Elf_Data *data;
- GElf_Dyn dyn;
-
- cur_dso = cur_dso_ent->dso;
- if (cur_dso == NULL)
- {
- cur_dso_ent = cur_dso_ent->next;
- continue;
- }
-
- scn = cur_dso->scn[cur_dso->dynamic];
- data = NULL;
- while ((data = elf_getdata (scn, data)) != NULL)
- {
- int ndx, maxndx;
- maxndx = data->d_size / cur_dso->shdr[cur_dso->dynamic].sh_entsize;
- for (ndx = 0; ndx < maxndx + total_preload; ++ndx)
- {
-
- if(ndx - total_preload >= 0) {
- gelfx_getdyn (cur_dso->elf, data, ndx - total_preload, &dyn);
- }
- else {
- dyn.d_tag = DT_NEEDED;
- }
-
- if (dyn.d_tag == DT_NULL)
- break;
- if (dyn.d_tag == DT_NEEDED)
- {
- /* Not static... */
- static_binary = 0;
-
- char *new_name=NULL, *new_canon_name=NULL;
- const char * soname = NULL;
- if(ndx - total_preload >= 0) {
- soname = get_data (cur_dso,
- cur_dso->info[DT_STRTAB]
- + dyn.d_un.d_val,
- NULL, NULL);
- }
- else {
- soname = libname[ndx];
- }
-
- new_dso_ent = in_dso_list (dso_list, soname, NULL);
- if (new_dso_ent == NULL)
- {
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
- _dl_debug_printf ("file=%s [0]; needed by %s [0]\n",
- soname, cur_dso->filename);
-
- int machine;
- int class = gelf_getclass (dso->elf);
- machine = (class == ELFCLASS32) ?
- elf32_getehdr (dso->elf)->e_machine :
- elf64_getehdr (dso->elf)->e_machine;
- new_name = find_lib_by_soname (soname, cur_dso_ent,
- class, machine);
- if (new_name == 0 || wrap_access (new_name, R_OK) < 0)
- {
- dso_open_error ++;
-
- new_dso_ent = malloc (sizeof (struct dso_list));
- dso_list_tail->next = new_dso_ent;
- dso_list_tail->next->prev = dso_list_tail;
- dso_list_tail = dso_list_tail->next;
- dso_list_tail->next = NULL;
- dso_list_tail->dso = NULL;
- dso_list_tail->map = NULL;
- dso_list_tail->needed = NULL;
- dso_list_tail->name = soname;
- dso_list_tail->loader = NULL;
- dso_list_tail->canon_filename = strdup(soname);
- dso_list_tail->err_no = errno;
-
- continue;
- }
-
- /* See if the filename we found has already been
- opened (possibly under a different SONAME via
- some symlink). */
- new_canon_name = prelink_canonicalize (new_name, NULL);
- if (new_canon_name == NULL)
- new_canon_name = strdup (new_name);
- new_dso_ent = in_dso_list (dso_list, soname, new_canon_name);
- }
- else if (new_dso_ent->dso == NULL)
- continue;
-
- if (new_dso_ent == NULL)
- {
- new_dso = open_dso (new_name);
- free (new_name);
- new_dso_ent = malloc (sizeof (struct dso_list));
- dso_list_tail->next = new_dso_ent;
- dso_list_tail->next->prev = dso_list_tail;
- dso_list_tail = dso_list_tail->next;
- dso_list_tail->next = NULL;
- dso_list_tail->dso = new_dso;
- dso_list_tail->map = NULL;
- dso_list_tail->needed = NULL;
- dso_list_tail->loader = cur_dso_ent;
- dso_list_tail->canon_filename = new_canon_name;
- dso_list_tail->err_no = 0;
-
- if (is_ldso_soname (new_dso->soname))
- dso_list_tail->name = new_dso->filename;
- else if (strcmp (new_dso->soname, new_dso->filename) == 0)
- /* new_dso->soname might be a full path if the library
- had no SONAME. Use the original SONAME instead. */
- dso_list_tail->name = soname;
- else
- /* Use the new SONAME if possible, in case some library
- links to this one using an incorrect SONAME. */
- dso_list_tail->name = new_dso->soname;
- }
-
- if (!cur_dso_ent->needed)
- {
- cur_dso_ent->needed = malloc (sizeof (struct needed_list));
- cur_dso_ent->needed_tail = cur_dso_ent->needed;
- cur_dso_ent->needed_tail->ent = new_dso_ent;
- cur_dso_ent->needed_tail->next = NULL;
- }
- else if (!in_needed_list (cur_dso_ent->needed, soname))
- {
- cur_dso_ent->needed_tail->next = malloc (sizeof (struct needed_list));
- cur_dso_ent->needed_tail = cur_dso_ent->needed_tail->next;
- cur_dso_ent->needed_tail->ent = new_dso_ent;
- cur_dso_ent->needed_tail->next = NULL;
- }
-
- continue;
- }
- if (dyn.d_tag == DT_FILTER || dyn.d_tag == DT_AUXILIARY)
- {
- // big fat warning;
- }
- }
- }
- cur_dso_ent = cur_dso_ent->next;
- }
- return dso_list;
-}
-
-struct
-{
- void *symptr;
- int rtypeclass;
-} cache;
-
-void
-do_reloc (DSO *dso, struct link_map *map, struct r_scope_elem *scope[],
- GElf_Word sym, GElf_Word type)
-{
- struct r_found_version *ver;
- int rtypeclass;
- void *symptr;
- const char *name;
- Elf64_Word st_name;
-
- if (map->l_versyms)
- {
- int vernum = map->l_versyms[sym] & 0x7fff;
- ver = &map->l_versions[vernum];
-
- /* Memory was allocated for the hash table, but it's empty! */
- if (ver && (ver->name == NULL || ver->hash == 0))
- ver = NULL;
- }
- else
- ver = NULL;
-
- rtypeclass = elf_machine_type_class (type, dso->ehdr.e_machine);
-
- if (gelf_getclass (dso->elf) == ELFCLASS32)
- {
- Elf32_Sym *sym32 = &((Elf32_Sym *)map->l_info[DT_SYMTAB])[sym];
-
- if (ELF32_ST_BIND (sym32->st_info) == STB_LOCAL)
- return;
- symptr = sym32;
- st_name = sym32->st_name;
- }
- else
- {
- Elf64_Sym *sym64 = &((Elf64_Sym *)map->l_info[DT_SYMTAB])[sym];
-
- if (ELF64_ST_BIND (sym64->st_info) == STB_LOCAL)
- return;
- symptr = sym64;
- st_name = sym64->st_name;
- }
-
- if (cache.symptr == symptr && cache.rtypeclass == rtypeclass)
- return;
- cache.symptr = symptr;
- cache.rtypeclass = rtypeclass;
-
- name = ((const char *)map->l_info[DT_STRTAB]) + st_name;
-
- if (gelf_getclass (dso->elf) == ELFCLASS32)
- {
- const Elf32_Sym *sym32 = symptr;
- rtld_lookup_symbol_x32 (name, map, &sym32, scope, ver, rtypeclass,
- 0, NULL);
- symptr = (void *) sym32;
- }
- else
- {
- const Elf64_Sym *sym64 = symptr;
- rtld_lookup_symbol_x64 (name, map, &sym64, scope, ver, rtypeclass,
- 0, NULL);
- symptr = (void *) sym64;
- }
-}
-
-void
-do_rel_section (DSO *dso, struct link_map *map,
- struct r_scope_elem *scope[],
- int tag, int section)
-{
- Elf_Data *data;
- int ndx, maxndx, sym, type;
-
- data = elf_getdata (dso->scn[section], NULL);
- maxndx = data->d_size / dso->shdr[section].sh_entsize;
- for (ndx = 0; ndx < maxndx; ndx++)
- {
- if (tag == DT_REL)
- {
- GElf_Rel rel;
- gelfx_getrel (dso->elf, data, ndx, &rel);
- sym = reloc_r_sym (dso, rel.r_info);
- type = reloc_r_type (dso, rel.r_info);
- }
- else
- {
- GElf_Rela rela;
- gelfx_getrela (dso->elf, data, ndx, &rela);
- sym = reloc_r_sym (dso, rela.r_info);
- type = reloc_r_type (dso, rela.r_info);
- }
- if (sym != 0)
- do_reloc (dso, map, scope, sym, type);
- }
-}
-
-void
-do_relocs (DSO *dso, struct link_map *map, struct r_scope_elem *scope[], int tag)
-{
- GElf_Addr rel_start, rel_end;
- GElf_Addr pltrel_start, pltrel_end;
- int first, last;
-
- /* Load the DT_REL or DT_RELA section. */
- if (dso->info[tag] != 0)
- {
- rel_start = dso->info[tag];
- rel_end = rel_start + dso->info[tag == DT_REL ? DT_RELSZ : DT_RELASZ];
- first = addr_to_sec (dso, rel_start);
- last = addr_to_sec (dso, rel_end - 1);
- while (first <= last)
- do_rel_section (dso, map, scope, tag, first++);
-
- /* If the DT_JMPREL relocs are of the same type and not included,
- load them too. Assume they overlap completely or not at all,
- and are in at most a single section. They also need to be adjacent. */
- if (dso->info[DT_PLTREL] == tag)
- {
- pltrel_start = dso->info[DT_JMPREL];
- pltrel_end = pltrel_start + dso->info[DT_PLTRELSZ];
- if (pltrel_start < rel_start || pltrel_end >= rel_end)
- do_rel_section (dso, map, scope, tag, addr_to_sec (dso, pltrel_start));
- }
- }
- else if (dso->info[DT_PLTREL] == tag)
- do_rel_section (dso, map, scope, tag, addr_to_sec (dso, dso->info[DT_JMPREL]));
-}
-
-/* MIPS GOTs are not handled by normal relocations. Instead, entry X
- in the global GOT is associated with symbol DT_MIPS_GOTSYM + X.
- For the purposes of symbol lookup and conflict resolution, we need
- to act as though entry X had a dynamic relocation against symbol
- DT_MIPS_GOTSYM + X. */
-
-void
-do_mips_global_got_relocs (DSO *dso, struct link_map *map,
- struct r_scope_elem *scope[])
-{
- GElf_Word i;
-
- for (i = dso->info_DT_MIPS_GOTSYM; i < dso->info_DT_MIPS_SYMTABNO; i++)
- do_reloc (dso, map, scope, i, R_MIPS_REL32);
-}
-
-void
-handle_relocs_in_entry (struct dso_list *entry, struct dso_list *dso_list)
-{
- do_relocs (entry->dso, entry->map, dso_list->map->l_local_scope, DT_REL);
- do_relocs (entry->dso, entry->map, dso_list->map->l_local_scope, DT_RELA);
- if (entry->dso->ehdr.e_machine == EM_MIPS)
- do_mips_global_got_relocs (entry->dso, entry->map,
- dso_list->map->l_local_scope);
-}
-
-void
-handle_relocs (DSO *dso, struct dso_list *dso_list)
-{
- struct dso_list *ldso, *tail;
-
- /* do them all last to first.
- skip the dynamic linker; then do it last
- in glibc this is conditional on the opencount; but every binary
- should be linked to libc and thereby have an opencount for ld.so...
- besides, that's the only way it would get on our dso list. */
-
- tail = dso_list;
- while (tail->next)
- tail = tail->next;
-
- ldso = NULL;
- while (tail)
- {
- if (is_ldso_soname (tail->dso->soname))
- ldso = tail;
- else
- handle_relocs_in_entry (tail, dso_list);
- tail = tail->prev;
- }
-
- if (ldso)
- handle_relocs_in_entry (ldso, dso_list);
-}
-
-void
-build_local_scope (struct dso_list *ent, int max)
-{
- int i, j;
- struct dso_list *dso, **dsos;
- int ndsos; struct needed_list *n;
- struct r_scope_elem *scope;
- struct link_map **list;
-
- dsos = malloc (sizeof (struct dso_list *) * max);
- dsos[0] = ent;
- ndsos = 1;
-
- for (i = 0; i < ndsos; ++i)
- for (n = dsos[i]->needed; n; n = n->next)
- {
- dso = n->ent;
- for (j = 0; j < ndsos; ++j)
- if (dsos[j]->map == dso->map)
- break;
- if (j == ndsos)
- dsos[ndsos++] = dso;
- }
-
- ent->map->l_local_scope[0] = scope = malloc (sizeof (struct r_scope_elem));
- scope->r_list = list = malloc (sizeof (struct link_map *) * max);
- scope->r_nlist = ndsos;
-
- for (i = 0; i < ndsos; ++i)
- list[i] = dsos[i]->map;
-
- free(dsos);
-}
-
-static struct argp argp = { options, parse_opt, "[FILES]", argp_doc };
-
-struct link_map *requested_map = NULL;
-
-static void process_one_dso (DSO *dso, int host_paths);
-
-int
-main(int argc, char **argv)
-{
- int remaining;
- int multiple = 0;
- host_paths = 1;
-
- char * debug = NULL;
-
- sysroot = getenv ("PRELINK_SYSROOT");
-#ifdef DEFAULT_SYSROOT
- if (sysroot == NULL)
- {
- extern char *make_relative_prefix (const char *, const char *, const char *);
- sysroot = make_relative_prefix (argv[0], BINDIR, DEFAULT_SYSROOT);
- }
-#endif
-
- elf_version (EV_CURRENT);
-
- argp_parse (&argp, argc, argv, 0, &remaining, 0);
-
- if (sysroot)
- sysroot = canonicalize_file_name (sysroot);
-
- if (remaining == argc)
- error (1, 0, "missing file arguments\nTry `%s: --help' for more information.", argv[0]);
-
- if ((argc-remaining) >= 2)
- multiple = 1;
-
- /* More simplistic then glibc, one option only... */
- debug = getenv ("RTLD_DEBUG");
- if (debug && (!strcmp(debug, "files") || !strcmp(debug, "all")))
- _dl_debug_mask |= DL_DEBUG_FILES;
-
- if (debug && (!strcmp(debug, "symbols") || !strcmp(debug, "all")))
- _dl_debug_mask |= DL_DEBUG_SYMBOLS;
-
- if (debug && (!strcmp(debug, "versions") || !strcmp(debug, "all")))
- _dl_debug_mask |= DL_DEBUG_VERSIONS;
-
- if (debug && (!strcmp(debug, "bindings") || !strcmp(debug, "all")))
- _dl_debug_mask |= DL_DEBUG_BINDINGS;
-
- if (debug && (!strcmp(debug, "scopes") || !strcmp(debug, "all")))
- _dl_debug_mask |= DL_DEBUG_SCOPES;
-
- while (remaining < argc)
- {
- DSO *dso = NULL;
- int i, fd;
-
- struct stat64 st;
-
- if (host_paths)
- fd = open (argv[remaining], O_RDONLY);
- else
- fd = wrap_open (argv[remaining], O_RDONLY);
-
- if (fd >= 0 && fstat64(fd, &st) == 0)
- if (!S_ISREG(st.st_mode))
- {
- error (0, 0, "%s: %s",
- argv[remaining],
- "not regular file");
- goto exit;
- }
-
- if (fd >= 0) {
- dso = fdopen_dso (fd, argv[remaining]);
- dst_ORIGIN = dirname(strdup(dso->filename));
- }
-
- if (dso == NULL)
- {
- error (0, 0, "%s: %s",
- argv[remaining],
- strerror(errno));
- goto exit;
- }
-
- load_ld_so_conf (gelf_getclass (dso->elf) == ELFCLASS64,
- ( dso->ehdr.e_machine == EM_MIPS) && ( dso->ehdr.e_flags & EF_MIPS_ABI2 ) );
-
- if (multiple)
- printf ("%s:\n", argv[remaining]);
-
- for (i = 0; i < dso->ehdr.e_phnum; ++i)
- if (dso->phdr[i].p_type == PT_INTERP)
- break;
-
- /* If there are no PT_INTERP segments, it is statically linked. */
- if (dso->ehdr.e_type == ET_EXEC && i == dso->ehdr.e_phnum)
- printf ("\tnot a dynamic executable\n");
- else
- {
- int j;
- Elf_Data *data;
- j = addr_to_sec (dso, dso->phdr[i].p_vaddr);
- if (j != -1)
- {
- data = elf_getdata (dso->scn[j], NULL);
- if (data != NULL)
- {
- i = strnlen (data->d_buf, data->d_size);
- if (i == data->d_size)
- {
- rtld_signal_error (0, dso->filename, NULL, ".interp section not zero terminated", 0);
- }
- else
- {
- rtld_progname = strdup (data->d_buf);
- }
- }
- }
- process_one_dso (dso, host_paths);
- }
-
-exit:
- remaining++;
- }
-
- return 0;
-}
-
-/* If you run ldd /lib/ld.so you get:
- \tstatically linked
-
- The prelink-rtld does not do this, and returns blank...
- */
-static void
-process_one_dso (DSO *dso, int host_paths)
-{
- struct dso_list *dso_list, *cur_dso_ent, *old_dso_ent;
- const char *req;
- int i;
- int ld_warn = 1;
-
- if ((req = getenv ("RTLD_TRACE_PRELINKING")) != NULL)
- _dl_debug_mask |= DL_DEBUG_PRELINK;
-
- /* Close enough. Really it's if LD_WARN is "" and RTLD_TRACE_PRELINKING. */
- if (getenv ("RTLD_WARN") == NULL)
- ld_warn = 0;
-
- /* Initialize unique symtable list */
- _ns_unique_sym_table = calloc(sizeof (struct unique_sym_table), 1);
-
- dso_list = load_dsos (dso, host_paths);
-
- cur_dso_ent = dso_list;
- i = 0;
- while (cur_dso_ent)
- {
- if (cur_dso_ent->dso)
- {
- create_map_object_from_dso_ent (cur_dso_ent);
- if ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK) && strcmp (req, cur_dso_ent->dso->filename) == 0)
- requested_map = cur_dso_ent->map;
- }
- else
- {
- /* This is a dummy entry, we couldn't find the object */
- cur_dso_ent->map = _dl_new_object(cur_dso_ent->name, cur_dso_ent->canon_filename, lt_library);
- }
- i++;
- cur_dso_ent = cur_dso_ent->next;
- }
- dso_list->map->l_local_scope[0] = malloc (sizeof (struct r_scope_elem));
- dso_list->map->l_local_scope[0]->r_list = malloc (sizeof (struct link_map *) * i);
- dso_list->map->l_local_scope[0]->r_nlist = i;
- cur_dso_ent = dso_list;
- i = 0;
-
- while (cur_dso_ent)
- {
- if (cur_dso_ent->map)
- {
- dso_list->map->l_local_scope[0]->r_list[i] = cur_dso_ent->map;
- build_local_scope (cur_dso_ent, dso_list->map->l_local_scope[0]->r_nlist);
-
- i++;
- }
- cur_dso_ent = cur_dso_ent->next;
- }
-
- cur_dso_ent = dso_list;
-
- for (i = 0; i < cur_dso_ent->map->l_local_scope[0]->r_nlist; ++i)
- if (cur_dso_ent->map->l_local_scope[0]->r_list[i]->l_versions == NULL)
- _dl_check_map_versions (cur_dso_ent->map->l_local_scope[0]->r_list[i], 0, 0);
-
- rtld_determine_tlsoffsets (dso->ehdr.e_machine, dso_list->map->l_local_scope[0]);
-
- cur_dso_ent = dso_list;
-
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
- {
- _dl_debug_printf ("Initial object scopes\n");
-
- while (cur_dso_ent)
- {
- if (cur_dso_ent->map)
- _dl_show_scope (cur_dso_ent->map, 0);
- cur_dso_ent = cur_dso_ent->next;
- }
- }
-
- /* In ldd mode, do not show the application. Note that we do show it
- in list-loaded-objects RTLD_TRACE_PRELINK mode. */
- if (!(GLRO(dl_debug_mask) & DL_DEBUG_PRELINK) && cur_dso_ent)
- {
- /* Based on the presence of DT_NEEDED, see load_dsos */
- if (static_binary)
- {
- printf ("\tstatically linked\n");
- }
- cur_dso_ent = cur_dso_ent->next;
- }
- while (cur_dso_ent)
- {
- char *filename;
-
- if (host_paths && sysroot && cur_dso_ent->dso)
- {
- const char *rooted_filename;
-
- if (cur_dso_ent->dso->filename[0] == '/')
- rooted_filename = cur_dso_ent->dso->filename;
- else
- rooted_filename = cur_dso_ent->canon_filename;
-
- filename = malloc (strlen (rooted_filename) + strlen (sysroot) + 1);
- strcpy (filename, sysroot);
- strcat (filename, rooted_filename);
- }
- else if (cur_dso_ent->dso)
- filename = strdup (cur_dso_ent->dso->filename);
- else
- filename = NULL;
-
- int size_pointer = 16;
- if (cur_dso_ent && cur_dso_ent->dso && gelf_getclass (cur_dso_ent->dso->elf) == ELFCLASS32)
- size_pointer = 8;
-
- /* The difference between the two numbers must be dso->base,
- and the first number must be unique. */
- if (dso_open_error && ld_warn && (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK))
- {
- if (cur_dso_ent->dso == NULL)
- rtld_signal_error(cur_dso_ent->err_no, cur_dso_ent->name, NULL, "cannot open shared object file", 0);
- }
- else if (cur_dso_ent->dso == NULL)
- printf ("\t%s => not found\n", cur_dso_ent->name);
- else if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
- {
- struct link_map * l = cur_dso_ent->map;
- if (size_pointer == 16)
- printf ("\t%s => %s (0x%016"PRIx64", 0x%016"PRIx64")",
- cur_dso_ent->name ? cur_dso_ent->name
- : rtld_progname ?: "<main program>",
- filename ? filename
- : rtld_progname ?: "<main program>",
- (uint64_t) l->l_map_start,
- (uint64_t) (l->l_map_start == cur_dso_ent->dso->base ? 0 : l->l_map_start));
- else
- printf ("\t%s => %s (0x%08"PRIx32", 0x%08"PRIx32")",
- cur_dso_ent->name ? cur_dso_ent->name
- : rtld_progname ?: "<main program>",
- filename ? filename
- : rtld_progname ?: "<main program>",
- (uint32_t) l->l_map_start,
- (uint32_t) (l->l_map_start == cur_dso_ent->dso->base ? 0 : l->l_map_start));
-
- if (l->l_tls_modid)
- if (size_pointer == 16)
- printf (" TLS(0x%"PRIx64", 0x%016"PRIx64")\n",
- (uint64_t) l->l_tls_modid,
- (uint64_t) l->l_tls_offset);
- else
- printf (" TLS(0x%"PRIx32", 0x%08"PRIx32")\n",
- (uint32_t) l->l_tls_modid,
- (uint32_t) l->l_tls_offset);
- else
- printf ("\n");
- }
- else
- {
- struct link_map * l = cur_dso_ent->map;
- if (!(GLRO(dl_debug_mask) & DL_DEBUG_PRELINK) && strcmp (cur_dso_ent->name, filename) == 0)
- if (size_pointer == 16)
- printf ("\t%s (0x%016"PRIx64")\n", cur_dso_ent->name,
- (uint64_t) l->l_map_start);
- else
- printf ("\t%s (0x%08"PRIx32")\n", cur_dso_ent->name,
- (uint32_t) l->l_map_start);
- else
- if (size_pointer == 16)
- printf ("\t%s => %s (0x%016"PRIx64")\n", cur_dso_ent->name,
- filename,
- (uint64_t) l->l_map_start);
- else
- printf ("\t%s => %s (0x%08"PRIx32")\n", cur_dso_ent->name,
- filename,
- (uint32_t) l->l_map_start);
- }
-
- if (filename)
- free (filename);
-
- cur_dso_ent = cur_dso_ent->next;
- }
-
- if (dso_open_error)
- exit (127);
-
- if (!ld_warn && (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK))
- handle_relocs (dso_list->dso, dso_list);
-
- cur_dso_ent = dso_list;
- while (cur_dso_ent)
- {
- if (cur_dso_ent->dso)
- close_dso (cur_dso_ent->dso);
- old_dso_ent = cur_dso_ent;
- cur_dso_ent = cur_dso_ent->next;
- if (old_dso_ent->needed)
- free_needed (old_dso_ent->needed);
- free (old_dso_ent);
- }
-}
diff --git a/src/rtld/rtld.h b/src/rtld/rtld.h
deleted file mode 100644
index 8c6d395..0000000
--- a/src/rtld/rtld.h
+++ /dev/null
@@ -1,337 +0,0 @@
-#ifndef _LD_LIBS_H
-#define _LD_LIBS_H
-
-#include <stdlib.h>
-
-#include "prelinktab.h"
-
-#include <elf.h>
-
-#if !defined (__linux__)
-#define DT_VERSIONTAGNUM 16
-#endif
-
-#define link_map ldlibs_link_map
-
-struct needed_list
-{
- struct dso_list *ent;
- struct needed_list *next;
-};
-
-struct dso_list
-{
- DSO *dso;
- struct link_map *map;
- struct dso_list *next, *prev;
- struct needed_list *needed, *needed_tail;
- const char *name;
- struct dso_list *loader;
- const char *canon_filename;
- int err_no;
-};
-
-/* A data structure for a simple single linked list of strings. */
-struct libname_list
- {
- const char *name; /* Name requested (before search). */
- struct libname_list *next; /* Link to next name for this object. */
- };
-
-struct link_map;
-
-struct r_scope_elem
-{
- struct link_map **r_list;
- unsigned int r_nlist;
-};
-
-struct r_found_version
- {
- const char *name;
- Elf64_Word hash;
-
- int hidden;
- const char *filename;
- };
-
-struct unique_sym_table
- {
- struct unique_sym
- {
- uint32_t hashval;
- const char *name;
- const void *sym;
- const struct link_map *map;
- } *entries;
- size_t size;
- size_t n_elements;
- void (*free) (void *);
- };
-
-extern struct unique_sym_table * _ns_unique_sym_table;
-
-/* The size of entries in .hash. Only Alpha and 64-bit S/390 use 64-bit
- entries; those are not currently supported. */
-typedef uint32_t Elf_Symndx;
-
-/* Mimic libc/include/link.h struct link_map */
-
-struct link_map
- {
- int elfclass;
-
- const char *l_name;
-
- struct libname_list *l_libname;
-
-#undef DT_THISPROCNUM
-#define DT_THISPROCNUM 0
-
- void *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
- + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];
-
- /* Array with vesion names. */
- struct r_found_version *l_versions;
- unsigned int l_nversions;
-
- /* Symbol hash table. */
- Elf_Symndx l_nbuckets;
- /* Begin PPC64 workaround */
- void *l_buckets_start;
- void *l_buckets_end;
- /* end workaround */
- Elf32_Word l_gnu_bitmask_idxbits;
- Elf32_Word l_gnu_shift;
- void *l_gnu_bitmask;
- union
- {
- const Elf32_Word *l_gnu_buckets;
- const Elf_Symndx *l_chain;
- };
- union
- {
- const Elf32_Word *l_gnu_chain_zero;
- const Elf_Symndx *l_buckets;
- };
-
- enum /* Where this object came from. */
- {
- lt_executable, /* The main executable program. */
- lt_library, /* Library needed by main executable. */
- lt_loaded /* Extra run-time loaded shared object. */
- } l_type:2;
-
- /* Pointer to the version information if available. */
- Elf64_Versym *l_versyms;
-
- /* Start and finish of memory map for this object. l_map_start
- need not be the same as l_addr. */
- Elf64_Addr l_map_start;
-
- /* A similar array, this time only with the local scope. This is
- used occasionally. */
- struct r_scope_elem *l_local_scope[2];
-
- /* Thread-local storage related info. */
-
- /* Size of the TLS block. */
- uint64_t l_tls_blocksize;
- /* Alignment requirement of the TLS block. */
- uint64_t l_tls_align;
- /* Offset of first byte module alignment. */
- uint64_t l_tls_firstbyte_offset;
-
- /* For objects present at startup time: offset in the static TLS block. */
- uint64_t l_tls_offset;
- /* Index of the module in the dtv array. */
- uint64_t l_tls_modid;
-
- Elf64_Addr sym_base;
- const char *filename;
-
- Elf64_Half machine;
- };
-
-#define ELF_RTYPE_CLASS_COPY 2
-#define ELF_RTYPE_CLASS_PLT 1
-
-int elf_machine_type_class(int type, int machine);
-
-int extern_protected_data(int machine);
-#define ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(machine) extern_protected_data(machine)
-
-int machine_no_rela(int machine);
-#define ELF_MACHINE_NO_RELA(machine) machine_no_rela(machine)
-
-int machine_no_rel(int machine);
-#define ELF_MACHINE_NO_REL(machine) machine_no_rel(machine)
-
-#define GL(x) _##x
-#define GLRO(x) _##x
-#define INTUSE(x) x
-
-#define D_PTR(MAP,MEM) MAP->MEM
-#define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
-
-extern unsigned int _dl_debug_mask;
-extern unsigned int _dl_dynamic_weak;
-
-extern const char *rtld_progname;
-
-/* This is an optional value before the ':' when debuging is enabled. */
-/* Typically glibc sets this to a number of spaces and the pid of the process*/
-#ifndef RTLD_DEBUG_PID
-# define RTLD_DEBUG_PID " "
-#endif
-#define _dl_debug_printf(...) printf( RTLD_DEBUG_PID ":\t" __VA_ARGS__)
-
-#define _dl_debug_printf_c printf
-
-#define __rtld_lock_lock_recursive(NAME)
-#define __rtld_lock_unlock_recursive(NAME)
-
-/* glibc-2.23: sysdeps/generic/ldsodefs.h */
-/* The filename itself, or the main program name, if available. */
-#define DSO_FILENAME(name) ((name)[0] ? (name) \
- : (rtld_progname ?: "<main program>"))
-
-#define RTLD_PROGNAME (rtld_progname ?: "<program name unknown>")
-
-/* glibc-2.23: sysdeps/generic/ldsodefs.h */
-#define DL_DEBUG_LIBS (1 << 0)
-#define DL_DEBUG_IMPCALLS (1 << 1)
-#define DL_DEBUG_BINDINGS (1 << 2)
-#define DL_DEBUG_SYMBOLS (1 << 3)
-#define DL_DEBUG_VERSIONS (1 << 4)
-#define DL_DEBUG_RELOC (1 << 5)
-#define DL_DEBUG_FILES (1 << 6)
-#define DL_DEBUG_STATISTICS (1 << 7)
-#define DL_DEBUG_UNUSED (1 << 8)
-#define DL_DEBUG_SCOPES (1 << 9)
-/* These two are used only internally. */
-#define DL_DEBUG_HELP (1 << 10)
-#define DL_DEBUG_PRELINK (1 << 11)
-
-#define _dl_trace_prelink_map requested_map
-
-extern struct link_map *requested_map;
-
-#ifndef __glibc_unlikely
-#define __glibc_unlikely(a) (a)
-#endif
-
-#ifndef __glibc_likely
-#define __glibc_likely(a) (a)
-#endif
-
-/* dl-load.c */
-
-#define _dl_new_object rtld_new_object
-
-struct link_map * _dl_new_object (const char *realname, const char *libname, int type);
-
-/* dl-lookup.c */
-
-#define lookup_t struct link_map *
-#define LOOKUP_VALUE(map) map
-
-/* Search loaded objects' symbol tables for a definition of the symbol
- referred to by UNDEF. *SYM is the symbol table entry containing the
- reference; it is replaced with the defining symbol, and the base load
- address of the defining object is returned. SYMBOL_SCOPE is a
- null-terminated list of object scopes to search; each object's
- l_searchlist (i.e. the segment of the dependency tree starting at that
- object) is searched in turn. REFERENCE_NAME should name the object
- containing the reference; it is used in error messages.
- TYPE_CLASS describes the type of symbol we are looking for. */
-enum
- {
- /* If necessary add dependency between user and provider object. */
- DL_LOOKUP_ADD_DEPENDENCY = 1,
- /* Return most recent version instead of default version for
- unversioned lookup. */
- DL_LOOKUP_RETURN_NEWEST = 2,
- /* Set if dl_lookup* called with GSCOPE lock held. */
- DL_LOOKUP_GSCOPE_LOCK = 4,
- };
-
-#define _dl_setup_hash rtld_setup_hash
-void _dl_setup_hash (struct link_map *map);
-
-#define _dl_lookup_symbol_x32 rtld_lookup_symbol_x32
-#define _dl_lookup_symbol_x64 rtld_lookup_symbol_x64
-
-/* Lookup versioned symbol. */
-lookup_t _dl_lookup_symbol_x32 (const char *undef,
- struct link_map *undef_map,
- const Elf32_Sym **sym,
- struct r_scope_elem *symbol_scope[],
- const struct r_found_version *version,
- int type_class, int flags,
- struct link_map *skip_map);
-
-/* Lookup versioned symbol. */
-lookup_t _dl_lookup_symbol_x64 (const char *undef,
- struct link_map *undef_map,
- const Elf64_Sym **sym,
- struct r_scope_elem *symbol_scope[],
- const struct r_found_version *version,
- int type_class, int flags,
- struct link_map *skip_map);
-
-/* dl-version.c */
-
-#define _dl_check_map_versions rtld_check_map_versions
-int _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode);
-
-#define _dl_name_match_p rtld_name_match_p
-int _dl_name_match_p (const char *name, const struct link_map *map);
-
-/* Error handling */
-
-#include <error.h>
-#include <errno.h>
-
-/* Mimic the behavior and output of _dl_signal_error */
-#define rtld_signal_error(errcode, objname, occation, errstring, status) \
- error(status, errcode, "%s: %s%s%s", \
- occation ?: "error while loading shared libraries", \
- objname ?: "", (objname && *(char *)objname) ? ": " : "", \
- errstring ?: "DYNAMIC LINKER BUG!!!")
-
-#define _dl_signal_error(errcode, objname, occation, errstring) rtld_signal_error(errcode, objname, occation, errstring, 1)
-#define _dl_signal_cerror(errcode, objname, occation, errstring) rtld_signal_error(errcode, objname, occation, errstring, 0)
-#define _dl_fatal_printf(errstring) rtld_signal_error(EINVAL, NULL, NULL, errstring, 1)
-
-/* dl-load.c */
-
-extern void create_map_object_from_dso_ent (struct dso_list *);
-
-/* dl-open.c */
-#define _dl_show_scope rtld_show_scope
-extern void _dl_show_scope (struct link_map *l, int from);
-
-/* dl-tls.c */
-
-void rtld_determine_tlsoffsets (int e_machine, struct r_scope_elem *search_list);
-
-#define _dl_determine_tlsoffsets rtld_determine_tlsoffsets
-
-/* dl-misc.c */
-
-#define _dl_name_match_p rtld_name_match_p
-#define _dl_higher_prime_number rtld_higher_prime_number
-
-extern int _dl_name_match_p (const char *name, const struct link_map *map);
-extern unsigned long int _dl_higher_prime_number (unsigned long int n);
-
-
-#if defined(__MINGW32__)
-# define HOST_LONG_LONG_FORMAT "I64"
-#else
-# define HOST_LONG_LONG_FORMAT "ll"
-#endif
-
-#endif
-
diff --git a/src/undoall.c b/src/undoall.c
index 99d2397..55d2a0b 100644
--- a/src/undoall.c
+++ b/src/undoall.c
@@ -88,7 +88,7 @@ undo_one (void **p, void *info)
{
size_t len;
- if (wrap_lstat64 (hardlink->canon_filename, &st) < 0)
+ if (lstat64 (hardlink->canon_filename, &st) < 0)
{
error (0, 0, "Could not stat %s (former hardlink to %s)",
hardlink->canon_filename, ent->canon_filename);
@@ -130,19 +130,19 @@ undo_one (void **p, void *info)
memcpy (mempcpy (move, hardlink->canon_filename, len), ".#prelink#",
sizeof (".#prelink#"));
- if (wrap_rename (hardlink->canon_filename, move) < 0)
+ if (rename (hardlink->canon_filename, move) < 0)
{
error (0, errno, "Could not hardlink %s to %s",
hardlink->canon_filename, ent->canon_filename);
continue;
}
- if (wrap_link (ent->canon_filename, hardlink->canon_filename) < 0)
+ if (link (ent->canon_filename, hardlink->canon_filename) < 0)
{
error (0, errno, "Could not hardlink %s to %s",
hardlink->canon_filename, ent->canon_filename);
- if (wrap_rename (move, hardlink->canon_filename) < 0)
+ if (rename (move, hardlink->canon_filename) < 0)
{
error (0, errno, "Could not rename %s back to %s",
move, hardlink->canon_filename);
@@ -150,7 +150,7 @@ undo_one (void **p, void *info)
continue;
}
- if (wrap_unlink (move) < 0)
+ if (unlink (move) < 0)
{
error (0, errno, "Could not unlink %s", move);
continue;
diff --git a/src/verify.c b/src/verify.c
index d9f4d7d..7f530c0 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -193,7 +193,7 @@ prelink_verify (const char *filename)
size_t count;
char *p, *q;
- if (wrap_stat64 (filename, &st) < 0)
+ if (stat64 (filename, &st) < 0)
error (EXIT_FAILURE, errno, "Couldn't stat %s", filename);
dso = open_dso (filename);
@@ -269,7 +269,7 @@ prelink_verify (const char *filename)
break;
}
- fd = wrap_open (dso->temp_filename, O_RDONLY);
+ fd = open (dso->temp_filename, O_RDONLY);
if (fd < 0)
{
error (0, errno, "Could not verify %s", filename);
@@ -304,7 +304,7 @@ prelink_verify (const char *filename)
if (prelink (dso2, ent))
goto failure_unlink;
- wrap_unlink (ent->filename);
+ unlink (ent->filename);
if (write_dso (dso2))
goto failure;
@@ -447,7 +447,7 @@ failure:
not_prelinked:
if (dso)
close_dso (dso);
- fd = wrap_open (filename, O_RDONLY);
+ fd = open (filename, O_RDONLY);
if (fd < 0)
error (EXIT_FAILURE, errno, "Couldn't open %s", filename);
if (handle_verify (fd, filename))
diff --git a/src/wrap-file.c b/src/wrap-file.c
deleted file mode 100644
index f2cf305..0000000
--- a/src/wrap-file.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/* Copyright (C) 2003 MontaVista Software, Inc.
- Written by Daniel Jacobowitz <drow@mvista.com>, 2003.
-
- 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. */
-
-#include <config.h>
-#include <assert.h>
-#include <errno.h>
-#include <error.h>
-#include <fcntl.h>
-#include <ftw.h>
-#include <glob.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/xattr.h>
-#include <time.h>
-#include <unistd.h>
-#include <utime.h>
-#include "prelink.h"
-
-#ifndef PATH_MAX
-#define PATH_MAX 1024
-#endif
-
-#ifndef MAXSYMLINKS
-#define MAXSYMLINKS 20
-#endif
-
-extern char *canon_filename (const char *name, int nested, struct stat64 *stp,
- const char *chroot, int allow_last_link,
- int allow_missing);
-
-const char *sysroot;
-
-char *
-sysroot_file_name (const char *name, int allow_last_link)
-{
- struct stat64 st;
- char *ret;
-
- if (sysroot == NULL)
- return (char *) name;
-
- ret = canon_filename (name, 0, &st, sysroot, allow_last_link, 1);
-
- if (ret == NULL)
- /* That will have set errno. */
- return NULL;
-
- return ret;
-}
-
-char *
-unsysroot_file_name (const char *name)
-{
- if (sysroot)
- {
- int sysroot_len = strlen (sysroot);
- if (strncmp (name, sysroot, sysroot_len) == 0)
- {
- if (name[sysroot_len] == '/')
- return strdup (name + sysroot_len);
- else if (name[sysroot_len] == 0)
- return strdup ("/");
- }
- }
- return (char *)name;
-}
-
-static int
-wrap_stat_body (const char *file, struct stat64 *buf, int lstat)
-{
- char* file_copy;
- char *tmpname;
- int ret;
- int len;
-
- tmpname = sysroot_file_name (file, lstat);
-
- if (tmpname == NULL)
- return -1;
-
- file_copy = strdup (tmpname);
-
- if (tmpname != file)
- free (tmpname);
-
- if (file_copy == NULL)
- return -1;
-
- len = strlen (file_copy);
- if (len && (file_copy[len - 1] == '/' || file_copy[len - 1] == '\\'))
- file_copy[len - 1] = '\0';
-
- ret = lstat ? lstat64 (file_copy, buf) : stat64 (file_copy, buf);
-
- free (file_copy);
-
- return ret;
-}
-
-int
-wrap_lstat64 (const char *file, struct stat64 *buf)
-{
- return wrap_stat_body (file, buf, 1);
-}
-
-int
-wrap_stat64 (const char *file, struct stat64 *buf)
-{
- return wrap_stat_body (file, buf, 0);
-}
-
-int
-wrap_rename (const char *old, const char *new)
-{
- char *tmpold = sysroot_file_name (old, 1);
- char *tmpnew;
- int ret;
-
- if (tmpold == NULL)
- return -1;
-
- tmpnew = sysroot_file_name (new, 1);
- if (tmpnew == NULL)
- return -1;
-
- ret = rename (tmpold, tmpnew);
-
- if (tmpold != old)
- free (tmpold);
- if (tmpnew != new)
- free (tmpnew);
- return ret;
-}
-
-int
-wrap_open (const char *name, int mode, ...)
-{
- char *tmpname = sysroot_file_name (name, 0);
- int ret;
-
- if (tmpname == NULL)
- return -1;
-
- if (mode & O_CREAT)
- {
- va_list va;
- int flags;
- va_start (va, mode);
- flags = va_arg (va, int);
- va_end (va);
- ret = open (tmpname, mode, flags);
- }
- else
- ret = open (tmpname, mode);
-
- if (tmpname != name)
- free (tmpname);
- return ret;
-}
-
-int
-wrap_access (const char *name, int mode)
-{
- char *tmpname = sysroot_file_name (name, 0);
- int ret;
-
- if (tmpname == NULL)
- return -1;
-
- ret = access (tmpname, mode);
-
- if (tmpname != name)
- free (tmpname);
- return ret;
-}
-
-int
-wrap_link (const char *old, const char *new)
-{
- char *tmpold = sysroot_file_name (old, 1);
- char *tmpnew;
- int ret;
-
- if (tmpold == NULL)
- return -1;
-
- tmpnew = sysroot_file_name (new, 1);
- if (tmpnew == NULL)
- return -1;
-
- ret = link (tmpold, tmpnew);
-
- if (tmpold != old)
- free (tmpold);
- if (tmpnew != new)
- free (tmpnew);
- return ret;
-}
-
-/* Note that this isn't recursive safe, since nftw64 doesn't
- pass an opaque object around to use. But that fits our needs
- for now. */
-
-static __nftw64_func_t nftw64_cur_func;
-
-static int
-wrap_nftw64_func (const char *filename, const struct stat64 *status,
- int flag, struct FTW *info)
-{
- char *tmpname = unsysroot_file_name (filename);
- int ret = nftw64_cur_func (tmpname, status, flag, info);
-
- if (tmpname != filename)
- free (tmpname);
- return ret;
-}
-
-int
-wrap_nftw64 (const char *dir, __nftw64_func_t func,
- int descriptors, int flag)
-{
- char *tmpdir = sysroot_file_name (dir, 1);
- int ret;
-
- if (tmpdir == NULL)
- return -1;
-
- nftw64_cur_func = func;
- ret = nftw64 (tmpdir, wrap_nftw64_func, descriptors, flag);
-
- if (tmpdir != dir)
- free (tmpdir);
- return ret;
-}
-
-int
-wrap_utime (const char *file, struct utimbuf *file_times)
-{
- char *tmpname = sysroot_file_name (file, 0);
- int ret;
-
- if (tmpname == NULL)
- return -1;
-
- ret = utime (tmpname, file_times);
-
- if (tmpname != file)
- free (tmpname);
- return ret;
-}
-
-int
-wrap_mkstemp (char *filename)
-{
- char *tmpname = sysroot_file_name (filename, 1);
- int ret;
-
- if (tmpname == NULL)
- return -1;
-
- ret = mkstemp (tmpname);
-
- if (tmpname != filename)
- {
- strcpy (filename, tmpname + strlen (sysroot));
- free (tmpname);
- }
- return ret;
-}
-
-int
-wrap_unlink (const char *filename)
-{
- char *tmpname = sysroot_file_name (filename, 1);
- int ret;
-
- if (tmpname == NULL)
- return -1;
-
- ret = unlink (tmpname);
-
- if (tmpname != filename)
- free (tmpname);
- return ret;
-}
-
-int
-wrap_readlink (const char *path, char *buf, int len)
-{
- char *tmpname = sysroot_file_name (path, 1);
- int ret;
-
- if (tmpname == NULL)
- return -1;
-
- ret = readlink (tmpname, buf, len);
-
- if (tmpname != path)
- free (tmpname);
- return ret;
-}
-
-int
-wrap_setxattr (const char *path, const char *name, const void *value,
- size_t size, int flags)
-{
- char *tmpname = sysroot_file_name (path, 0);
- int ret;
-
- if (tmpname == NULL)
- return -1;
-
- ret = setxattr (tmpname, name, value, size, flags);
-
- if (tmpname != path)
- free (tmpname);
- return ret;
-}
-
-ssize_t
-wrap_getxattr (const char *path, const char *name, void *value,
- size_t size)
-{
- char *tmpname = sysroot_file_name (path, 0);
- ssize_t ret;
-
- if (tmpname == NULL)
- return -1;
-
- ret = getxattr (tmpname, name, value, size);
-
- if (tmpname != path)
- free (tmpname);
- return ret;
-}
-
-ssize_t
-wrap_listxattr (const char *path, char *list, size_t size)
-{
- char *tmpname = sysroot_file_name (path, 0);
- ssize_t ret;
-
- if (tmpname == NULL)
- return -1;
-
- ret = listxattr (tmpname, list, size);
-
- if (tmpname != path)
- free (tmpname);
- return ret;
-}
-
-int
-wrap_glob (const char *pattern, int flags,
- int (*errfunc) (const char *epath, int eerrno),
- glob_t *pglob)
-{
- char *tmp;
- int ret;
-
- if (!sysroot)
- return glob (pattern, flags, errfunc, pglob);
-
- asprintf (&tmp, "%s%s", sysroot, pattern);
-
- ret = glob(tmp, flags, errfunc, pglob);
- if (!ret)
- {
- size_t n;
-
- for (n = 0; n < pglob->gl_pathc; ++n)
- {
- char *usname = unsysroot_file_name(pglob->gl_pathv[n]);
- if (usname != pglob->gl_pathv[n])
- free(pglob->gl_pathv[n]);
- pglob->gl_pathv[n] = usname;
- }
- }
-
- free(tmp);
- return ret;
-}
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index 030f65b..94ad5e9 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -16,7 +16,7 @@ TESTS = movelibs.sh \
ifunc1.sh ifunc2.sh ifunc3.sh \
undosyslibs.sh preload1.sh order.sh
TESTS_ENVIRONMENT = \
- PRELINK="../src/prelink -c ./prelink.conf -C ./prelink.cache --ld-library-path=. --dynamic-linker=`echo ./ld*.so.*[0-9]` --rtld=../src/rtld/prelink-rtld" \
+ PRELINK="../src/prelink -c ./prelink.conf -C ./prelink.cache --ld-library-path=. --dynamic-linker=`echo ./ld*.so.*[0-9]`" \
CC="$(CC) $(LINKOPTS)" CCLINK="$(CC) -Wl,--dynamic-linker=`echo ./ld*.so.*[0-9]`" \
CXX="$(CXX) $(LINKOPTS)" CXXLINK="$(CXX) -Wl,--dynamic-linker=`echo ./ld*.so.*[0-9]`"
diff --git a/testsuite/cxx1.sh b/testsuite/cxx1.sh
index b208746..477a545 100755
--- a/testsuite/cxx1.sh
+++ b/testsuite/cxx1.sh
@@ -2,23 +2,21 @@
. `dirname $0`/functions.sh
rm -f cxx1 cxx1lib*.so cxx1.log
rm -f prelink.cache
-$RUN_HOST $CXX -shared -O2 -fpic -o cxx1lib1.so $srcdir/cxx1lib1.C
-$RUN_HOST $CXX -shared -O2 -fpic -o cxx1lib2.so $srcdir/cxx1lib2.C cxx1lib1.so
+$CXX -shared -O2 -fpic -o cxx1lib1.so $srcdir/cxx1lib1.C
+$CXX -shared -O2 -fpic -o cxx1lib2.so $srcdir/cxx1lib2.C cxx1lib1.so
BINS="cxx1"
LIBS="cxx1lib1.so cxx1lib2.so"
-$RUN_HOST $CXXLINK -o cxx1 $srcdir/cxx1.C -Wl,--rpath-link,. cxx1lib2.so cxx1lib1.so
+$CXXLINK -o cxx1 $srcdir/cxx1.C -Wl,--rpath-link,. cxx1lib2.so cxx1lib1.so
savelibs
echo $PRELINK -vvvv ${PRELINK_OPTS--vm} ./cxx1 > cxx1.log
-$RUN_HOST $PRELINK -vvvv ${PRELINK_OPTS--vm} ./cxx1 >> cxx1.log 2>&1 || exit 1
+$PRELINK -vvvv ${PRELINK_OPTS--vm} ./cxx1 >> cxx1.log 2>&1 || exit 1
grep ^`echo $PRELINK | sed 's/ .*$/: /'` cxx1.log | grep -q -v 'C++ conflict' && exit 2
-case "`$RUN uname -m`" in
+case "`uname -m`" in
arm*) ;; # EABI says that vtables/typeinfo aren't vague linkage if there is a key method
*) [ $( grep ^`echo $PRELINK | sed 's/ .*$/: /'` cxx1.log | grep 'Removing C++ conflict' | wc -l ) -ge 5 ] || exit 3;;
esac
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./cxx1 || exit 4
-fi
-$RUN_HOST $READELF -a ./cxx1 >> cxx1.log 2>&1 || exit 5
+LD_LIBRARY_PATH=. ./cxx1 || exit 4
+readelf -a ./cxx1 >> cxx1.log 2>&1 || exit 5
# So that it is not prelinked again
chmod -x ./cxx1
comparelibs >> cxx1.log 2>&1 || exit 6
diff --git a/testsuite/cxx2.sh b/testsuite/cxx2.sh
index 651e595..064fcb6 100755
--- a/testsuite/cxx2.sh
+++ b/testsuite/cxx2.sh
@@ -2,21 +2,21 @@
. `dirname $0`/functions.sh
rm -f cxx2 cxx2lib*.so cxx2.log
rm -f prelink.cache
-$RUN_HOST $CXX -shared -O2 -fpic -o cxx2lib1.so $srcdir/cxx1lib1.C
-$RUN_HOST $CXX -shared -O2 -fpic -o cxx2lib2.so $srcdir/cxx1lib2.C cxx2lib1.so
+$CXX -shared -O2 -fpic -o cxx2lib1.so $srcdir/cxx1lib1.C
+$CXX -shared -O2 -fpic -o cxx2lib2.so $srcdir/cxx1lib2.C cxx2lib1.so
BINS="cxx2"
LIBS="cxx2lib1.so cxx2lib2.so"
-$RUN_HOST $CXXLINK -o cxx2 $srcdir/cxx2.C -Wl,--rpath-link,. cxx2lib2.so cxx2lib1.so
+$CXXLINK -o cxx2 $srcdir/cxx2.C -Wl,--rpath-link,. cxx2lib2.so cxx2lib1.so
savelibs
echo $PRELINK -vvvv ${PRELINK_OPTS--vm} ./cxx2 > cxx2.log
-$RUN_HOST $PRELINK -vvvv ${PRELINK_OPTS--vm} ./cxx2 >> cxx2.log 2>&1 || exit 1
+$PRELINK -vvvv ${PRELINK_OPTS--vm} ./cxx2 >> cxx2.log 2>&1 || exit 1
grep ^`echo $PRELINK | sed 's/ .*$/: /'` cxx2.log | grep -q -v 'C++ conflict' && exit 2
-case "`$RUN uname -m`" in
+case "`uname -m`" in
arm*) ;; # EABI says that vtables/typeinfo aren't vague linkage if there is a key method
*) [ $( grep ^`echo $PRELINK | sed 's/ .*$/: /'` cxx2.log | grep 'Removing C++ conflict' | wc -l ) -ge 9 ] || exit 3;;
esac
-$RUN LD_LIBRARY_PATH=. ./cxx2 || exit 4
-$RUN_HOST $READELF -a ./cxx2 >> cxx2.log 2>&1 || exit 5
+LD_LIBRARY_PATH=. ./cxx2 || exit 4
+readelf -a ./cxx2 >> cxx2.log 2>&1 || exit 5
# So that it is not prelinked again
chmod -x ./cxx2
comparelibs >> cxx2.log 2>&1 || exit 6
diff --git a/testsuite/cxx3.sh b/testsuite/cxx3.sh
index 0908978..418369a 100755
--- a/testsuite/cxx3.sh
+++ b/testsuite/cxx3.sh
@@ -2,18 +2,18 @@
. `dirname $0`/functions.sh
rm -f cxx3 cxx3lib*.so cxx3.log
rm -f prelink.cache
-$RUN_HOST $CXX -shared -O2 -fpic -o cxx3lib1.so $srcdir/cxx3lib1.C
-$RUN_HOST $CXX -shared -O2 -fpic -o cxx3lib2.so $srcdir/cxx3lib2.C cxx3lib1.so
+$CXX -shared -O2 -fpic -o cxx3lib1.so $srcdir/cxx3lib1.C
+$CXX -shared -O2 -fpic -o cxx3lib2.so $srcdir/cxx3lib2.C cxx3lib1.so
BINS="cxx3"
LIBS="cxx3lib1.so cxx3lib2.so"
-$RUN_HOST $CXXLINK -o cxx3 $srcdir/cxx3.C -Wl,--rpath-link,. cxx3lib2.so cxx3lib1.so
+$CXXLINK -o cxx3 $srcdir/cxx3.C -Wl,--rpath-link,. cxx3lib2.so cxx3lib1.so
savelibs
echo $PRELINK -vvvv ${PRELINK_OPTS--vm} ./cxx3 > cxx3.log
-$RUN_HOST $PRELINK -vvvv ${PRELINK_OPTS--vm} ./cxx3 >> cxx3.log 2>&1 || exit 1
+$PRELINK -vvvv ${PRELINK_OPTS--vm} ./cxx3 >> cxx3.log 2>&1 || exit 1
grep ^`echo $PRELINK | sed 's/ .*$/: /'` cxx3.log | grep -q -v 'C++ conflict' && exit 2
[ $( grep ^`echo $PRELINK | sed 's/ .*$/: /'` cxx3.log | grep 'Removing C++ conflict' | wc -l ) -ge 29 ] || exit 3
-$RUN LD_LIBRARY_PATH=. ./cxx3 || exit 4
-$RUN_HOST $READELF -a ./cxx3 >> cxx3.log 2>&1 || exit 5
+LD_LIBRARY_PATH=. ./cxx3 || exit 4
+readelf -a ./cxx3 >> cxx3.log 2>&1 || exit 5
# So that it is not prelinked again
chmod -x ./cxx3
comparelibs >> cxx3.log 2>&1 || exit 6
diff --git a/testsuite/cycle1.sh b/testsuite/cycle1.sh
index f8c32b6..3dc7f93 100755
--- a/testsuite/cycle1.sh
+++ b/testsuite/cycle1.sh
@@ -4,22 +4,20 @@ rm -f cycle1 cycle1lib*.so cycle1.log
rm -f prelink.cache
# Test whether prelink doesn't segfault or loop endlessly on
# bogus library dependency chains
-echo 'int foo;' | $RUN_HOST $CC -shared -O2 -fpic -o cycle1lib1.so -xc -
-echo 'int bar;' | $RUN_HOST $CC -shared -O2 -fpic -o cycle1lib2.so -xc - -xnone cycle1lib1.so
-echo 'int foo;' | $RUN_HOST $CC -shared -O2 -fpic -o cycle1lib1.so -xc - -xnone cycle1lib2.so
+echo 'int foo;' | $CC -shared -O2 -fpic -o cycle1lib1.so -xc -
+echo 'int bar;' | $CC -shared -O2 -fpic -o cycle1lib2.so -xc - -xnone cycle1lib1.so
+echo 'int foo;' | $CC -shared -O2 -fpic -o cycle1lib1.so -xc - -xnone cycle1lib2.so
BINS="cycle1"
LIBS="cycle1lib1.so cycle1lib2.so"
echo 'int main (void) { return 0; } ' \
- | $RUN_HOST $CCLINK -o cycle1 -xc - -xnone -Wl,--rpath-link,. cycle1lib2.so
+ | $CCLINK -o cycle1 -xc - -xnone -Wl,--rpath-link,. cycle1lib2.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./cycle1 > cycle1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./cycle1 >> cycle1.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./cycle1 >> cycle1.log 2>&1 || exit 1
grep -v 'has a dependency cycle' cycle1.log \
| grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` && exit 2
grep -q "^`echo $PRELINK | sed 's/ .*$/: .*has a dependency cycle/'`" \
cycle1.log || exit 3
-if [ "x$CROSS" = "x" ] ; then
- $RUN LD_LIBRARY_PATH=. ./cycle1 || exit 4
-fi
+LD_LIBRARY_PATH=. ./cycle1 || exit 4
# So that it is not prelinked again
chmod -x ./cycle1
diff --git a/testsuite/cycle2.sh b/testsuite/cycle2.sh
index 9616464..0b99a5d 100755
--- a/testsuite/cycle2.sh
+++ b/testsuite/cycle2.sh
@@ -4,25 +4,23 @@ rm -f cycle2 cycle2lib*.so cycle2.log
rm -f prelink.cache
# Test whether prelink doesn't segfault or loop endlessly on
# bogus library dependency chains
-echo 'int i1;' | $RUN_HOST $CC -shared -O2 -fpic -o cycle2lib1.so -xc -
-echo 'int i2;' | $RUN_HOST $CC -shared -O2 -fpic -o cycle2lib2.so -xc - -xnone cycle2lib1.so
-echo 'int i3;' | $RUN_HOST $CC -shared -O2 -fpic -o cycle2lib3.so -xc - -xnone cycle2lib2.so
-echo 'int i4;' | $RUN_HOST $CC -shared -O2 -fpic -o cycle2lib4.so -xc - -xnone cycle2lib3.so
-echo 'int i5;' | $RUN_HOST $CC -shared -O2 -fpic -o cycle2lib5.so -xc - -xnone cycle2lib4.so
-echo 'int i1;' | $RUN_HOST $CC -shared -O2 -fpic -o cycle2lib1.so -xc - -xnone cycle2lib5.so
+echo 'int i1;' | $CC -shared -O2 -fpic -o cycle2lib1.so -xc -
+echo 'int i2;' | $CC -shared -O2 -fpic -o cycle2lib2.so -xc - -xnone cycle2lib1.so
+echo 'int i3;' | $CC -shared -O2 -fpic -o cycle2lib3.so -xc - -xnone cycle2lib2.so
+echo 'int i4;' | $CC -shared -O2 -fpic -o cycle2lib4.so -xc - -xnone cycle2lib3.so
+echo 'int i5;' | $CC -shared -O2 -fpic -o cycle2lib5.so -xc - -xnone cycle2lib4.so
+echo 'int i1;' | $CC -shared -O2 -fpic -o cycle2lib1.so -xc - -xnone cycle2lib5.so
BINS="cycle2"
LIBS="cycle2lib1.so cycle2lib2.so cycle2lib3.so cycle2lib4.so cycle2lib5.so"
echo 'int main (void) { return 0; } ' \
- | $RUN_HOST $CCLINK -o cycle2 -xc - -xnone -Wl,--rpath-link,. cycle2lib5.so
+ | $CCLINK -o cycle2 -xc - -xnone -Wl,--rpath-link,. cycle2lib5.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./cycle2 > cycle2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./cycle2 >> cycle2.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./cycle2 >> cycle2.log 2>&1 || exit 1
grep -v 'has a dependency cycle' cycle2.log \
| grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` && exit 2
grep -q "^`echo $PRELINK | sed 's/ .*$/: .*has a dependency cycle/'`" \
cycle2.log || exit 3
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./cycle2 || exit 4
-fi
+LD_LIBRARY_PATH=. ./cycle2 || exit 4
# So that it is not prelinked again
chmod -x ./cycle2
diff --git a/testsuite/deps1.sh b/testsuite/deps1.sh
index a5bdcac..b61a41d 100755
--- a/testsuite/deps1.sh
+++ b/testsuite/deps1.sh
@@ -10,11 +10,11 @@ CCLINK=`echo $CCLINK \
rm -rf deps1.tree
rm -f deps1.log
mkdir -p deps1.tree/{lib,etc,usr/lib,opt/lib,usr/bin}
-$RUN_HOST $CC -shared -O2 -fpic -o deps1.tree/usr/lib/lib1.so $srcdir/deps1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o deps1.tree/opt/lib/lib1.so $srcdir/deps1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o deps1.tree/usr/lib/lib2.so $srcdir/deps1lib2.c \
+$CC -shared -O2 -fpic -o deps1.tree/usr/lib/lib1.so $srcdir/deps1lib1.c
+$CC -shared -O2 -fpic -o deps1.tree/opt/lib/lib1.so $srcdir/deps1lib1.c
+$CC -shared -O2 -fpic -o deps1.tree/usr/lib/lib2.so $srcdir/deps1lib2.c \
-L deps1.tree/opt/lib -Wl,-rpath,deps1.tree/opt/lib -l1
-echo '' | $RUN_HOST $CC -shared -O2 -fpic -o deps1.tree/usr/lib/lib3.so -xc - -xnone \
+echo '' | $CC -shared -O2 -fpic -o deps1.tree/usr/lib/lib3.so -xc - -xnone \
-L deps1.tree/usr/lib -L deps1.tree/opt/lib -Wl,-rpath,deps1.tree/usr/lib \
-l1 -l2
for lib in `cat syslib.list`; do
@@ -24,7 +24,7 @@ done
for lib in `cat syslnk.list`; do
cp -dp $lib deps1.tree/lib
done
-$RUN_HOST $CCLINK -o deps1.tree/usr/bin/bin1 $srcdir/deps1.c \
+$CCLINK -o deps1.tree/usr/bin/bin1 $srcdir/deps1.c \
-Wl,-rpath,deps1.tree/usr/lib -L deps1.tree/usr/lib -l3 -lc -l1 -l2
cat > deps1.tree/etc/prelink.conf <<EOF
deps1.tree/usr/bin
@@ -39,22 +39,20 @@ BINS="deps1.tree/usr/bin/bin1"
savelibs
chmod 644 `ls $BINS | sed 's|$|.orig|'`
echo $PRELINK ${PRELINK_OPTS--v} -avvvvv > deps1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--v} -avvvvv > deps1.tree/etc/log1 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--v} -avvvvv > deps1.tree/etc/log1 2>&1 || exit 1
cat deps1.tree/etc/log1 >> deps1.log
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=deps1.tree/lib deps1.tree/usr/bin/bin1 || exit 2
-fi
-$RUN_HOST $READELF -d deps1.tree/{usr,opt}/lib/lib1.so 2>&1 | grep CHECKSUM >> deps1.log || exit 3
-$RUN_HOST $READELF -A deps1.tree/usr/lib/lib1.so >> deps1.log 2>&1 || exit 4
-$RUN_HOST $READELF -A deps1.tree/opt/lib/lib1.so >> deps1.log 2>&1 || exit 5
-$RUN_HOST $READELF -A deps1.tree/usr/lib/lib2.so >> deps1.log 2>&1 || exit 6
-$RUN_HOST $READELF -A deps1.tree/usr/lib/lib3.so >> deps1.log 2>&1 || exit 7
-$RUN_HOST $READELF -A deps1.tree/usr/bin/bin1 >> deps1.log 2>&1 || exit 8
+LD_LIBRARY_PATH=deps1.tree/lib deps1.tree/usr/bin/bin1 || exit 2
+readelf -d deps1.tree/{usr,opt}/lib/lib1.so 2>&1 | grep CHECKSUM >> deps1.log || exit 3
+readelf -A deps1.tree/usr/lib/lib1.so >> deps1.log 2>&1 || exit 4
+readelf -A deps1.tree/opt/lib/lib1.so >> deps1.log 2>&1 || exit 5
+readelf -A deps1.tree/usr/lib/lib2.so >> deps1.log 2>&1 || exit 6
+readelf -A deps1.tree/usr/lib/lib3.so >> deps1.log 2>&1 || exit 7
+readelf -A deps1.tree/usr/bin/bin1 >> deps1.log 2>&1 || exit 8
LIBS="deps1.tree/usr/lib/lib1.so deps1.tree/usr/lib/lib2.so"
LIBS="$LIBS deps1.tree/opt/lib/lib1.so"
-$RUN_HOST $READELF -S deps1.tree/usr/lib/lib3.so | grep -q .gnu.prelink_undo \
+readelf -S deps1.tree/usr/lib/lib3.so | grep -q .gnu.prelink_undo \
&& LIBS="$LIBS deps1.tree/usr/lib/lib3.so"
-$RUN_HOST $READELF -S deps1.tree/usr/bin/bin1 | grep -q .gnu.prelink_undo \
+readelf -S deps1.tree/usr/bin/bin1 | grep -q .gnu.prelink_undo \
|| BINS=
comparelibs >> deps1.log 2>&1 || exit 8
exit 0
diff --git a/testsuite/deps2.sh b/testsuite/deps2.sh
index cdd6f59..0bcc21c 100755
--- a/testsuite/deps2.sh
+++ b/testsuite/deps2.sh
@@ -10,11 +10,11 @@ CCLINK=`echo $CCLINK \
rm -rf deps2.tree
rm -f deps2.log
mkdir -p deps2.tree/{lib,etc,usr/lib,opt/lib,usr/bin}
-$RUN_HOST $CC -shared -O2 -fpic -o deps2.tree/usr/lib/lib1.so $srcdir/deps1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o deps2.tree/opt/lib/lib1.so $srcdir/deps2lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o deps2.tree/usr/lib/lib2.so $srcdir/deps1lib2.c \
+$CC -shared -O2 -fpic -o deps2.tree/usr/lib/lib1.so $srcdir/deps1lib1.c
+$CC -shared -O2 -fpic -o deps2.tree/opt/lib/lib1.so $srcdir/deps2lib1.c
+$CC -shared -O2 -fpic -o deps2.tree/usr/lib/lib2.so $srcdir/deps1lib2.c \
-L deps2.tree/opt/lib -Wl,-rpath,deps2.tree/opt/lib -l1
-echo '' | $RUN_HOST $CC -shared -O2 -fpic -o deps2.tree/usr/lib/lib3.so -xc - -xnone \
+echo '' | $CC -shared -O2 -fpic -o deps2.tree/usr/lib/lib3.so -xc - -xnone \
-L deps2.tree/usr/lib -L deps2.tree/opt/lib -Wl,-rpath,deps2.tree/usr/lib \
-l1 -l2
for lib in `cat syslib.list`; do
@@ -24,7 +24,7 @@ done
for lib in `cat syslnk.list`; do
cp -dp $lib deps2.tree/lib
done
-$RUN_HOST $CCLINK -o deps2.tree/usr/bin/bin1 $srcdir/deps1.c \
+$CCLINK -o deps2.tree/usr/bin/bin1 $srcdir/deps1.c \
-Wl,-rpath,deps2.tree/usr/lib -L deps2.tree/usr/lib -l3 -lc -l1 -l2
cat > deps2.tree/etc/prelink.conf <<EOF
deps2.tree/usr/bin
@@ -39,17 +39,15 @@ BINS="deps2.tree/usr/bin/bin1"
savelibs
chmod 644 `ls $BINS | sed 's|$|.orig|'`
echo $PRELINK ${PRELINK_OPTS--v} -avvvvv > deps2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--v} -avvvvv > deps2.tree/etc/log1 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--v} -avvvvv > deps2.tree/etc/log1 2>&1 || exit 1
cat deps2.tree/etc/log1 >> deps2.log
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=deps2.tree/lib deps2.tree/usr/bin/bin1 || exit 2
-fi
-$RUN_HOST $READELF -d deps2.tree/{usr,opt}/lib/lib1.so 2>&1 | grep CHECKSUM >> deps2.log || exit 3
-$RUN_HOST $READELF -A deps2.tree/usr/lib/lib1.so >> deps2.log 2>&1 || exit 4
-$RUN_HOST $READELF -A deps2.tree/opt/lib/lib1.so >> deps2.log 2>&1 || exit 5
-$RUN_HOST $READELF -A deps2.tree/usr/lib/lib2.so >> deps2.log 2>&1 || exit 6
-$RUN_HOST $READELF -A deps2.tree/usr/lib/lib3.so >> deps2.log 2>&1 || exit 7
-$RUN_HOST $READELF -A deps2.tree/usr/bin/bin1 >> deps2.log 2>&1 || exit 8
+LD_LIBRARY_PATH=deps2.tree/lib deps2.tree/usr/bin/bin1 || exit 2
+readelf -d deps2.tree/{usr,opt}/lib/lib1.so 2>&1 | grep CHECKSUM >> deps2.log || exit 3
+readelf -A deps2.tree/usr/lib/lib1.so >> deps2.log 2>&1 || exit 4
+readelf -A deps2.tree/opt/lib/lib1.so >> deps2.log 2>&1 || exit 5
+readelf -A deps2.tree/usr/lib/lib2.so >> deps2.log 2>&1 || exit 6
+readelf -A deps2.tree/usr/lib/lib3.so >> deps2.log 2>&1 || exit 7
+readelf -A deps2.tree/usr/bin/bin1 >> deps2.log 2>&1 || exit 8
LIBS="deps2.tree/usr/lib/lib1.so deps2.tree/usr/lib/lib2.so"
LIBS="$LIBS deps2.tree/opt/lib/lib1.so"
BINS=
diff --git a/testsuite/functions.sh b/testsuite/functions.sh
index 07a3827..85bf875 100755
--- a/testsuite/functions.sh
+++ b/testsuite/functions.sh
@@ -3,13 +3,7 @@ CC="${CC:-gcc} ${LINKOPTS}"
CCLINK=${CCLINK:-${CC} -Wl,--dynamic-linker=`echo ./ld*.so.*[0-9]`}
CXX="${CXX:-g++} ${LINKOPTS}"
CXXLINK=${CXXLINK:-${CXX} -Wl,--dynamic-linker=`echo ./ld*.so.*[0-9]`}
-PRELINK=${PRELINK:-../src/prelink -c ./prelink.conf -C ./prelink.cache --ld-library-path=. --dynamic-linker=`echo ./ld*.so.*[0-9]` --rtld=../src/rtld/prelink-rtld}
-LDD=${LDD:-../src/rtld/prelink-rtld}
-STRIP=${STRIP:-strip}
-HOST_CC=${HOST_CC:-$CC}
-READELF=${READELF:-readelf}
-RUN=${RUN:-env}
-RUN_HOST=${RUN_HOST:-env}
+PRELINK=${PRELINK:-../src/prelink -c ./prelink.conf -C ./prelink.cache --ld-library-path=. --dynamic-linker=`echo ./ld*.so.*[0-9]`}
srcdir=${srcdir:-`dirname $0`}
savelibs() {
for i in $LIBS $BINS; do cp -p $i $i.orig; done
@@ -18,11 +12,11 @@ comparelibs() {
for i in $LIBS $BINS; do
cp -p $i $i.new
echo $PRELINK -u $i.new
- $RUN_HOST $PRELINK -u $i.new || exit
+ $PRELINK -u $i.new || exit
cmp -s $i.orig $i.new || exit
rm -f $i.new
echo $PRELINK -y $i \> $i.new
- $RUN_HOST $PRELINK -y $i > $i.new || exit
+ $PRELINK -y $i > $i.new || exit
cmp -s $i.orig $i.new || exit
rm -f $i.new
done
diff --git a/testsuite/ifunc1.sh b/testsuite/ifunc1.sh
index 39a008a..135014d 100755
--- a/testsuite/ifunc1.sh
+++ b/testsuite/ifunc1.sh
@@ -1,25 +1,21 @@
#!/bin/bash
. `dirname $0`/functions.sh
# First check if __thread is supported by ld.so/gcc/ld/as:
-$RUN_HOST $CCLINK -o ifunctest $srcdir/ifunctest.c -Wl,--rpath-link,. > /dev/null 2>&1 || exit 77
-if [ "x$CROSS" = "x" ]; then
- ( $RUN LD_LIBRARY_PATH=. ./ifunctest || { rm -f ifunctest; exit 77; } ) 2>/dev/null || exit 77
-fi
+$CCLINK -o ifunctest $srcdir/ifunctest.c -Wl,--rpath-link,. > /dev/null 2>&1 || exit 77
+( ./ifunctest || { rm -f ifunctest; exit 77; } ) 2>/dev/null || exit 77
rm -f ifunctest ifunc1 ifunc1lib*.so ifunc1.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o ifunc1lib1.so $srcdir/ifunc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o ifunc1lib2.so $srcdir/ifunc1lib2.c ifunc1lib1.so
+$CC -shared -O2 -fpic -o ifunc1lib1.so $srcdir/ifunc1lib1.c
+$CC -shared -O2 -fpic -o ifunc1lib2.so $srcdir/ifunc1lib2.c ifunc1lib1.so
BINS="ifunc1"
LIBS="ifunc1lib1.so ifunc1lib2.so"
-$RUN_HOST $CCLINK -o ifunc1 $srcdir/ifunc1.c -Wl,--rpath-link,. ifunc1lib2.so -lc ifunc1lib1.so
+$CCLINK -o ifunc1 $srcdir/ifunc1.c -Wl,--rpath-link,. ifunc1lib2.so -lc ifunc1lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./ifunc1 >> ifunc1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./ifunc1 >> ifunc1.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./ifunc1 >> ifunc1.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` ifunc1.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./ifunc1 || exit 3
-fi
-$RUN_HOST $READELF -a ./ifunc1 >> ifunc1.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./ifunc1 || exit 3
+readelf -a ./ifunc1 >> ifunc1.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./ifunc1
comparelibs >> ifunc1.log 2>&1 || exit 5
diff --git a/testsuite/ifunc2.sh b/testsuite/ifunc2.sh
index 16f427c..3966e86 100755
--- a/testsuite/ifunc2.sh
+++ b/testsuite/ifunc2.sh
@@ -1,25 +1,21 @@
#!/bin/bash
. `dirname $0`/functions.sh
# First check if __thread is supported by ld.so/gcc/ld/as:
-$RUN_HOST $CCLINK -o ifunctest $srcdir/ifunctest.c -Wl,--rpath-link,. > /dev/null 2>&1 || exit 77
-if [ "x$CROSS" = "x" ]; then
- ( $RUN LD_LIBRARY_PATH=. ./ifunctest || { rm -f ifunctest; exit 77; } ) 2>/dev/null || exit 77
-fi
+$CCLINK -o ifunctest $srcdir/ifunctest.c -Wl,--rpath-link,. > /dev/null 2>&1 || exit 77
+( ./ifunctest || { rm -f ifunctest; exit 77; } ) 2>/dev/null || exit 77
rm -f ifunctest ifunc2 ifunc2lib*.so ifunc2.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o ifunc2lib1.so $srcdir/ifunc1lib1.c -DPICKNO=2
-$RUN_HOST $CC -shared -O2 -fpic -o ifunc2lib2.so $srcdir/ifunc1lib2.c ifunc2lib1.so -DPICKNO=2
+$CC -shared -O2 -fpic -o ifunc2lib1.so $srcdir/ifunc1lib1.c -DPICKNO=2
+$CC -shared -O2 -fpic -o ifunc2lib2.so $srcdir/ifunc1lib2.c ifunc2lib1.so -DPICKNO=2
BINS="ifunc2"
LIBS="ifunc2lib1.so ifunc2lib2.so"
-$RUN_HOST $CCLINK -o ifunc2 $srcdir/ifunc1.c -Wl,--rpath-link,. ifunc2lib2.so -lc ifunc2lib1.so -DPICKNO=2
+$CCLINK -o ifunc2 $srcdir/ifunc1.c -Wl,--rpath-link,. ifunc2lib2.so -lc ifunc2lib1.so -DPICKNO=2
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./ifunc2 >> ifunc2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./ifunc2 >> ifunc2.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./ifunc2 >> ifunc2.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` ifunc2.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./ifunc2 || exit 3
-fi
-$RUN_HOST $READELF -a ./ifunc2 >> ifunc2.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./ifunc2 || exit 3
+readelf -a ./ifunc2 >> ifunc2.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./ifunc2
comparelibs >> ifunc2.log 2>&1 || exit 5
diff --git a/testsuite/ifunc3.sh b/testsuite/ifunc3.sh
index 2f8c0aa..30fc893 100755
--- a/testsuite/ifunc3.sh
+++ b/testsuite/ifunc3.sh
@@ -1,25 +1,21 @@
#!/bin/bash
. `dirname $0`/functions.sh
# First check if __thread is supported by ld.so/gcc/ld/as:
-$RUN_HOST $CCLINK -o ifunctest $srcdir/ifunctest.c -Wl,--rpath-link,. > /dev/null 2>&1 || exit 77
-if [ "x$CROSS" = "x" ]; then
- ( $RUN LD_LIBRARY_PATH=. ./ifunctest || { rm -f ifunctest; exit 77; } ) 2>/dev/null || exit 77
-fi
+$CCLINK -o ifunctest $srcdir/ifunctest.c -Wl,--rpath-link,. > /dev/null 2>&1 || exit 77
+( ./ifunctest || { rm -f ifunctest; exit 77; } ) 2>/dev/null || exit 77
rm -f ifunctest ifunc3 ifunc3lib*.so ifunc3.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o ifunc3lib1.so $srcdir/ifunc3lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o ifunc3lib2.so $srcdir/ifunc1lib2.c ifunc3lib1.so
+$CC -shared -O2 -fpic -o ifunc3lib1.so $srcdir/ifunc3lib1.c
+$CC -shared -O2 -fpic -o ifunc3lib2.so $srcdir/ifunc1lib2.c ifunc3lib1.so
BINS="ifunc3"
LIBS="ifunc3lib1.so ifunc3lib2.so"
-$RUN_HOST $CCLINK -o ifunc3 $srcdir/ifunc3.c -Wl,--rpath-link,. ifunc3lib2.so -lc ifunc3lib1.so
+$CCLINK -o ifunc3 $srcdir/ifunc3.c -Wl,--rpath-link,. ifunc3lib2.so -lc ifunc3lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./ifunc3 >> ifunc3.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./ifunc3 >> ifunc3.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./ifunc3 >> ifunc3.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` ifunc3.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./ifunc3 || exit 3
-fi
-$RUN_HOST $READELF -a ./ifunc3 >> ifunc3.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./ifunc3 || exit 3
+readelf -a ./ifunc3 >> ifunc3.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./ifunc3
comparelibs >> ifunc3.log 2>&1 || exit 5
diff --git a/testsuite/layout1.sh b/testsuite/layout1.sh
index 0af196e..ee751ab 100755
--- a/testsuite/layout1.sh
+++ b/testsuite/layout1.sh
@@ -6,19 +6,17 @@ i=10
BINS="layout1"
LIBS=
while [ $i -lt 74 ]; do
- $RUN_HOST $CXX -shared -fpic -o layout1lib$i.so $srcdir/layoutlib.C
+ $CXX -shared -fpic -o layout1lib$i.so $srcdir/layoutlib.C
LIBS="$LIBS layout1lib$i.so"
i=`expr $i + 1`
done
-$RUN_HOST $CXXLINK -o layout1 $srcdir/layout.C layout1lib*.so
+$CXXLINK -o layout1 $srcdir/layout.C layout1lib*.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vR} ./layout1 > layout1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vR} ./layout1 >> layout1.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vR} ./layout1 >> layout1.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` layout1.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./layout1 || exit 3
-fi
-$RUN_HOST $READELF -a ./layout1 >> layout1.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./layout1 || exit 3
+readelf -a ./layout1 >> layout1.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./layout1
comparelibs >> layout1.log 2>&1 || exit 5
diff --git a/testsuite/layout2.sh b/testsuite/layout2.sh
index 03f8b28..7d8504b 100755
--- a/testsuite/layout2.sh
+++ b/testsuite/layout2.sh
@@ -5,19 +5,17 @@ i=1
BINS="layout2"
LIBS=
while [ $i -lt 6 ]; do
- $RUN_HOST $CXX -shared -fpic -o layout2lib$i.so $srcdir/layoutlib.C
+ $CXX -shared -fpic -o layout2lib$i.so $srcdir/layoutlib.C
LIBS="$LIBS layout2lib$i.so"
i=`expr $i + 1`
done
-$RUN_HOST $CXXLINK -o layout2 $srcdir/layout.C layout2lib*.so
+$CXXLINK -o layout2 $srcdir/layout.C layout2lib*.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vR} ./layout2 > layout2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vR} ./layout2 >> layout2.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vR} ./layout2 >> layout2.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` layout2.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./layout2 || exit 3
-fi
-$RUN_HOST $READELF -a ./layout2 >> layout2.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./layout2 || exit 3
+readelf -a ./layout2 >> layout2.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./layout2
comparelibs >> layout2.log 2>&1 || exit 5
diff --git a/testsuite/movelibs.sh b/testsuite/movelibs.sh
index c640f45..4357ee8 100755
--- a/testsuite/movelibs.sh
+++ b/testsuite/movelibs.sh
@@ -2,10 +2,10 @@
. `dirname $0`/functions.sh
# This script copies needed C and C++ libraries into the test directory
echo 'int main() { }' > movelibs.C
-$RUN_HOST $CXX -o movelibs movelibs.C
+$CXX -o movelibs movelibs.C
> syslib.list
> syslnk.list
-for i in `$RUN_HOST RTLD_TRACE_PRELINKING=1 RTLD_WARN= $LDD ./movelibs \
+for i in `LD_TRACE_PRELINKING=1 LD_WARN= LD_TRACE_LOADED_OBJECTS=1 ./movelibs \
| awk '$1 !~ /^\.\/movelibs/ { print $3 } '`; do
k=`basename $i`
if [ -L $i ]; then
@@ -27,8 +27,8 @@ done
rm -f movelibs.C movelibs
pwd > prelink.conf
for i in `cat syslib.list`; do
- if $RUN_HOST $READELF -WS $i 2>/dev/null | grep -q .gnu.prelink_undo; then
- $RUN_HOST $PRELINK -u $i > /dev/null 2>&1 || exit 1
+ if readelf -WS $i 2>/dev/null | grep -q .gnu.prelink_undo; then
+ $PRELINK -u $i > /dev/null 2>&1 || exit 1
fi
cp -p $i $i.orig
done
diff --git a/testsuite/order.sh b/testsuite/order.sh
index a9c79ff..ce0dbda 100755
--- a/testsuite/order.sh
+++ b/testsuite/order.sh
@@ -4,25 +4,21 @@ rm -f order orderlib*.so order.log
rm -f prelink.cache
# Need a sysroot for this...
-$RUN_HOST $CC -shared -O2 -fpic -o orderlib3.so $srcdir/orderlib3.c
-$RUN_HOST $CC -shared -O2 -fpic -o orderlib2.so $srcdir/orderlib2.c
-$RUN_HOST $CC -shared -O2 -fpic -o orderlib1.so $srcdir/orderlib1.c orderlib3.so
-$RUN_HOST $CC -shared -O2 -fpic -o orderlib.so $srcdir/orderlib.c orderlib1.so orderlib2.so orderlib3.so
+$CC -shared -O2 -fpic -o orderlib3.so $srcdir/orderlib3.c
+$CC -shared -O2 -fpic -o orderlib2.so $srcdir/orderlib2.c
+$CC -shared -O2 -fpic -o orderlib1.so $srcdir/orderlib1.c orderlib3.so
+$CC -shared -O2 -fpic -o orderlib.so $srcdir/orderlib.c orderlib1.so orderlib2.so orderlib3.so
BINS="order"
LIBS="orderlib.so orderlib1.so orderlib2.so orderlib3.so"
-$RUN_HOST $CCLINK -o order $srcdir/order.c -Wl,-rpath-link,. orderlib.so orderlib3.so
+$CCLINK -o order $srcdir/order.c -Wl,-rpath-link,. orderlib.so orderlib3.so
: > order.log
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./order >> order.log || exit 1
-fi
+LD_LIBRARY_PATH=. ./order >> order.log || exit 1
#exit 1
#savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./order >> order.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./order >> order.log 2>&1 || exit 2
+$PRELINK ${PRELINK_OPTS--vm} ./order >> order.log 2>&1 || exit 2
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` order.log && exit 3
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./order >> order.log || exit 4
-fi
+LD_LIBRARY_PATH=. ./order >> order.log || exit 4
# So that it is not prelinked again
chmod -x ./order
diff --git a/testsuite/preload1.sh b/testsuite/preload1.sh
index a44ea5c..8e1f4d0 100755
--- a/testsuite/preload1.sh
+++ b/testsuite/preload1.sh
@@ -32,8 +32,8 @@ CCLINK=`echo $CCLINK \
rm -rf preload1.tree
rm -f preload1.log
mkdir -p preload1.tree/{lib,etc,usr/lib,usr/bin}
-$RUN_HOST $CC -shared -O2 -fpic -o preload1.tree/usr/lib/lib1.so $srcdir/preload1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o preload1.tree/usr/lib/lib2.so $srcdir/preload1lib2.c
+$CC -shared -O2 -fpic -o preload1.tree/usr/lib/lib1.so $srcdir/preload1lib1.c
+$CC -shared -O2 -fpic -o preload1.tree/usr/lib/lib2.so $srcdir/preload1lib2.c
for lib in `cat syslib.list`; do
cp -p $lib.orig preload1.tree/lib/$lib
cp -p $lib.orig preload1.tree/lib/$lib.orig
@@ -41,7 +41,7 @@ done
for lib in `cat syslnk.list`; do
cp -dp $lib preload1.tree/lib
done
-$RUN_HOST $CCLINK -o preload1.tree/usr/bin/bin1 $srcdir/preload1.c \
+$CCLINK -o preload1.tree/usr/bin/bin1 $srcdir/preload1.c \
-Wl,--rpath-link,preload1.tree/usr/lib -L preload1.tree/usr/lib -lc -l1
cat > preload1.tree/etc/prelink.conf <<EOF
preload1.tree/usr/bin
@@ -57,30 +57,26 @@ chmod 644 `ls $BINS | sed 's|$|.orig|'`
# than mtimes
sleep 3s
echo $PRELINK ${PRELINK_OPTS--vm} -avvvvv > preload1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -avvvvv > preload1.tree/etc/log1 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} -avvvvv > preload1.tree/etc/log1 2>&1 || exit 1
cat preload1.tree/etc/log1 >> preload1.log
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> preload1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > preload1.tree/etc/log2 2>&1 || exit 2
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > preload1.tree/etc/log2 2>&1 || exit 2
cat preload1.tree/etc/log2 >> preload1.log
-if [ "x$CROSS" = "x" ]; then
- # We -expect- a failure here!
- $RUN LD_LIBRARY_PATH=preload1.tree/lib:preload1.tree/usr/lib preload1.tree/usr/bin/bin1 && exit 3
-fi
+# We -expect- a failure here!
+LD_LIBRARY_PATH=preload1.tree/lib:preload1.tree/usr/lib preload1.tree/usr/bin/bin1 && exit 3
for f in $LIBS $BINS ; do
cp $f $f.orig
done
echo $PRELINK ${PRELINK_OPTS--vm} --ld-preload=preload1.tree/usr/lib/lib2.so -avvvvv >> preload1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} --ld-preload=preload1.tree/usr/lib/lib2.so -avvvvv > preload1.tree/etc/log4 2>&1 || exit 4
+$PRELINK ${PRELINK_OPTS--vm} --ld-preload=preload1.tree/usr/lib/lib2.so -avvvvv > preload1.tree/etc/log4 2>&1 || exit 4
cat preload1.tree/etc/log4 >> preload1.log
# System libs and lib1.so MIGHT change, but lib2.so and bin1 must change
for i in preload1.tree/usr/lib/lib2.so preload1.tree/usr/bin/bin1; do
cmp -s $i.orig $i && exit 5
done
-if [ "x$CROSS" = "x" ]; then
- # Should run, but fail (no preload)
- $RUN LD_LIBRARY_PATH=preload1.tree/lib:preload1.tree/usr/lib preload1.tree/usr/bin/bin1 && exit 6
- # Should run, and exit successfully
- $RUN LD_PRELOAD=preload1.tree/usr/lib/lib2.so LD_LIBRARY_PATH=preload1.tree/lib:preload1.tree/usr/lib preload1.tree/usr/bin/bin1 || exit 7
-fi
+# Should run, but fail (no preload)
+LD_LIBRARY_PATH=preload1.tree/lib:preload1.tree/usr/lib preload1.tree/usr/bin/bin1 && exit 6
+# Should run, and exit successfully
+LD_PRELOAD=preload1.tree/usr/lib/lib2.so LD_LIBRARY_PATH=preload1.tree/lib:preload1.tree/usr/lib preload1.tree/usr/bin/bin1 || exit 7
chmod 755 $BINS
exit 0
diff --git a/testsuite/quick1.sh b/testsuite/quick1.sh
index 228ba4c..691b940 100755
--- a/testsuite/quick1.sh
+++ b/testsuite/quick1.sh
@@ -32,20 +32,20 @@ CCLINK=`echo $CCLINK \
rm -rf quick1.tree
rm -f quick1.log
mkdir -p quick1.tree/{lib,etc,usr/lib,usr/bin}
-$RUN_HOST $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib2.so $srcdir/reloc1lib2.c \
+$CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib2.so $srcdir/reloc1lib2.c \
-L quick1.tree/usr/lib -l1
-$RUN_HOST $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib3.so $srcdir/quick1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib2.later.so \
+$CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib3.so $srcdir/quick1lib1.c
+$CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib2.later.so \
$srcdir/quick1lib2.c -L quick1.tree/usr/lib -l1 -l3
-echo 'int foo;' | $RUN_HOST $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib4.so -xc -
-$RUN_HOST $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib5.so $srcdir/quick1lib3.c \
+echo 'int foo;' | $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib4.so -xc -
+$CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib5.so $srcdir/quick1lib3.c \
-L quick1.tree/usr/lib -Wl,--rpath-link,quick1.tree/usr/lib -l2
-$RUN_HOST $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib6.so $srcdir/quick1lib4.c \
+$CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib6.so $srcdir/quick1lib4.c \
-L quick1.tree/usr/lib -Wl,--rpath-link,quick1.tree/usr/lib -l5
-echo 'int baz;' | $RUN_HOST $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib7.so -xc - \
+echo 'int baz;' | $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib7.so -xc - \
-L quick1.tree/usr/lib -Wl,--rpath-link,quick1.tree/usr/lib -l6
-echo 'int baz;' | $RUN_HOST $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib7.later.so \
+echo 'int baz;' | $CC -shared -O2 -fpic -o quick1.tree/usr/lib/lib7.later.so \
-xc - -L quick1.tree/usr/lib -Wl,--rpath-link,quick1.tree/usr/lib -l2
for lib in `cat syslib.list`; do
cp -p $lib.orig quick1.tree/lib/$lib
@@ -54,19 +54,19 @@ done
for lib in `cat syslnk.list`; do
cp -dp $lib quick1.tree/lib
done
-$RUN_HOST $CCLINK -o quick1.tree/usr/bin/bin1 $srcdir/reloc1.c \
+$CCLINK -o quick1.tree/usr/bin/bin1 $srcdir/reloc1.c \
-Wl,--rpath-link,quick1.tree/usr/lib -L quick1.tree/usr/lib -l2 -lc -l1
echo 'int main () { extern int foo; return foo; }' \
- | $RUN_HOST $CCLINK -o quick1.tree/usr/bin/bin2 -xc - -xnone \
+ | $CCLINK -o quick1.tree/usr/bin/bin2 -xc - -xnone \
-L quick1.tree/usr/lib -l4
-$RUN_HOST $CCLINK -o quick1.tree/usr/bin/bin3 $srcdir/reloc1.c \
+$CCLINK -o quick1.tree/usr/bin/bin3 $srcdir/reloc1.c \
-Wl,--rpath-link,quick1.tree/usr/lib -L quick1.tree/usr/lib -l7 -lc -l2 -l1
-$RUN_HOST $CCLINK -o quick1.tree/usr/bin/bin4 $srcdir/quick1.c \
+$CCLINK -o quick1.tree/usr/bin/bin4 $srcdir/quick1.c \
-Wl,--rpath-link,quick1.tree/usr/lib -L quick1.tree/usr/lib -l2 -lc -l1
-$RUN_HOST $CCLINK -o quick1.tree/usr/bin/bin5 $srcdir/quick1.c \
+$CCLINK -o quick1.tree/usr/bin/bin5 $srcdir/quick1.c \
-Wl,--rpath-link,quick1.tree/usr/lib -L quick1.tree/usr/lib -l7 -lc -l2 -l1
echo 'int main () { return 0; }' \
- | $RUN_HOST $CCLINK -o quick1.tree/usr/bin/bin6 -xc - -xnone \
+ | $CCLINK -o quick1.tree/usr/bin/bin6 -xc - -xnone \
-Wl,--rpath-link,quick1.tree/usr/lib -L quick1.tree/usr/lib -l6
cat > quick1.tree/etc/prelink.conf <<EOF
quick1.tree/usr/bin
@@ -93,10 +93,10 @@ cp -p quick1.tree/usr/lib/lib2.later.so{,.orig}
touch quick1.tree/usr/lib/lib7.later.so
cp -p quick1.tree/usr/lib/lib7.later.so{,.orig}
echo $PRELINK ${PRELINK_OPTS--vm} -avvvvv > quick1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -avvvvv > quick1.tree/etc/log1 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} -avvvvv > quick1.tree/etc/log1 2>&1 || exit 1
cat quick1.tree/etc/log1 >> quick1.log
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> quick1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick1.tree/etc/log2 2>&1 || exit 2
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick1.tree/etc/log2 2>&1 || exit 2
cat quick1.tree/etc/log2 >> quick1.log
stat quick1.tree/usr/lib/lib2.so >> quick1.log
echo chmod 644 quick1.tree/usr/lib/lib2.so >> quick1.log
@@ -106,34 +106,22 @@ echo chmod 755 quick1.tree/usr/lib/lib2.so >> quick1.log
chmod 755 quick1.tree/usr/lib/lib2.so
stat quick1.tree/usr/lib/lib2.so >> quick1.log
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> quick1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick1.tree/etc/log3 2>&1 || exit 3
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick1.tree/etc/log3 2>&1 || exit 3
cat quick1.tree/etc/log3 >> quick1.log
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> quick1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick1.tree/etc/log4 2>&1 || exit 4
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick1.tree/etc/log4 2>&1 || exit 4
cat quick1.tree/etc/log4 >> quick1.log
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin1 || exit 5
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin2 || exit 6
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin3 || exit 7
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin4 || exit 8
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin5 || exit 9
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin6 || exit 10
-fi
-$RUN_HOST $READELF -a quick1.tree/usr/bin/bin1 >> quick1.log 2>&1 || exit 11
-$RUN_HOST $READELF -a quick1.tree/usr/bin/bin3 >> quick1.log 2>&1 || exit 12
-$RUN_HOST $READELF -a quick1.tree/usr/bin/bin4 >> quick1.log 2>&1 || exit 13
-$RUN_HOST $READELF -a quick1.tree/usr/bin/bin5 >> quick1.log 2>&1 || exit 14
-$RUN_HOST $READELF -a quick1.tree/usr/bin/bin6 >> quick1.log 2>&1 || exit 15
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin1 || exit 5
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin2 || exit 6
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin3 || exit 7
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin4 || exit 8
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin5 || exit 9
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin6 || exit 10
+readelf -a quick1.tree/usr/bin/bin1 >> quick1.log 2>&1 || exit 11
+readelf -a quick1.tree/usr/bin/bin3 >> quick1.log 2>&1 || exit 12
+readelf -a quick1.tree/usr/bin/bin4 >> quick1.log 2>&1 || exit 13
+readelf -a quick1.tree/usr/bin/bin5 >> quick1.log 2>&1 || exit 14
+readelf -a quick1.tree/usr/bin/bin6 >> quick1.log 2>&1 || exit 15
BINS="quick1.tree/usr/bin/bin1 quick1.tree/usr/bin/bin3"
BINS="$BINS quick1.tree/usr/bin/bin4 quick1.tree/usr/bin/bin5"
BINS="$BINS quick1.tree/usr/bin/bin6"
@@ -150,31 +138,19 @@ for b in 1 3 4 5 6; do
chmod 644 quick1.tree/usr/bin/bin$b.old
done
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> quick1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick1.tree/etc/log5 2>&1 || exit 17
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick1.tree/etc/log5 2>&1 || exit 17
cat quick1.tree/etc/log5 >> quick1.log
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin1 || exit 18
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin2 || exit 19
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin3 || exit 20
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin4 || exit 21
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin5 || exit 22
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin6 || exit 23
-fi
-$RUN_HOST $READELF -a quick1.tree/usr/bin/bin1 >> quick1.log 2>&1 || exit 24
-$RUN_HOST $READELF -a quick1.tree/usr/bin/bin3 >> quick1.log 2>&1 || exit 25
-$RUN_HOST $READELF -a quick1.tree/usr/bin/bin4 >> quick1.log 2>&1 || exit 26
-$RUN_HOST $READELF -a quick1.tree/usr/bin/bin5 >> quick1.log 2>&1 || exit 27
-$RUN_HOST $READELF -a quick1.tree/usr/bin/bin6 >> quick1.log 2>&1 || exit 28
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin1 || exit 18
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin2 || exit 19
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin3 || exit 20
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin4 || exit 21
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin5 || exit 22
+LD_LIBRARY_PATH=quick1.tree/lib:quick1.tree/usr/lib quick1.tree/usr/bin/bin6 || exit 23
+readelf -a quick1.tree/usr/bin/bin1 >> quick1.log 2>&1 || exit 24
+readelf -a quick1.tree/usr/bin/bin3 >> quick1.log 2>&1 || exit 25
+readelf -a quick1.tree/usr/bin/bin4 >> quick1.log 2>&1 || exit 26
+readelf -a quick1.tree/usr/bin/bin5 >> quick1.log 2>&1 || exit 27
+readelf -a quick1.tree/usr/bin/bin6 >> quick1.log 2>&1 || exit 28
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` quick1.log && exit 29
L=quick1.tree/usr/lib/lib
L1=${L}1.so; L2=${L}2.so; L3=${L}3.so; L4=${L}4.so
@@ -203,7 +179,7 @@ for i in $BINS; do
chmod 644 $i.prelinked
done
echo $PRELINK -uavvvvvv >> quick1.log
-$RUN_HOST $PRELINK -uavvvvvv >> quick1.log 2>&1 || exit 31
+$PRELINK -uavvvvvv >> quick1.log 2>&1 || exit 31
for i in $BINS $SL $L1 $L2 $L3 $L4 $L5 $L6 $L7; do
cmp -s $i.orig $i || exit 32
mv -f $i.prelinked $i
diff --git a/testsuite/quick2.sh b/testsuite/quick2.sh
index 8ffaf76..031a410 100755
--- a/testsuite/quick2.sh
+++ b/testsuite/quick2.sh
@@ -33,21 +33,21 @@ CCLINK=`echo $CCLINK \
rm -rf quick2.tree
rm -f quick2.log
mkdir -p quick2.tree/{lib,etc,usr/lib,usr/bin}
-$RUN_HOST $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib2.so $srcdir/reloc1lib2.c \
+$CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib2.so $srcdir/reloc1lib2.c \
-L quick2.tree/usr/lib -l1
-$RUN_HOST $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib3.so $srcdir/quick1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib2.later.so \
+$CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib3.so $srcdir/quick1lib1.c
+$CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib2.later.so \
$srcdir/quick1lib2.c -L quick2.tree/usr/lib -l1 -l3
-echo 'int foo;' | $RUN_HOST $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib4.so -xc -
-$RUN_HOST $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib5.so $srcdir/quick1lib3.c \
+echo 'int foo;' | $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib4.so -xc -
+$CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib5.so $srcdir/quick1lib3.c \
-L quick2.tree/usr/lib -Wl,--rpath-link,quick2.tree/usr/lib -l2
-$RUN_HOST $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib6.so $srcdir/quick1lib4.c \
+$CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib6.so $srcdir/quick1lib4.c \
-L quick2.tree/usr/lib -Wl,--rpath-link,quick2.tree/usr/lib -l5
-echo 'int baz;' | $RUN_HOST $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib7.so -xc - \
+echo 'int baz;' | $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib7.so -xc - \
-L quick2.tree/usr/lib -Wl,--rpath-link,quick2.tree/usr/lib -l6 \
-Wl,--spare-dynamic-tags=0
-echo 'int baz;' | $RUN_HOST $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib7.later.so \
+echo 'int baz;' | $CC -shared -O2 -fpic -o quick2.tree/usr/lib/lib7.later.so \
-xc - -L quick2.tree/usr/lib -Wl,--rpath-link,quick2.tree/usr/lib -l2
for lib in `cat syslib.list`; do
cp -p $lib.orig quick2.tree/lib/$lib
@@ -56,22 +56,22 @@ done
for lib in `cat syslnk.list`; do
cp -dp $lib quick2.tree/lib
done
-$RUN_HOST $CCLINK -o quick2.tree/usr/bin/bin1 $srcdir/reloc1.c \
+$CCLINK -o quick2.tree/usr/bin/bin1 $srcdir/reloc1.c \
-Wl,--rpath-link,quick2.tree/usr/lib -L quick2.tree/usr/lib -l2 -lc -l1
echo 'int main () { extern int foo; return foo; }' \
- | $RUN_HOST $CCLINK -o quick2.tree/usr/bin/bin2 -xc - -xnone \
+ | $CCLINK -o quick2.tree/usr/bin/bin2 -xc - -xnone \
-L quick2.tree/usr/lib -l4
-$RUN_HOST $CCLINK -o quick2.tree/usr/bin/bin3 $srcdir/reloc1.c \
+$CCLINK -o quick2.tree/usr/bin/bin3 $srcdir/reloc1.c \
-Wl,--rpath-link,quick2.tree/usr/lib -L quick2.tree/usr/lib -l7 -lc -l2 -l1
-$RUN_HOST $CCLINK -o quick2.tree/usr/bin/bin4 $srcdir/quick1.c \
+$CCLINK -o quick2.tree/usr/bin/bin4 $srcdir/quick1.c \
-Wl,--rpath-link,quick2.tree/usr/lib -L quick2.tree/usr/lib -l2 -lc -l1
-$RUN_HOST $CCLINK -o quick2.tree/usr/bin/bin5 $srcdir/quick1.c \
+$CCLINK -o quick2.tree/usr/bin/bin5 $srcdir/quick1.c \
-Wl,--rpath-link,quick2.tree/usr/lib -L quick2.tree/usr/lib -l7 -lc -l2 -l1
echo 'int main () { return 0; }' \
- | $RUN_HOST $CCLINK -o quick2.tree/usr/bin/bin6 -xc - -xnone \
+ | $CCLINK -o quick2.tree/usr/bin/bin6 -xc - -xnone \
-Wl,--rpath-link,quick2.tree/usr/lib -L quick2.tree/usr/lib -l6
echo 'int main () { return 0; }' \
- | $RUN_HOST $CCLINK -o quick2.tree/usr/bin/bin7 -static -xc - -xnone
+ | $CCLINK -o quick2.tree/usr/bin/bin7 -static -xc - -xnone
cat > quick2.tree/usr/bin/bin8 <<EOF
#!/bin/sh
echo This is a sample shell script
@@ -113,7 +113,7 @@ exit 0
EOF
chmod 755 quick2.tree/usr/bin/bin11.script
echo 'int main () { return 0; }' \
- | $RUN_HOST $CCLINK -o quick2.tree/usr/bin/bin12 -pie -fPIE -xc - -xnone
+ | $CCLINK -o quick2.tree/usr/bin/bin12 -pie -fPIE -xc - -xnone
cat > quick2.tree/etc/prelink.conf <<EOF
-b *.sh
-c quick2.tree/etc/prelink.conf.d/*.conf
@@ -147,7 +147,7 @@ cp -p quick2.tree/usr/lib/lib2.later.so{,.orig}
touch quick2.tree/usr/lib/lib7.later.so
cp -p quick2.tree/usr/lib/lib7.later.so{,.orig}
echo $PRELINK ${PRELINK_OPTS--vm} -avvvvv > quick2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -avvvvv > quick2.tree/etc/log1 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} -avvvvv > quick2.tree/etc/log1 2>&1 || exit 1
cat quick2.tree/etc/log1 >> quick2.log
grep -q 'lib7.so: Not enough room to add .dynamic entry' \
quick2.tree/etc/log1 || exit 60
@@ -156,7 +156,7 @@ grep -q 'Could not prelink .*bin3 because its dependency .*lib7.so could not be
grep -q 'Could not prelink .*bin5 because its dependency .*lib7.so could not be prelinked' \
quick2.tree/etc/log1 || exit 62
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> quick2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick2.tree/etc/log2 2>&1 || exit 2
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick2.tree/etc/log2 2>&1 || exit 2
cat quick2.tree/etc/log2 >> quick2.log
stat quick2.tree/usr/lib/lib2.so >> quick2.log
echo chmod 644 quick2.tree/usr/lib/lib2.so >> quick2.log
@@ -166,7 +166,7 @@ echo chmod 755 quick2.tree/usr/lib/lib2.so >> quick2.log
chmod 755 quick2.tree/usr/lib/lib2.so
stat quick2.tree/usr/lib/lib2.so >> quick2.log
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> quick2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick2.tree/etc/log3 2>&1 || exit 3
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick2.tree/etc/log3 2>&1 || exit 3
cat quick2.tree/etc/log3 >> quick2.log
grep -q 'lib7.so: Not enough room to add .dynamic entry' \
quick2.tree/etc/log3 || exit 63
@@ -175,31 +175,19 @@ grep -q 'Could not prelink .*bin3 because its dependency .*lib7.so could not be
grep -q 'Could not prelink .*bin5 because its dependency .*lib7.so could not be prelinked' \
quick2.tree/etc/log3 || exit 65
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> quick2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick2.tree/etc/log4 2>&1 || exit 4
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick2.tree/etc/log4 2>&1 || exit 4
cat quick2.tree/etc/log4 >> quick2.log
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin1 || exit 5
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin2 || exit 6
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin3 || exit 7
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin4 || exit 8
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin5 || exit 9
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin6 || exit 10
-fi
-$RUN_HOST $READELF -a quick2.tree/usr/bin/bin1 >> quick2.log 2>&1 || exit 11
-$RUN_HOST $READELF -a quick2.tree/usr/bin/bin3 >> quick2.log 2>&1 || exit 12
-$RUN_HOST $READELF -a quick2.tree/usr/bin/bin4 >> quick2.log 2>&1 || exit 13
-$RUN_HOST $READELF -a quick2.tree/usr/bin/bin5 >> quick2.log 2>&1 || exit 14
-$RUN_HOST $READELF -a quick2.tree/usr/bin/bin6 >> quick2.log 2>&1 || exit 15
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin1 || exit 5
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin2 || exit 6
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin3 || exit 7
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin4 || exit 8
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin5 || exit 9
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin6 || exit 10
+readelf -a quick2.tree/usr/bin/bin1 >> quick2.log 2>&1 || exit 11
+readelf -a quick2.tree/usr/bin/bin3 >> quick2.log 2>&1 || exit 12
+readelf -a quick2.tree/usr/bin/bin4 >> quick2.log 2>&1 || exit 13
+readelf -a quick2.tree/usr/bin/bin5 >> quick2.log 2>&1 || exit 14
+readelf -a quick2.tree/usr/bin/bin6 >> quick2.log 2>&1 || exit 15
BINS="quick2.tree/usr/bin/bin1 quick2.tree/usr/bin/bin4"
BINS="$BINS quick2.tree/usr/bin/bin6"
LIBS="quick2.tree/usr/lib/lib2.so"
@@ -215,31 +203,19 @@ for b in 1 3 4 5 6; do
chmod 644 quick2.tree/usr/bin/bin$b.old
done
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> quick2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick2.tree/etc/log5 2>&1 || exit 17
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick2.tree/etc/log5 2>&1 || exit 17
cat quick2.tree/etc/log5 >> quick2.log
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin1 || exit 18
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin2 || exit 19
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin3 || exit 20
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin4 || exit 21
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin5 || exit 22
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin6 || exit 23
-fi
-$RUN_HOST $READELF -a quick2.tree/usr/bin/bin1 >> quick2.log 2>&1 || exit 24
-$RUN_HOST $READELF -a quick2.tree/usr/bin/bin3 >> quick2.log 2>&1 || exit 25
-$RUN_HOST $READELF -a quick2.tree/usr/bin/bin4 >> quick2.log 2>&1 || exit 26
-$RUN_HOST $READELF -a quick2.tree/usr/bin/bin5 >> quick2.log 2>&1 || exit 27
-$RUN_HOST $READELF -a quick2.tree/usr/bin/bin6 >> quick2.log 2>&1 || exit 28
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin1 || exit 18
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin2 || exit 19
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin3 || exit 20
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin4 || exit 21
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin5 || exit 22
+LD_LIBRARY_PATH=quick2.tree/lib:quick2.tree/usr/lib quick2.tree/usr/bin/bin6 || exit 23
+readelf -a quick2.tree/usr/bin/bin1 >> quick2.log 2>&1 || exit 24
+readelf -a quick2.tree/usr/bin/bin3 >> quick2.log 2>&1 || exit 25
+readelf -a quick2.tree/usr/bin/bin4 >> quick2.log 2>&1 || exit 26
+readelf -a quick2.tree/usr/bin/bin5 >> quick2.log 2>&1 || exit 27
+readelf -a quick2.tree/usr/bin/bin6 >> quick2.log 2>&1 || exit 28
# In both etc/log1 and etc/log3 there should be one
# "Not enough room" and two "Could not prelink" warnings.
[ $(grep ^`echo $PRELINK | sed 's/ .*$/: /'` quick2.log | wc -l) -eq 6 ] || exit 29
@@ -273,7 +249,7 @@ for i in $BINS; do
chmod 644 $i.prelinked
done
echo $PRELINK -uavvvvvv >> quick2.log
-$RUN_HOST $PRELINK -uavvvvvv >> quick2.log 2>&1 || exit 31
+$PRELINK -uavvvvvv >> quick2.log 2>&1 || exit 31
for i in $BINS $SL $L1 $L2 $L3 $L4 $L5 $L6 $L7; do
cmp -s $i.orig $i || exit 32
mv -f $i.prelinked $i
diff --git a/testsuite/quick3.sh b/testsuite/quick3.sh
index d302748..1cdb523 100755
--- a/testsuite/quick3.sh
+++ b/testsuite/quick3.sh
@@ -32,8 +32,8 @@ CCLINK=`echo $CCLINK \
rm -rf quick3.tree
rm -f quick3.log
mkdir -p quick3.tree/{lib,etc,usr/lib,usr/bin}
-$RUN_HOST $CC -shared -O2 -fpic -o quick3.tree/usr/lib/lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o quick3.tree/usr/lib/lib2.so $srcdir/reloc1lib2.c \
+$CC -shared -O2 -fpic -o quick3.tree/usr/lib/lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o quick3.tree/usr/lib/lib2.so $srcdir/reloc1lib2.c \
-L quick3.tree/usr/lib -l1 -Wl,-soname,lib2.so
for lib in `cat syslib.list`; do
cp -p $lib.orig quick3.tree/lib/$lib
@@ -42,7 +42,7 @@ done
for lib in `cat syslnk.list`; do
cp -dp $lib quick3.tree/lib
done
-$RUN_HOST $CCLINK -o quick3.tree/usr/bin/bin1 $srcdir/reloc1.c \
+$CCLINK -o quick3.tree/usr/bin/bin1 $srcdir/reloc1.c \
-Wl,--rpath-link,quick3.tree/usr/lib -L quick3.tree/usr/lib -l2 -lc -l1
cat > quick3.tree/etc/prelink.conf <<EOF
quick3.tree/usr/bin
@@ -58,26 +58,24 @@ chmod 644 `ls $BINS | sed 's|$|.orig|'`
# than mtimes
sleep 3s
echo $PRELINK ${PRELINK_OPTS--vm} -avvvvv > quick3.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -avvvvv > quick3.tree/etc/log1 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} -avvvvv > quick3.tree/etc/log1 2>&1 || exit 1
cat quick3.tree/etc/log1 >> quick3.log
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> quick3.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick3.tree/etc/log2 2>&1 || exit 2
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick3.tree/etc/log2 2>&1 || exit 2
cat quick3.tree/etc/log2 >> quick3.log
-$RUN_HOST $CC -shared -O2 -fpic -o quick3.tree/usr/lib/lib2.so.0 $srcdir/reloc1lib2.c \
+$CC -shared -O2 -fpic -o quick3.tree/usr/lib/lib2.so.0 $srcdir/reloc1lib2.c \
-L quick3.tree/usr/lib -l1 -Wl,-soname,lib2.so
rm -f quick3.tree/usr/lib/lib2.so{,.orig}
cp -p quick3.tree/usr/lib/lib2.so.0{,.orig}
ln -sf lib2.so.0 quick3.tree/usr/lib/lib2.so
sleep 3s
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> quick3.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick3.tree/etc/log3 2>&1 || exit 3
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick3.tree/etc/log3 2>&1 || exit 3
cat quick3.tree/etc/log3 >> quick3.log
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=quick3.tree/lib:quick3.tree/usr/lib quick3.tree/usr/bin/bin1 || exit 4
-fi
+LD_LIBRARY_PATH=quick3.tree/lib:quick3.tree/usr/lib quick3.tree/usr/bin/bin1 || exit 4
LIBS="quick3.tree/usr/lib/lib1.so quick3.tree/usr/lib/lib2.so.0"
echo $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv >> quick3.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick3.tree/etc/log4 2>&1 || exit 5
+$PRELINK ${PRELINK_OPTS--vm} -aqvvvvv > quick3.tree/etc/log4 2>&1 || exit 5
cat quick3.tree/etc/log4 >> quick3.log
comparelibs >> quick3.log 2>&1 || exit 6
[ -L quick3.tree/usr/lib/lib2.so ] || exit 7
@@ -101,7 +99,7 @@ for i in $B1; do
chmod 644 $i.prelinked
done
echo $PRELINK -uavvvvvv >> quick3.log
-$RUN_HOST $PRELINK -uavvvvvv >> quick3.log 2>&1 || exit 31
+$PRELINK -uavvvvvv >> quick3.log 2>&1 || exit 31
for i in $B1 $SL $L1 $L3; do
cmp -s $i.orig $i || exit 32
mv -f $i.prelinked $i
diff --git a/testsuite/reloc1.sh b/testsuite/reloc1.sh
index 06c6aba..5616d4e 100755
--- a/testsuite/reloc1.sh
+++ b/testsuite/reloc1.sh
@@ -2,19 +2,17 @@
. `dirname $0`/functions.sh
rm -f reloc1 reloc1lib*.so reloc1.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o reloc1lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o reloc1lib2.so $srcdir/reloc1lib2.c reloc1lib1.so
+$CC -shared -O2 -fpic -o reloc1lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o reloc1lib2.so $srcdir/reloc1lib2.c reloc1lib1.so
BINS="reloc1"
LIBS="reloc1lib1.so reloc1lib2.so"
-$RUN_HOST $CCLINK -o reloc1 $srcdir/reloc1.c -Wl,--rpath-link,. reloc1lib2.so -lc reloc1lib1.so
+$CCLINK -o reloc1 $srcdir/reloc1.c -Wl,--rpath-link,. reloc1lib2.so -lc reloc1lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc1 > reloc1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./reloc1 >> reloc1.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./reloc1 >> reloc1.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` reloc1.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc1 || exit 3
-fi
-$RUN_HOST $READELF -a ./reloc1 >> reloc1.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./reloc1 || exit 3
+readelf -a ./reloc1 >> reloc1.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./reloc1
comparelibs >> reloc1.log 2>&1 || exit 5
diff --git a/testsuite/reloc10.sh b/testsuite/reloc10.sh
index 55181cc..03034c1 100755
--- a/testsuite/reloc10.sh
+++ b/testsuite/reloc10.sh
@@ -2,23 +2,21 @@
. `dirname $0`/functions.sh
rm -f reloc10 reloc10lib*.so reloc10.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o reloc10lib1.so $srcdir/reloc10lib1.c
-$RUN_HOST $CC -shared -O2 -nostdlib -fpic -o reloc10lib2.so $srcdir/reloc10lib2.c reloc10lib1.so
-$RUN_HOST $CC -shared -O2 -nostdlib -fpic -o reloc10lib3.so $srcdir/reloc10lib3.c reloc10lib1.so
-$RUN_HOST $CC -shared -O2 -nostdlib -fpic -o reloc10lib4.so $srcdir/reloc10lib4.c reloc10lib1.so
-$RUN_HOST $CC -shared -O2 -fpic -o reloc10lib5.so $srcdir/reloc10lib5.c -Wl,--rpath-link,. \
+$CC -shared -O2 -fpic -o reloc10lib1.so $srcdir/reloc10lib1.c
+$CC -shared -O2 -nostdlib -fpic -o reloc10lib2.so $srcdir/reloc10lib2.c reloc10lib1.so
+$CC -shared -O2 -nostdlib -fpic -o reloc10lib3.so $srcdir/reloc10lib3.c reloc10lib1.so
+$CC -shared -O2 -nostdlib -fpic -o reloc10lib4.so $srcdir/reloc10lib4.c reloc10lib1.so
+$CC -shared -O2 -fpic -o reloc10lib5.so $srcdir/reloc10lib5.c -Wl,--rpath-link,. \
reloc10lib2.so reloc10lib3.so reloc10lib4.so
BINS="reloc10"
LIBS="reloc10lib1.so reloc10lib2.so reloc10lib3.so reloc10lib4.so reloc10lib5.so"
-$RUN_HOST $CCLINK -o reloc10 $srcdir/reloc10.c -Wl,--rpath-link,. reloc10lib5.so -lc reloc10lib{2,3,4}.so
+$CCLINK -o reloc10 $srcdir/reloc10.c -Wl,--rpath-link,. reloc10lib5.so -lc reloc10lib{2,3,4}.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc10 > reloc10.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./reloc10 >> reloc10.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./reloc10 >> reloc10.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` reloc10.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc10 || exit 3
-fi
-$RUN_HOST $READELF -a ./reloc10 >> reloc10.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./reloc10 || exit 3
+readelf -a ./reloc10 >> reloc10.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./reloc10
comparelibs >> reloc10.log 2>&1 || exit 5
diff --git a/testsuite/reloc11.sh b/testsuite/reloc11.sh
index 706fdb4..fa0eab9 100755
--- a/testsuite/reloc11.sh
+++ b/testsuite/reloc11.sh
@@ -2,20 +2,18 @@
. `dirname $0`/functions.sh
rm -f reloc11 reloc11lib*.so reloc11.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -nostdlib -fpic -o reloc11lib1.so $srcdir/reloc10lib4.c
-$RUN_HOST $CC -shared -O2 -nostdlib -fpic -o reloc11lib2.so $srcdir/reloc11lib2.c
-$RUN_HOST $CC -shared -O2 -nostdlib -fpic -o reloc11lib3.so $srcdir/reloc11lib3.c reloc11lib2.so
+$CC -shared -O2 -nostdlib -fpic -o reloc11lib1.so $srcdir/reloc10lib4.c
+$CC -shared -O2 -nostdlib -fpic -o reloc11lib2.so $srcdir/reloc11lib2.c
+$CC -shared -O2 -nostdlib -fpic -o reloc11lib3.so $srcdir/reloc11lib3.c reloc11lib2.so
BINS="reloc11"
LIBS="reloc11lib1.so reloc11lib2.so reloc11lib3.so"
-$RUN_HOST $CCLINK -o reloc11 $srcdir/reloc11.c -Wl,--rpath-link,. reloc11lib1.so reloc11lib3.so -lc reloc11lib2.so
+$CCLINK -o reloc11 $srcdir/reloc11.c -Wl,--rpath-link,. reloc11lib1.so reloc11lib3.so -lc reloc11lib2.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc11 > reloc11.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./reloc11 >> reloc11.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./reloc11 >> reloc11.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` reloc11.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc11 || exit 3
-fi
-$RUN_HOST $READELF -a ./reloc11 >> reloc11.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./reloc11 || exit 3
+readelf -a ./reloc11 >> reloc11.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./reloc11
comparelibs >> reloc11.log 2>&1 || exit 5
diff --git a/testsuite/reloc2.sh b/testsuite/reloc2.sh
index b21d535..42bb63f 100755
--- a/testsuite/reloc2.sh
+++ b/testsuite/reloc2.sh
@@ -1,7 +1,7 @@
#!/bin/bash
. `dirname $0`/functions.sh
SHFLAGS=
-case "`$RUN uname -m`" in
+case "`uname -m`" in
ia64|ppc*|x86_64|mips*|arm*) SHFLAGS=-fpic;; # Does not support non-pic shared libs
s390*) if file reloc1lib1.so | grep -q 64-bit; then SHFLAGS=-fpic; fi;;
esac
@@ -13,21 +13,19 @@ if test -z "$SHFLAGS" -a -x /usr/sbin/getenforce; then
esac
fi
rm -f reloc2 reloc2lib*.so reloc2.log
-$RUN_HOST $CC -shared $SHFLAGS -O2 -o reloc2lib1.so $srcdir/reloc2lib1.c
-$RUN_HOST $CC -shared $SHFLAGS -O2 -o reloc2lib2.so $srcdir/reloc2lib2.c \
+$CC -shared $SHFLAGS -O2 -o reloc2lib1.so $srcdir/reloc2lib1.c
+$CC -shared $SHFLAGS -O2 -o reloc2lib2.so $srcdir/reloc2lib2.c \
reloc2lib1.so 2>/dev/null
BINS="reloc2"
LIBS="reloc2lib1.so reloc2lib2.so"
-$RUN_HOST $CCLINK -o reloc2 $srcdir/reloc2.c -Wl,--rpath-link,. reloc2lib2.so
-$RUN_HOST $STRIP -R .comment $BINS $LIBS
+$CCLINK -o reloc2 $srcdir/reloc2.c -Wl,--rpath-link,. reloc2lib2.so
+strip -R .comment $BINS $LIBS
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc2 > reloc2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./reloc2 >> reloc2.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./reloc2 >> reloc2.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` reloc2.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc2 || exit 3
-fi
-$RUN_HOST $READELF -a ./reloc2 >> reloc2.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./reloc2 || exit 3
+readelf -a ./reloc2 >> reloc2.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./reloc2
comparelibs >> reloc2.log 2>&1 || exit 5
diff --git a/testsuite/reloc3.sh b/testsuite/reloc3.sh
index 96c2c05..5941798 100755
--- a/testsuite/reloc3.sh
+++ b/testsuite/reloc3.sh
@@ -2,20 +2,18 @@
. `dirname $0`/functions.sh
rm -f reloc3 reloc3lib*.so reloc3.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o reloc3lib1.so $srcdir/reloc3lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o reloc3lib2.so $srcdir/reloc1lib2.c reloc3lib1.so
+$CC -shared -O2 -fpic -o reloc3lib1.so $srcdir/reloc3lib1.c
+$CC -shared -O2 -fpic -o reloc3lib2.so $srcdir/reloc1lib2.c reloc3lib1.so
BINS="reloc3"
LIBS="reloc3lib1.so reloc3lib2.so"
-$RUN_HOST $CCLINK -o reloc3 $srcdir/reloc3.c -Wl,--rpath-link,. reloc3lib2.so -lc reloc3lib1.so
-$RUN_HOST $STRIP -g $BINS $LIBS
+$CCLINK -o reloc3 $srcdir/reloc3.c -Wl,--rpath-link,. reloc3lib2.so -lc reloc3lib1.so
+strip -g $BINS $LIBS
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc3 > reloc3.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./reloc3 >> reloc3.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./reloc3 >> reloc3.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` reloc3.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc3 >> reloc3.log || exit 3
-fi
-$RUN_HOST $READELF -a ./reloc3 >> reloc3.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./reloc3 >> reloc3.log || exit 3
+readelf -a ./reloc3 >> reloc3.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./reloc3
comparelibs >> reloc3.log 2>&1 || exit 5
diff --git a/testsuite/reloc4.sh b/testsuite/reloc4.sh
index 0201205..992c33a 100755
--- a/testsuite/reloc4.sh
+++ b/testsuite/reloc4.sh
@@ -4,33 +4,31 @@
[ -z "$CHECK_ME_HARDER" ] && exit 77
rm -f reloc4 reloc4lib*.so reloc4.log
rm -f prelink.cache
-$HOST_CC -O2 -o reloc4lib1.tmp $srcdir/reloc4lib1.c
-$HOST_CC -O2 -o reloc4lib2.tmp $srcdir/reloc4lib2.c
-$HOST_CC -O2 -o reloc4lib3.tmp $srcdir/reloc4lib3.c
-$HOST_CC -O2 -o reloc4.tmp $srcdir/reloc4.c
+$CC -O2 -o reloc4lib1.tmp $srcdir/reloc4lib1.c
+$CC -O2 -o reloc4lib2.tmp $srcdir/reloc4lib2.c
+$CC -O2 -o reloc4lib3.tmp $srcdir/reloc4lib3.c
+$CC -O2 -o reloc4.tmp $srcdir/reloc4.c
./reloc4lib1.tmp > reloc4lib1.tmp.c
./reloc4lib2.tmp > reloc4lib2.tmp.c
./reloc4lib3.tmp > reloc4lib3.tmp.c
./reloc4.tmp > reloc4.tmp.c
-case "`$RUN uname -m`" in
+case "`uname -m`" in
mips*) extra=-mxgot ;;
*) extra= ;;
esac
-$RUN_HOST $CC -shared -fpic $extra -o reloc4lib1.so reloc4lib1.tmp.c
-$RUN_HOST $CC -shared -fpic $extra -o reloc4lib2.so reloc4lib2.tmp.c reloc4lib1.so
-$RUN_HOST $CC -shared -fpic $extra -o reloc4lib3.so reloc4lib3.tmp.c reloc4lib2.so
+$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"
-$RUN_HOST $CCLINK $extra -o reloc4 reloc4.tmp.c -Wl,--rpath-link,. reloc4lib3.so -lc reloc4lib2.so
+$CCLINK $extra -o reloc4 reloc4.tmp.c -Wl,--rpath-link,. reloc4lib3.so -lc reloc4lib2.so
savelibs
rm -f reloc4*.tmp reloc4*.tmp.c
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc4 > reloc4.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./reloc4 >> reloc4.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./reloc4 >> reloc4.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` reloc4.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc4 || exit 3
-fi
-$RUN_HOST $READELF -a ./reloc4 >> reloc4.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./reloc4 || exit 3
+readelf -a ./reloc4 >> reloc4.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./reloc4
comparelibs >> reloc4.log 2>&1 || exit 5
diff --git a/testsuite/reloc5.sh b/testsuite/reloc5.sh
index 0fbf2a8..b17cbff 100755
--- a/testsuite/reloc5.sh
+++ b/testsuite/reloc5.sh
@@ -4,19 +4,17 @@
[ -z "$CHECK_ME_HARDER" ] && exit 77
rm -f reloc5 reloc5.log
rm -f prelink.cache
-$HOST_CC -O2 -o reloc5.tmp $srcdir/reloc5.c
+$CC -O2 -o reloc5.tmp $srcdir/reloc5.c
./reloc5.tmp > reloc5.tmp.c
BINS="reloc5"
-$RUN_HOST $CCLINK -o reloc5 reloc5.tmp.c -Wl,--rpath-link,. reloc4lib3.so -lc reloc4lib2.so
+$CCLINK -o reloc5 reloc5.tmp.c -Wl,--rpath-link,. reloc4lib3.so -lc reloc4lib2.so
savelibs
rm -f reloc5*.tmp reloc5*.tmp.c
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc5 > reloc5.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./reloc5 >> reloc5.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./reloc5 >> reloc5.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` reloc5.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc5 || exit 3
-fi
-$RUN_HOST $READELF -a ./reloc5 >> reloc5.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./reloc5 || exit 3
+readelf -a ./reloc5 >> reloc5.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./reloc5
comparelibs >> reloc5.log 2>&1 || exit 5
diff --git a/testsuite/reloc6.sh b/testsuite/reloc6.sh
index a660233..f2a5b17 100755
--- a/testsuite/reloc6.sh
+++ b/testsuite/reloc6.sh
@@ -2,34 +2,22 @@
. `dirname $0`/functions.sh
rm -f reloc6 reloc6lib*.so reloc6.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o reloc6lib1.so $srcdir/reloc3lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o reloc6lib2.so $srcdir/reloc1lib2.c reloc6lib1.so
-$RUN_HOST $CCLINK -o reloc6 $srcdir/reloc3.c -Wl,--rpath-link,. reloc6lib2.so -lc reloc6lib1.so
-$RUN_HOST $CCLINK -o reloc6.nop $srcdir/reloc3.c -Wl,--rpath-link,. reloc6lib2.so -lc reloc6lib1.so
+$CC -shared -O2 -fpic -o reloc6lib1.so $srcdir/reloc3lib1.c
+$CC -shared -O2 -fpic -o reloc6lib2.so $srcdir/reloc1lib2.c reloc6lib1.so
+$CCLINK -o reloc6 $srcdir/reloc3.c -Wl,--rpath-link,. reloc6lib2.so -lc reloc6lib1.so
+$CCLINK -o reloc6.nop $srcdir/reloc3.c -Wl,--rpath-link,. reloc6lib2.so -lc reloc6lib1.so
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc6 > reloc6.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./reloc6 >> reloc6.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./reloc6 >> reloc6.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` reloc6.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc6 >> reloc6.log || exit 3
-fi
-$RUN_HOST $READELF -a ./reloc6 >> reloc6.log 2>&1 || exit 4
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc6.nop >> reloc6.log || exit 5
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. LD_BIND_NOW=1 ./reloc6.nop >> reloc6.log || exit 6
-fi
+LD_LIBRARY_PATH=. ./reloc6 >> reloc6.log || exit 3
+readelf -a ./reloc6 >> reloc6.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./reloc6.nop >> reloc6.log || exit 5
+LD_LIBRARY_PATH=. LD_BIND_NOW=1 ./reloc6.nop >> reloc6.log || exit 6
mv -f reloc6lib2.so reloc6lib2.so.p
-$RUN_HOST $CC -shared -O2 -fpic -o reloc6lib2.so $srcdir/reloc1lib2.c reloc6lib1.so
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc6 >> reloc6.log || exit 7
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc6.nop >> reloc6.log || exit 8
-fi
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. LD_BIND_NOW=1 ./reloc6.nop >> reloc6.log || exit 9
-fi
+$CC -shared -O2 -fpic -o reloc6lib2.so $srcdir/reloc1lib2.c reloc6lib1.so
+LD_LIBRARY_PATH=. ./reloc6 >> reloc6.log || exit 7
+LD_LIBRARY_PATH=. ./reloc6.nop >> reloc6.log || exit 8
+LD_LIBRARY_PATH=. LD_BIND_NOW=1 ./reloc6.nop >> reloc6.log || exit 9
mv -f reloc6lib2.so reloc6lib2.so.nop
mv -f reloc6lib2.so.p reloc6lib2.so
# So that it is not prelinked again
diff --git a/testsuite/reloc7.sh b/testsuite/reloc7.sh
index a3dcaf6..c7dab99 100755
--- a/testsuite/reloc7.sh
+++ b/testsuite/reloc7.sh
@@ -2,19 +2,17 @@
. `dirname $0`/functions.sh
rm -f reloc7 reloc7lib*.so reloc7.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc7lib1.so $srcdir/reloc3lib1.c
-$RUN_HOST $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc7lib2.so $srcdir/reloc1lib2.c reloc7lib1.so
+$CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc7lib1.so $srcdir/reloc3lib1.c
+$CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc7lib2.so $srcdir/reloc1lib2.c reloc7lib1.so
BINS="reloc7"
LIBS="reloc7lib1.so reloc7lib2.so"
-$RUN_HOST $CCLINK -o reloc7 -Wl,-z,nocombreloc $srcdir/reloc7.c -Wl,--rpath-link,. reloc7lib2.so -lc reloc7lib1.so
+$CCLINK -o reloc7 -Wl,-z,nocombreloc $srcdir/reloc7.c -Wl,--rpath-link,. reloc7lib2.so -lc reloc7lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc7 > reloc7.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./reloc7 >> reloc7.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./reloc7 >> reloc7.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` reloc7.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc7 >> reloc7.log || exit 3
-fi
-$RUN_HOST $READELF -a ./reloc7 >> reloc7.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./reloc7 >> reloc7.log || exit 3
+readelf -a ./reloc7 >> reloc7.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./reloc7
comparelibs >> reloc7.log 2>&1 || exit 5
diff --git a/testsuite/reloc8.sh b/testsuite/reloc8.sh
index 46382af..7fd6517 100755
--- a/testsuite/reloc8.sh
+++ b/testsuite/reloc8.sh
@@ -1,33 +1,29 @@
#!/bin/bash
. `dirname $0`/functions.sh
# Disable this test under SELinux
-if [ "x$CROSS" = "x" ]; then
- if test -x /usr/sbin/getenforce; then
+if test -x /usr/sbin/getenforce; then
case "`/usr/sbin/getenforce 2>/dev/null`" in
Permissive|Disabled) ;;
*) exit 77 ;;
esac
- fi
fi
rm -f reloc8 reloc8lib*.so reloc8.log
rm -f prelink.cache
NOCOPYRELOC=-Wl,-z,nocopyreloc
-case "`$RUN uname -m`" in
+case "`uname -m`" in
x86_64|s390*|sparc*) if file reloc1lib1.so | grep -q 64-bit; then NOCOPYRELOC=; fi;;
esac
-$RUN_HOST $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc8lib1.so $srcdir/reloc3lib1.c
-$RUN_HOST $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc8lib2.so $srcdir/reloc1lib2.c reloc8lib1.so
+$CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc8lib1.so $srcdir/reloc3lib1.c
+$CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc8lib2.so $srcdir/reloc1lib2.c reloc8lib1.so
BINS="reloc8"
LIBS="reloc8lib1.so reloc8lib2.so"
-$RUN_HOST $CCLINK -o reloc8 $NOCOPYRELOC $srcdir/reloc7.c -Wl,--rpath-link,. reloc8lib2.so -lc reloc8lib1.so
+$CCLINK -o reloc8 $NOCOPYRELOC $srcdir/reloc7.c -Wl,--rpath-link,. reloc8lib2.so -lc reloc8lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc8 > reloc8.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./reloc8 >> reloc8.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./reloc8 >> reloc8.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` reloc8.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc8 >> reloc8.log || exit 3
-fi
-$RUN_HOST $READELF -a ./reloc8 >> reloc8.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./reloc8 >> reloc8.log || exit 3
+readelf -a ./reloc8 >> reloc8.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./reloc8
comparelibs >> reloc8.log 2>&1 || exit 5
diff --git a/testsuite/reloc9.sh b/testsuite/reloc9.sh
index 4350c30..e87f517 100755
--- a/testsuite/reloc9.sh
+++ b/testsuite/reloc9.sh
@@ -1,33 +1,29 @@
#!/bin/bash
. `dirname $0`/functions.sh
# Disable this test under SELinux
-if [ "x$CROSS" = "x" ]; then
- if test -x /usr/sbin/getenforce; then
+if test -x /usr/sbin/getenforce; then
case "`/usr/sbin/getenforce 2>/dev/null`" in
Permissive|Disabled) ;;
*) exit 77 ;;
esac
- fi
fi
rm -f reloc9 reloc9lib*.so reloc9.log
rm -f prelink.cache
NOCOPYRELOC=-Wl,-z,nocopyreloc
-case "`$RUN uname -m`" in
+case "`uname -m`" in
x86_64|s390*|sparc*) if file reloc1lib1.so | grep -q 64-bit; then NOCOPYRELOC=; fi;;
esac
-$RUN_HOST $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc9lib1.so $srcdir/reloc3lib1.c
-$RUN_HOST $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc9lib2.so $srcdir/reloc1lib2.c reloc9lib1.so
+$CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc9lib1.so $srcdir/reloc3lib1.c
+$CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc9lib2.so $srcdir/reloc1lib2.c reloc9lib1.so
BINS="reloc9"
LIBS="reloc9lib1.so reloc9lib2.so"
-$RUN_HOST $CCLINK -o reloc9 -Wl,-z,nocombreloc $NOCOPYRELOC $srcdir/reloc7.c -Wl,--rpath-link,. reloc9lib2.so -lc reloc9lib1.so
+$CCLINK -o reloc9 -Wl,-z,nocombreloc $NOCOPYRELOC $srcdir/reloc7.c -Wl,--rpath-link,. reloc9lib2.so -lc reloc9lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./reloc9 > reloc9.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./reloc9 >> reloc9.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./reloc9 >> reloc9.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` reloc9.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./reloc9 >> reloc9.log || exit 3
-fi
-$RUN_HOST $READELF -a ./reloc9 >> reloc9.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./reloc9 >> reloc9.log || exit 3
+readelf -a ./reloc9 >> reloc9.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./reloc9
comparelibs >> reloc9.log 2>&1 || exit 5
diff --git a/testsuite/shuffle1.sh b/testsuite/shuffle1.sh
index d3d3e18..61e596f 100755
--- a/testsuite/shuffle1.sh
+++ b/testsuite/shuffle1.sh
@@ -2,23 +2,21 @@
. `dirname $0`/functions.sh
rm -f shuffle1 shuffle1lib*.so shuffle1.log shuffle1.lds
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle1lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle1lib2.so $srcdir/reloc1lib2.c shuffle1lib1.so
+$CC -shared -O2 -fpic -o shuffle1lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o shuffle1lib2.so $srcdir/reloc1lib2.c shuffle1lib1.so
BINS="shuffle1"
LIBS="shuffle1lib1.so shuffle1lib2.so"
-$RUN_HOST $CCLINK -o shuffle1 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle1lib2.so -lc shuffle1lib1.so \
+$CCLINK -o shuffle1 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle1lib2.so -lc shuffle1lib1.so \
-Wl,--verbose 2>&1 | sed -e '/^=========/,/^=========/!d;/^=========/d' \
-e 's/0x08048000/0x08000000/;s/SIZEOF_HEADERS.*$/& . += 56;/' > shuffle1.lds
-$RUN_HOST $CCLINK -o shuffle1 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle1lib2.so -lc shuffle1lib1.so \
+$CCLINK -o shuffle1 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle1lib2.so -lc shuffle1lib1.so \
-Wl,-T,shuffle1.lds
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle1 > shuffle1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle1 >> shuffle1.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle1 >> shuffle1.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle1.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./shuffle1 || exit 3
-fi
-$RUN_HOST $READELF -a ./shuffle1 >> shuffle1.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./shuffle1 || exit 3
+readelf -a ./shuffle1 >> shuffle1.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./shuffle1
comparelibs >> shuffle1.log 2>&1 || exit 5
diff --git a/testsuite/shuffle2.sh b/testsuite/shuffle2.sh
index 0ce3758..953cea3 100755
--- a/testsuite/shuffle2.sh
+++ b/testsuite/shuffle2.sh
@@ -1,29 +1,25 @@
#!/bin/bash
. `dirname $0`/functions.sh
# Kernels before 2.4.10 are known not to work
-if [ "x$CROSS" = "x" ]; then
- case "`$RUN uname -r`" in
+case "`uname -r`" in
[01].*|2.[0-3].*|2.4.[0-9]|2.4.[0-9][^0-9]*) exit 77;;
- esac
-fi
+esac
rm -f shuffle2 shuffle2lib*.so shuffle2.log shuffle2.lds
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle2lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle2lib2.so $srcdir/reloc1lib2.c shuffle2lib1.so
+$CC -shared -O2 -fpic -o shuffle2lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o shuffle2lib2.so $srcdir/reloc1lib2.c shuffle2lib1.so
BINS="shuffle2"
LIBS="shuffle2lib1.so shuffle2lib2.so"
-$RUN_HOST $CCLINK -o shuffle2 $srcdir/shuffle2.c -Wl,--rpath-link,. shuffle2lib2.so -lc shuffle2lib1.so \
+$CCLINK -o shuffle2 $srcdir/shuffle2.c -Wl,--rpath-link,. shuffle2lib2.so -lc shuffle2lib1.so \
-Wl,--verbose 2>&1 | sed -e '/^=========/,/^=========/!d;/^=========/d' \
-e 's/0x08048000/0x08000000/;s/SIZEOF_HEADERS.*$/& . += 56;/' > shuffle2.lds
-$RUN_HOST $CCLINK -o shuffle2 $srcdir/shuffle2.c -Wl,--rpath-link,. shuffle2lib2.so -lc shuffle2lib1.so \
+$CCLINK -o shuffle2 $srcdir/shuffle2.c -Wl,--rpath-link,. shuffle2lib2.so -lc shuffle2lib1.so \
-Wl,-T,shuffle2.lds
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle2 > shuffle2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle2 >> shuffle2.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle2 >> shuffle2.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle2.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./shuffle2 || exit 3
-fi
-$RUN_HOST $READELF -a ./shuffle2 >> shuffle2.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./shuffle2 || exit 3
+readelf -a ./shuffle2 >> shuffle2.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./shuffle2
comparelibs >> shuffle2.log 2>&1 || exit 5
diff --git a/testsuite/shuffle3.sh b/testsuite/shuffle3.sh
index 985de3a..534d174 100755
--- a/testsuite/shuffle3.sh
+++ b/testsuite/shuffle3.sh
@@ -1,30 +1,26 @@
#!/bin/bash
. `dirname $0`/functions.sh
# Kernels before 2.4.10 are known not to work
-if [ "x$CROSS" = "x" ]; then
- case "`$RUN uname -r`" in
+case "`uname -r`" in
[01].*|2.[0-3].*|2.4.[0-9]|2.4.[0-9][^0-9]*) exit 77;;
- esac
-fi
+esac
rm -f shuffle3 shuffle3lib*.so shuffle3.log shuffle3.lds
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle3lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle3lib2.so $srcdir/reloc1lib2.c shuffle3lib1.so
+$CC -shared -O2 -fpic -o shuffle3lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o shuffle3lib2.so $srcdir/reloc1lib2.c shuffle3lib1.so
BINS="shuffle3"
LIBS="shuffle3lib1.so shuffle3lib2.so"
-$RUN_HOST $CCLINK -o shuffle3 $srcdir/shuffle2.c -Wl,--rpath-link,. shuffle3lib2.so -lc shuffle3lib1.so \
+$CCLINK -o shuffle3 $srcdir/shuffle2.c -Wl,--rpath-link,. shuffle3lib2.so -lc shuffle3lib1.so \
-Wl,--verbose 2>&1 | sed -e '/^=========/,/^=========/!d;/^=========/d' \
-e 's/0x08048000/0x08000000/' > shuffle3.lds
-$RUN_HOST $CCLINK -o shuffle3 $srcdir/shuffle2.c -Wl,--rpath-link,. shuffle3lib2.so -lc shuffle3lib1.so \
+$CCLINK -o shuffle3 $srcdir/shuffle2.c -Wl,--rpath-link,. shuffle3lib2.so -lc shuffle3lib1.so \
-Wl,-T,shuffle3.lds
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle3 > shuffle3.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle3 >> shuffle3.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle3 >> shuffle3.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle3.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./shuffle3 || exit 3
-fi
-$RUN_HOST $READELF -a ./shuffle3 >> shuffle3.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./shuffle3 || exit 3
+readelf -a ./shuffle3 >> shuffle3.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./shuffle3
comparelibs >> shuffle3.log 2>&1 || exit 5
diff --git a/testsuite/shuffle4.sh b/testsuite/shuffle4.sh
index b9375ee..398972a 100755
--- a/testsuite/shuffle4.sh
+++ b/testsuite/shuffle4.sh
@@ -1,22 +1,18 @@
#!/bin/bash
. `dirname $0`/functions.sh
# Kernels before 2.4.10 are known not to work
-if [ "x$CROSS" = "x" ]; then
- case "`$RUN uname -r`" in
+case "`uname -r`" in
[01].*|2.[0-3].*|2.4.[0-9]|2.4.[0-9][^0-9]*) exit 77;;
- esac
-fi
+esac
rm -f shuffle4 shuffle4.log
BINS="shuffle4"
-$RUN_HOST $CCLINK -o shuffle4 $srcdir/shuffle2.c -Wl,--rpath-link,. shuffle3lib2.so -lc shuffle3lib1.so
+$CCLINK -o shuffle4 $srcdir/shuffle2.c -Wl,--rpath-link,. shuffle3lib2.so -lc shuffle3lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle4 > shuffle4.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle4 >> shuffle4.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle4 >> shuffle4.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle4.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./shuffle4 || exit 3
-fi
-$RUN_HOST $READELF -a ./shuffle4 >> shuffle4.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./shuffle4 || exit 3
+readelf -a ./shuffle4 >> shuffle4.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./shuffle4
comparelibs >> shuffle4.log 2>&1 || exit 5
diff --git a/testsuite/shuffle5.sh b/testsuite/shuffle5.sh
index 0c71a19..e8c0297 100755
--- a/testsuite/shuffle5.sh
+++ b/testsuite/shuffle5.sh
@@ -2,23 +2,21 @@
. `dirname $0`/functions.sh
rm -f shuffle5 shuffle5lib*.so shuffle5.log shuffle5.lds
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle5lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle5lib2.so $srcdir/reloc1lib2.c shuffle5lib1.so
+$CC -shared -O2 -fpic -o shuffle5lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o shuffle5lib2.so $srcdir/reloc1lib2.c shuffle5lib1.so
BINS="shuffle5"
LIBS="shuffle5lib1.so shuffle5lib2.so"
-$RUN_HOST $CCLINK -o shuffle5 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle5lib2.so -lc shuffle5lib1.so \
+$CCLINK -o shuffle5 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle5lib2.so -lc shuffle5lib1.so \
-Wl,--verbose 2>&1 | sed -e '/^=========/,/^=========/!d;/^=========/d' \
-e 's/0x08048000/0x08000000/;s/SIZEOF_HEADERS.*$/& . += 180;/' > shuffle5.lds
-$RUN_HOST $CCLINK -o shuffle5 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle5lib2.so -lc shuffle5lib1.so \
+$CCLINK -o shuffle5 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle5lib2.so -lc shuffle5lib1.so \
-Wl,-T,shuffle5.lds
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle5 > shuffle5.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle5 >> shuffle5.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle5 >> shuffle5.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle5.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./shuffle5 || exit 3
-fi
-$RUN_HOST $READELF -a ./shuffle5 >> shuffle5.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./shuffle5 || exit 3
+readelf -a ./shuffle5 >> shuffle5.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./shuffle5
comparelibs >> shuffle5.log 2>&1 || exit 5
diff --git a/testsuite/shuffle6.sh b/testsuite/shuffle6.sh
index 4ce00ee..cdd16a0 100755
--- a/testsuite/shuffle6.sh
+++ b/testsuite/shuffle6.sh
@@ -2,36 +2,32 @@
. `dirname $0`/functions.sh
rm -f shuffle6 shuffle6lib*.so shuffle6.log shuffle6.lds
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle6lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle6lib2.so $srcdir/reloc1lib2.c shuffle6lib1.so
+$CC -shared -O2 -fpic -o shuffle6lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o shuffle6lib2.so $srcdir/reloc1lib2.c shuffle6lib1.so
BINS="shuffle6"
LIBS="shuffle6lib1.so shuffle6lib2.so"
-$RUN_HOST $CCLINK -o shuffle6 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle6lib2.so -lc shuffle6lib1.so \
+$CCLINK -o shuffle6 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle6lib2.so -lc shuffle6lib1.so \
-Wl,--verbose 2>&1 | sed -e '/^=========/,/^=========/!d;/^=========/d' \
-e 's/0x08048000/0x08000000/;s/SIZEOF_HEADERS.*$/& . += 56;/' > shuffle6.lds
-$RUN_HOST $CCLINK -o shuffle6 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle6lib2.so -lc shuffle6lib1.so \
+$CCLINK -o shuffle6 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle6lib2.so -lc shuffle6lib1.so \
-Wl,-T,shuffle6.lds
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle6 > shuffle6.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle6 >> shuffle6.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle6 >> shuffle6.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle6.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./shuffle6 || exit 3
-fi
-$RUN_HOST $READELF -a ./shuffle6 >> shuffle6.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./shuffle6 || exit 3
+readelf -a ./shuffle6 >> shuffle6.log 2>&1 || exit 4
comparelibs >> shuffle6.log 2>&1 || exit 5
for l in shuffle6lib{1,2}.so{,.orig}; do mv -f $l $l.first; done
cp -p shuffle6 shuffle6.first
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle6lib1.so $srcdir/shuffle6lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle6lib2.so $srcdir/shuffle6lib2.c shuffle6lib1.so
+$CC -shared -O2 -fpic -o shuffle6lib1.so $srcdir/shuffle6lib1.c
+$CC -shared -O2 -fpic -o shuffle6lib2.so $srcdir/shuffle6lib2.c shuffle6lib1.so
for l in shuffle6lib{1,2}.so; do cp -p $l $l.orig; done
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle6 >> shuffle6.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle6 >> shuffle6.log 2>&1 || exit 6
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle6 >> shuffle6.log 2>&1 || exit 6
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle6.log && exit 7
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./shuffle6 || exit 8
-fi
-$RUN_HOST $READELF -a ./shuffle6 >> shuffle6.log 2>&1 || exit 9
+LD_LIBRARY_PATH=. ./shuffle6 || exit 8
+readelf -a ./shuffle6 >> shuffle6.log 2>&1 || exit 9
# So that it is not prelinked again
chmod -x ./shuffle6
comparelibs >> shuffle6.log 2>&1 || exit 10
diff --git a/testsuite/shuffle7.sh b/testsuite/shuffle7.sh
index e94002d..4250b26 100755
--- a/testsuite/shuffle7.sh
+++ b/testsuite/shuffle7.sh
@@ -2,48 +2,42 @@
. `dirname $0`/functions.sh
rm -f shuffle7 shuffle7lib*.so shuffle7.log shuffle7.lds
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle7lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle7lib2.so $srcdir/reloc1lib2.c shuffle7lib1.so
+$CC -shared -O2 -fpic -o shuffle7lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o shuffle7lib2.so $srcdir/reloc1lib2.c shuffle7lib1.so
BINS="shuffle7"
LIBS="shuffle7lib1.so shuffle7lib2.so"
-$RUN_HOST $CCLINK -o shuffle7 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle7lib2.so -lc shuffle7lib1.so \
+$CCLINK -o shuffle7 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle7lib2.so -lc shuffle7lib1.so \
-Wl,--verbose 2>&1 | sed -e '/^=========/,/^=========/!d;/^=========/d' \
-e '/\.hash/a\
. = . + 0x300;' > shuffle7.lds
-$RUN_HOST $CCLINK -o shuffle7 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle7lib2.so -lc shuffle7lib1.so \
+$CCLINK -o shuffle7 $srcdir/reloc1.c -Wl,--rpath-link,. shuffle7lib2.so -lc shuffle7lib1.so \
-Wl,-T,shuffle7.lds
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle7 > shuffle7.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle7 >> shuffle7.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle7 >> shuffle7.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle7.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./shuffle7 || exit 3
-fi
-$RUN_HOST $READELF -a ./shuffle7 >> shuffle7.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./shuffle7 || exit 3
+readelf -a ./shuffle7 >> shuffle7.log 2>&1 || exit 4
comparelibs >> shuffle7.log 2>&1 || exit 5
for l in shuffle7lib{1,2}.so{,.orig}; do mv -f $l $l.first; done
cp -p shuffle7 shuffle7.first
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle7lib1.so $srcdir/shuffle6lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle7lib2.so $srcdir/shuffle6lib2.c shuffle7lib1.so
+$CC -shared -O2 -fpic -o shuffle7lib1.so $srcdir/shuffle6lib1.c
+$CC -shared -O2 -fpic -o shuffle7lib2.so $srcdir/shuffle6lib2.c shuffle7lib1.so
for l in shuffle7lib{1,2}.so; do cp -p $l $l.orig; done
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle7 >> shuffle7.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle7 >> shuffle7.log 2>&1 || exit 6
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle7 >> shuffle7.log 2>&1 || exit 6
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle7.log && exit 7
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./shuffle7 || exit 8
-fi
-$RUN_HOST $READELF -a ./shuffle7 >> shuffle7.log 2>&1 || exit 9
+LD_LIBRARY_PATH=. ./shuffle7 || exit 8
+readelf -a ./shuffle7 >> shuffle7.log 2>&1 || exit 9
comparelibs >> shuffle7.log 2>&1 || exit 10
for l in shuffle7lib{1,2}.so{,.orig}; do mv -f $l $l.second; done
cp -p shuffle7 shuffle7.second
for l in shuffle7lib{1,2}.so{,.orig}; do cp -p $l.first $l; done
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle7 >> shuffle7.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle7 >> shuffle7.log 2>&1 || exit 11
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle7 >> shuffle7.log 2>&1 || exit 11
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle7.log && exit 12
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./shuffle7 || exit 13
-fi
-$RUN_HOST $READELF -a ./shuffle7 >> shuffle7.log 2>&1 || exit 14
+LD_LIBRARY_PATH=. ./shuffle7 || exit 13
+readelf -a ./shuffle7 >> shuffle7.log 2>&1 || exit 14
comparelibs >> shuffle7.log 2>&1 || exit 15
cmp -s shuffle7{,.first} || exit 16
# So that it is not prelinked again
diff --git a/testsuite/shuffle8.sh b/testsuite/shuffle8.sh
index da2e499..7875673 100755
--- a/testsuite/shuffle8.sh
+++ b/testsuite/shuffle8.sh
@@ -2,20 +2,18 @@
. `dirname $0`/functions.sh
rm -f shuffle8 shuffle8lib*.so shuffle8.log shuffle8.lds
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle8lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o shuffle8lib2.so $srcdir/reloc1lib2.c shuffle8lib1.so
+$CC -shared -O2 -fpic -o shuffle8lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o shuffle8lib2.so $srcdir/reloc1lib2.c shuffle8lib1.so
BINS="shuffle8"
LIBS="shuffle8lib1.so shuffle8lib2.so"
-$RUN_HOST $CCLINK -o shuffle8 $srcdir/shuffle8.c -Wl,--rpath-link,. shuffle8lib2.so -lc shuffle8lib1.so
-$RUN_HOST $STRIP -R .comment shuffle8
+$CCLINK -o shuffle8 $srcdir/shuffle8.c -Wl,--rpath-link,. shuffle8lib2.so -lc shuffle8lib1.so
+strip -R .comment shuffle8
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle8 > shuffle8.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle8 >> shuffle8.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle8 >> shuffle8.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle8.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./shuffle8 || exit 3
-fi
-$RUN_HOST $READELF -a ./shuffle8 >> shuffle8.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./shuffle8 || exit 3
+readelf -a ./shuffle8 >> shuffle8.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./shuffle8
comparelibs >> shuffle8.log 2>&1 || exit 5
diff --git a/testsuite/shuffle9.sh b/testsuite/shuffle9.sh
index 6b54646..c974708 100755
--- a/testsuite/shuffle9.sh
+++ b/testsuite/shuffle9.sh
@@ -1,18 +1,18 @@
#!/bin/bash
. `dirname $0`/functions.sh
# Kernels before 2.4.10 are known not to work
-case "`$RUN uname -r`" in
+case "`uname -r`" in
[01].*|2.[0-3].*|2.4.[0-9]|2.4.[0-9][^0-9]*) exit 77;;
esac
rm -f shuffle9 shuffle9.log
BINS="shuffle9"
-$RUN_HOST $CCLINK -o shuffle9 $srcdir/shuffle9.c -Wl,--rpath-link,. shuffle3lib2.so -lc shuffle3lib1.so
+$CCLINK -o shuffle9 $srcdir/shuffle9.c -Wl,--rpath-link,. shuffle3lib2.so -lc shuffle3lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./shuffle9 > shuffle9.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./shuffle9 >> shuffle9.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./shuffle9 >> shuffle9.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` shuffle9.log && exit 2
-$RUN LD_LIBRARY_PATH=. ./shuffle9 || exit 3
-$RUN_HOST $READELF -a ./shuffle9 >> shuffle9.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./shuffle9 || exit 3
+readelf -a ./shuffle9 >> shuffle9.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./shuffle9
comparelibs >> shuffle9.log 2>&1 || exit 5
diff --git a/testsuite/tls1.sh b/testsuite/tls1.sh
index 664a2f5..585d179 100755
--- a/testsuite/tls1.sh
+++ b/testsuite/tls1.sh
@@ -3,25 +3,21 @@
# First check if __thread is supported by ld.so/gcc/ld/as:
rm -f tlstest
echo '__thread int a; int main (void) { return a; }' \
- | $RUN_HOST $CCLINK -xc - -o tlstest > /dev/null 2>&1 || exit 77
-if [ "x$CROSS" = "x" ]; then
- ( $RUN LD_LIBRARY_PATH=. ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
-fi
+ | $CC -xc - -o tlstest > /dev/null 2>&1 || exit 77
+( ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
rm -f tls1 tls1lib*.so tls1.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o tls1lib1.so $srcdir/tls1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o tls1lib2.so $srcdir/tls1lib2.c tls1lib1.so
+$CC -shared -O2 -fpic -o tls1lib1.so $srcdir/tls1lib1.c
+$CC -shared -O2 -fpic -o tls1lib2.so $srcdir/tls1lib2.c tls1lib1.so
BINS="tls1"
LIBS="tls1lib1.so tls1lib2.so"
-$RUN_HOST $CCLINK -o tls1 $srcdir/tls1.c -Wl,--rpath-link,. tls1lib2.so -lc tls1lib1.so
+$CCLINK -o tls1 $srcdir/tls1.c -Wl,--rpath-link,. tls1lib2.so -lc tls1lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./tls1 > tls1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./tls1 >> tls1.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./tls1 >> tls1.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` tls1.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./tls1 || exit 3
-fi
-$RUN_HOST $READELF -a ./tls1 >> tls1.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./tls1 || exit 3
+readelf -a ./tls1 >> tls1.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./tls1
comparelibs >> tls1.log 2>&1 || exit 5
diff --git a/testsuite/tls2.sh b/testsuite/tls2.sh
index 8c21625..6910c16 100755
--- a/testsuite/tls2.sh
+++ b/testsuite/tls2.sh
@@ -3,26 +3,22 @@
# First check if __thread is supported by ld.so/gcc/ld/as:
rm -f tlstest
echo '__thread int a; int main (void) { return a; }' \
- | $RUN_HOST $CCLINK -xc - -o tlstest > /dev/null 2>&1 || exit 77
-if [ "x$CROSS" = "x" ]; then
- ( $RUN LD_LIBRARY_PATH=. ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
-fi
+ | $CC -xc - -o tlstest > /dev/null 2>&1 || exit 77
+( ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
rm -f tls2 tls2lib*.so tls2.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o tls2lib1.so $srcdir/tls2lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o tls2lib2.so $srcdir/tls1lib2.c tls2lib1.so
+$CC -shared -O2 -fpic -o tls2lib1.so $srcdir/tls2lib1.c
+$CC -shared -O2 -fpic -o tls2lib2.so $srcdir/tls1lib2.c tls2lib1.so
BINS="tls2"
LIBS="tls2lib1.so tls2lib2.so"
-$RUN_HOST $CCLINK -o tls2 $srcdir/tls2.c -Wl,--rpath-link,. tls2lib2.so -lc tls2lib1.so
+$CCLINK -o tls2 $srcdir/tls2.c -Wl,--rpath-link,. tls2lib2.so -lc tls2lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./tls2 > tls2.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./tls2 >> tls2.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./tls2 >> tls2.log 2>&1 || exit 1
grep -v 'has undefined non-weak symbols' tls2.log \
| grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./tls2 || exit 3
-fi
-$RUN_HOST $READELF -a ./tls2 >> tls2.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./tls2 || exit 3
+readelf -a ./tls2 >> tls2.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./tls2
comparelibs >> tls2.log 2>&1 || exit 5
diff --git a/testsuite/tls3.sh b/testsuite/tls3.sh
index eb6e626..951ee55 100755
--- a/testsuite/tls3.sh
+++ b/testsuite/tls3.sh
@@ -3,12 +3,10 @@
# First check if __thread is supported by ld.so/gcc/ld/as:
rm -f tlstest
echo '__thread int a; int main (void) { return a; }' \
- | $RUN_HOST $CCLINK -xc - -o tlstest > /dev/null 2>&1 || exit 77
-if [ "x$CROSS" = "x" ]; then
- ( $RUN LD_LIBRARY_PATH=. ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
-fi
+ | $CC -xc - -o tlstest > /dev/null 2>&1 || exit 77
+( ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
SHFLAGS=
-case "`$RUN uname -m`" in
+case "`uname -m`" in
ia64|ppc*|x86_64|alpha*|s390*|mips*|arm*) SHFLAGS=-fpic;; # Does not support non-pic shared libs
esac
# Disable this test under SELinux if textrel
@@ -20,20 +18,18 @@ if test -z "$SHFLAGS" -a -x /usr/sbin/getenforce; then
fi
rm -f tls3 tls3lib*.so tls3.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o tls3lib1.so $srcdir/tls1lib1.c
-$RUN_HOST $CC -shared -O2 $SHFLAGS -o tls3lib2.so $srcdir/tls3lib2.c \
+$CC -shared -O2 -fpic -o tls3lib1.so $srcdir/tls1lib1.c
+$CC -shared -O2 $SHFLAGS -o tls3lib2.so $srcdir/tls3lib2.c \
tls3lib1.so 2>/dev/null
BINS="tls3"
LIBS="tls3lib1.so tls3lib2.so"
-$RUN_HOST $CCLINK -o tls3 $srcdir/tls1.c -Wl,--rpath-link,. tls3lib2.so -lc tls3lib1.so
+$CCLINK -o tls3 $srcdir/tls1.c -Wl,--rpath-link,. tls3lib2.so -lc tls3lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./tls3 > tls3.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./tls3 >> tls3.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./tls3 >> tls3.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` tls3.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./tls3 || exit 3
-fi
-$RUN_HOST $READELF -a ./tls3 >> tls3.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./tls3 || exit 3
+readelf -a ./tls3 >> tls3.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./tls3
comparelibs >> tls3.log 2>&1 || exit 5
diff --git a/testsuite/tls4.sh b/testsuite/tls4.sh
index 889f0cc..e00e7cc 100755
--- a/testsuite/tls4.sh
+++ b/testsuite/tls4.sh
@@ -3,26 +3,22 @@
# First check if __thread is supported by ld.so/gcc/ld/as:
rm -f tlstest
echo '__thread int a; int main (void) { return a; }' \
- | $RUN_HOST $CCLINK -xc - -o tlstest > /dev/null 2>&1 || exit 77
-if [ "x$CROSS" = "x" ]; then
- ( $RUN LD_LIBRARY_PATH=. ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
-fi
+ | $CC -xc - -o tlstest > /dev/null 2>&1 || exit 77
+( ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
rm -f tls4 tls4lib*.so tls4.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o tls4lib1.so $srcdir/tls4lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o tls4lib2.so $srcdir/tls4lib2.c \
+$CC -shared -O2 -fpic -o tls4lib1.so $srcdir/tls4lib1.c
+$CC -shared -O2 -fpic -o tls4lib2.so $srcdir/tls4lib2.c \
tls4lib1.so 2>/dev/null
BINS="tls4"
LIBS="tls4lib1.so tls4lib2.so"
-$RUN_HOST $CCLINK -o tls4 $srcdir/tls4.c -Wl,--rpath-link,. tls4lib2.so -lc tls4lib1.so
+$CCLINK -o tls4 $srcdir/tls4.c -Wl,--rpath-link,. tls4lib2.so -lc tls4lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./tls4 > tls4.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./tls4 >> tls4.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./tls4 >> tls4.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` tls4.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./tls4 || exit 3
-fi
-$RUN_HOST $READELF -a ./tls4 >> tls4.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./tls4 || exit 3
+readelf -a ./tls4 >> tls4.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./tls4
comparelibs >> tls4.log 2>&1 || exit 5
diff --git a/testsuite/tls5.sh b/testsuite/tls5.sh
index 8c1fac4..7282808 100755
--- a/testsuite/tls5.sh
+++ b/testsuite/tls5.sh
@@ -3,34 +3,28 @@
# First check if __thread is supported by ld.so/gcc/ld/as:
rm -f tlstest
echo '__thread int a; int main (void) { return a; }' \
- | $RUN_HOST $CCLINK -xc - -o tlstest > /dev/null 2>&1 || exit 77
-if [ "x$CROSS" = "x" ]; then
- ( $RUN LD_LIBRARY_PATH=. ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
-fi
+ | $CC -xc - -o tlstest > /dev/null 2>&1 || exit 77
+( ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
rm -f tls5 tls5lib*.so tls5.log
rm -f prelink.cache
-echo 'int tls5;' | $RUN_HOST $CC -shared -O2 -fpic -xc - -o tls5lib3.so
-$RUN_HOST $CC -shared -O2 -fpic -o tls5lib1.so $srcdir/tls5lib1.c tls5lib3.so
-$RUN_HOST $CC -shared -O2 -fpic -o tls5lib2.so $srcdir/tls1lib2.c \
+echo 'int tls5;' | $CC -shared -O2 -fpic -xc - -o tls5lib3.so
+$CC -shared -O2 -fpic -o tls5lib1.so $srcdir/tls5lib1.c tls5lib3.so
+$CC -shared -O2 -fpic -o tls5lib2.so $srcdir/tls1lib2.c \
-Wl,--rpath-link,. tls5lib1.so
BINS="tls5"
LIBS="tls5lib1.so tls5lib2.so tls5lib3.so"
-$RUN_HOST $CCLINK -o tls5 $srcdir/tls1.c -Wl,--rpath-link,. tls5lib2.so -lc tls5lib1.so
+$CCLINK -o tls5 $srcdir/tls1.c -Wl,--rpath-link,. tls5lib2.so -lc tls5lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./tls5 > tls5.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./tls5 >> tls5.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./tls5 >> tls5.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` tls5.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./tls5 || exit 3
-fi
-$RUN_HOST $PRELINK -u tls5lib3.so || exit 4
+LD_LIBRARY_PATH=. ./tls5 || exit 3
+$PRELINK -u tls5lib3.so || exit 4
echo $PRELINK ${PRELINK_OPTS--vm} ./tls5 >> tls5.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./tls5 >> tls5.log 2>&1 || exit 5
+$PRELINK ${PRELINK_OPTS--vm} ./tls5 >> tls5.log 2>&1 || exit 5
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` tls5.log && exit 6
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./tls5 || exit 7
-fi
-$RUN_HOST $READELF -a ./tls5 >> tls5.log 2>&1 || exit 8
+LD_LIBRARY_PATH=. ./tls5 || exit 7
+readelf -a ./tls5 >> tls5.log 2>&1 || exit 8
# So that it is not prelinked again
chmod -x ./tls5
comparelibs >> tls5.log 2>&1 || exit 9
diff --git a/testsuite/tls6.sh b/testsuite/tls6.sh
index 54d4666..6a64f02 100755
--- a/testsuite/tls6.sh
+++ b/testsuite/tls6.sh
@@ -3,36 +3,30 @@
# First check if __thread is supported by ld.so/gcc/ld/as:
rm -f tlstest
echo '__thread int a; int main (void) { return a; }' \
- | $RUN_HOST $CCLINK -xc - -o tlstest > /dev/null 2>&1 || exit 77
-if [ "x$CROSS" = "x" ]; then
- ( $RUN LD_LIBRARY_PATH=. ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
-fi
+ | $CC -xc - -o tlstest > /dev/null 2>&1 || exit 77
+( ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
rm -f tls6 tls6lib*.so tls6.log
rm -f prelink.cache
-echo 'int tls6;' | $RUN_HOST $CC -shared -O2 -fpic -xc - -o tls6lib3.so
-$RUN_HOST $CC -shared -O2 -fpic -o tls6lib1.so $srcdir/tls6lib1.c tls6lib3.so
-$RUN_HOST $CC -shared -O2 -fpic -o tls6lib2.so $srcdir/tls1lib2.c \
+echo 'int tls6;' | $CC -shared -O2 -fpic -xc - -o tls6lib3.so
+$CC -shared -O2 -fpic -o tls6lib1.so $srcdir/tls6lib1.c tls6lib3.so
+$CC -shared -O2 -fpic -o tls6lib2.so $srcdir/tls1lib2.c \
-Wl,--rpath-link,. tls6lib1.so
BINS="tls6"
LIBS="tls6lib1.so tls6lib2.so tls6lib3.so"
-$RUN_HOST $CCLINK -o tls6 $srcdir/tls2.c -Wl,--rpath-link,. tls6lib2.so -lc tls6lib1.so
+$CCLINK -o tls6 $srcdir/tls2.c -Wl,--rpath-link,. tls6lib2.so -lc tls6lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./tls6 > tls6.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./tls6 >> tls6.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./tls6 >> tls6.log 2>&1 || exit 1
grep -v 'has undefined non-weak symbols' tls6.log \
| grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./tls6 || exit 3
-fi
-$RUN_HOST $PRELINK -u tls6lib3.so || exit 4
+LD_LIBRARY_PATH=. ./tls6 || exit 3
+$PRELINK -u tls6lib3.so || exit 4
echo $PRELINK ${PRELINK_OPTS--vm} ./tls6 >> tls6.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./tls6 >> tls6.log 2>&1 || exit 5
+$PRELINK ${PRELINK_OPTS--vm} ./tls6 >> tls6.log 2>&1 || exit 5
grep -v 'has undefined non-weak symbols' tls6.log \
| grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` && exit 6
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./tls6 || exit 7
-fi
-$RUN_HOST $READELF -a ./tls6 >> tls6.log 2>&1 || exit 8
+LD_LIBRARY_PATH=. ./tls6 || exit 7
+readelf -a ./tls6 >> tls6.log 2>&1 || exit 8
# So that it is not prelinked again
chmod -x ./tls6
comparelibs >> tls6.log 2>&1 || exit 9
diff --git a/testsuite/tls7.sh b/testsuite/tls7.sh
index f7e35ff..ab93719 100755
--- a/testsuite/tls7.sh
+++ b/testsuite/tls7.sh
@@ -3,23 +3,19 @@
# First check if __thread is supported by ld.so/gcc/ld/as:
rm -f tlstest
echo '__thread int a; int main (void) { return a; }' \
- | $RUN_HOST $CCLINK -xc - -o tlstest > /dev/null 2>&1 || exit 77
-if [ "x$CROSS" = "x" ]; then
- ( $RUN LD_LIBRARY_PATH=. ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
-fi
+ | $CC -xc - -o tlstest > /dev/null 2>&1 || exit 77
+( ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
rm -f tls7 tls7.log
rm -f prelink.cache
BINS="tls7"
LIBS=""
-$RUN_HOST $CCLINK -o tls7 $srcdir/tls7.c
+$CCLINK -o tls7 $srcdir/tls7.c
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./tls7 > tls7.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./tls7 >> tls7.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./tls7 >> tls7.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` tls7.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./tls7 || exit 3
-fi
-$RUN_HOST $READELF -a ./tls7 >> tls7.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./tls7 || exit 3
+readelf -a ./tls7 >> tls7.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./tls7
comparelibs >> tls7.log 2>&1 || exit 5
diff --git a/testsuite/undo1.sh b/testsuite/undo1.sh
index c349798..68eee1f 100755
--- a/testsuite/undo1.sh
+++ b/testsuite/undo1.sh
@@ -2,23 +2,21 @@
. `dirname $0`/functions.sh
rm -f undo1 undo1lib*.so undo1.log
rm -f prelink.cache
-$RUN_HOST $CC -shared -O2 -fpic -o undo1lib1.so $srcdir/reloc1lib1.c
-$RUN_HOST $CC -shared -O2 -fpic -o undo1lib2.so $srcdir/reloc1lib2.c undo1lib1.so
+$CC -shared -O2 -fpic -o undo1lib1.so $srcdir/reloc1lib1.c
+$CC -shared -O2 -fpic -o undo1lib2.so $srcdir/reloc1lib2.c undo1lib1.so
BINS="undo1"
LIBS="undo1lib1.so undo1lib2.so"
-$RUN_HOST $CCLINK -o undo1 $srcdir/reloc1.c -Wl,--rpath-link,. undo1lib2.so -lc undo1lib1.so
+$CCLINK -o undo1 $srcdir/reloc1.c -Wl,--rpath-link,. undo1lib2.so -lc undo1lib1.so
savelibs
echo $PRELINK ${PRELINK_OPTS--vm} ./undo1 > undo1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} ./undo1 >> undo1.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} ./undo1 >> undo1.log 2>&1 || exit 1
grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` undo1.log && exit 2
-if [ "x$CROSS" = "x" ]; then
- $RUN LD_LIBRARY_PATH=. ./undo1 || exit 3
-fi
-$RUN_HOST $READELF -a ./undo1 >> undo1.log 2>&1 || exit 4
+LD_LIBRARY_PATH=. ./undo1 || exit 3
+readelf -a ./undo1 >> undo1.log 2>&1 || exit 4
# So that it is not prelinked again
chmod -x ./undo1
echo $PRELINK -uo undo1.undo undo1 >> undo1.log
-$RUN_HOST $PRELINK -uo undo1.undo undo1 >> undo1.log 2>&1 || exit 5
+$PRELINK -uo undo1.undo undo1 >> undo1.log 2>&1 || exit 5
cmp -s undo1.undo undo1.orig >> undo1.log 2>&1 || exit 6
rm -f undo1.undo
comparelibs >> undo1.log 2>&1 || exit 7
diff --git a/testsuite/unprel1.sh b/testsuite/unprel1.sh
index 481db12..0463358 100755
--- a/testsuite/unprel1.sh
+++ b/testsuite/unprel1.sh
@@ -9,11 +9,11 @@ CCLINK=`echo $CCLINK \
rm -rf unprel1.tree
rm -f unprel1.log
mkdir -p unprel1.tree/{lib,etc,opt,bin}
-$RUN_HOST $CC -shared -O2 -fpic -o unprel1.tree/lib/lib1.so $srcdir/unprel1lib1.c
+$CC -shared -O2 -fpic -o unprel1.tree/lib/lib1.so $srcdir/unprel1lib1.c
cp -a unprel1.tree/{lib,opt}/lib1.so
-$RUN_HOST $CC -shared -O2 -fpic -o unprel1.tree/lib/lib2.so $srcdir/unprel1lib2.c \
+$CC -shared -O2 -fpic -o unprel1.tree/lib/lib2.so $srcdir/unprel1lib2.c \
-L unprel1.tree/lib -l1
-$RUN_HOST $CCLINK -o unprel1.tree/bin/bin1 $srcdir/unprel1.c \
+$CCLINK -o unprel1.tree/bin/bin1 $srcdir/unprel1.c \
-Wl,-rpath,unprel1.tree/lib -L unprel1.tree/lib -l2
cat > unprel1.tree/etc/prelink.conf <<EOF
unprel1.tree/bin
@@ -32,7 +32,7 @@ BINS="unprel1.tree/bin/bin1"
savelibs
chmod -x unprel1.tree/bin/bin1.orig
echo $PRELINK ${PRELINK_OPTS--vm} unprel1.tree/{bin,lib} > unprel1.log
-$RUN_HOST $PRELINK ${PRELINK_OPTS--vm} unprel1.tree/{bin,lib} >> unprel1.log 2>&1 || exit 1
+$PRELINK ${PRELINK_OPTS--vm} unprel1.tree/{bin,lib} >> unprel1.log 2>&1 || exit 1
grep -v 'opt/lib1.so is not present in any config file directories' unprel1.log \
| grep -v 'lib/lib2.so because its dependency unprel1.tree/opt/lib1.so could not be prelinked' \
| grep -v 'bin/bin1 because its dependency unprel1.tree/lib/lib2.so could not be prelinked' \