diff options
author | Nick Clifton <nickc@redhat.com> | 2007-03-07 07:52:09 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2007-03-07 07:52:09 +0000 |
commit | 057cac083006e9c5e43e5f5ce7ed18730f499af2 (patch) | |
tree | ce0d0ed5ac25dd71643f2a6110da2e6b48a50b86 /ld/emultempl | |
parent | d64cc92a74c9fd2b320e23824de29b266d117b11 (diff) | |
download | gdb-057cac083006e9c5e43e5f5ce7ed18730f499af2.zip gdb-057cac083006e9c5e43e5f5ce7ed18730f499af2.tar.gz gdb-057cac083006e9c5e43e5f5ce7ed18730f499af2.tar.bz2 |
PR ld/4023
* emultempl/aix.em (..._before_allocation): Strip sysroot prefix
from any paths being inserted into the output binary's DT_RPATH.
Diffstat (limited to 'ld/emultempl')
-rw-r--r-- | ld/emultempl/aix.em | 54 |
1 files changed, 44 insertions, 10 deletions
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em index a85f7d0..1763946 100644 --- a/ld/emultempl/aix.em +++ b/ld/emultempl/aix.em @@ -651,18 +651,52 @@ gld${EMULATION_NAME}_before_allocation (void) size_t len; search_dirs_type *search; - len = strlen (search_head->name); - libpath = xmalloc (len + 1); - strcpy (libpath, search_head->name); - for (search = search_head->next; search != NULL; search = search->next) + /* PR ld/4023: Strip sysroot prefix from any paths + being inserted into the output binary's DT_RPATH. */ + if (ld_sysroot != NULL + && * ld_sysroot != 0) { - size_t nlen; + const char * name = search_head->name; + size_t ld_sysroot_len = strlen (ld_sysroot); - nlen = strlen (search->name); - libpath = xrealloc (libpath, len + nlen + 2); - libpath[len] = ':'; - strcpy (libpath + len + 1, search->name); - len += nlen + 1; + if (strncmp (name, ld_sysroot, ld_sysroot_len) == 0) + name += ld_sysroot_len; + + len = strlen (name); + libpath = xmalloc (len + 1); + strcpy (libpath, name); + + for (search = search_head->next; search != NULL; search = search->next) + { + size_t nlen; + + name = search->name; + if (strncmp (name, ld_sysroot, ld_sysroot_len) == 0) + name += ld_sysroot_len; + + nlen = strlen (name); + libpath = xrealloc (libpath, len + nlen + 2); + libpath[len] = ':'; + strcpy (libpath + len + 1, name); + len += nlen + 1; + } + } + else + { + len = strlen (search_head->name); + libpath = xmalloc (len + 1); + strcpy (libpath, search_head->name); + + for (search = search_head->next; search != NULL; search = search->next) + { + size_t nlen; + + nlen = strlen (search->name); + libpath = xrealloc (libpath, len + nlen + 2); + libpath[len] = ':'; + strcpy (libpath + len + 1, search->name); + len += nlen + 1; + } } } |