2009-11-27 12:33:30 +01:00
|
|
|
Index: ld/emultempl/elf32.em
|
|
|
|
===================================================================
|
2012-09-14 14:12:28 +02:00
|
|
|
--- ld/emultempl/elf32.em.orig 2012-07-13 15:20:27.000000000 +0200
|
|
|
|
+++ ld/emultempl/elf32.em 2012-09-14 13:55:57.829177770 +0200
|
|
|
|
@@ -1436,8 +1436,38 @@ if test x"$LDEMUL_BEFORE_ALLOCATION" !=
|
2007-10-09 04:28:58 +02:00
|
|
|
else
|
|
|
|
ELF_INTERPRETER_SET_DEFAULT=
|
|
|
|
fi
|
|
|
|
+
|
|
|
|
+ libpath_nl=
|
|
|
|
+ for path in $NATIVE_LIB_DIRS; do
|
|
|
|
+ libpath_nl="$libpath_nl\n$path"
|
|
|
|
+ done
|
|
|
|
fragment <<EOF
|
|
|
|
|
|
|
|
+static int
|
|
|
|
+gld${EMULATION_NAME}_is_contained (const char *path, const char *dc)
|
|
|
|
+{
|
2011-01-10 17:53:49 +01:00
|
|
|
+ while (*dc)
|
2007-10-09 04:28:58 +02:00
|
|
|
+ {
|
|
|
|
+ const char *pc = path;
|
|
|
|
+
|
|
|
|
+ while (*dc && *pc && *dc == *pc && *dc != '\n'
|
2011-01-10 17:53:49 +01:00
|
|
|
+ && *pc != ':' && *dc != '=')
|
|
|
|
+ {
|
|
|
|
+ dc++;
|
|
|
|
+ pc++;
|
|
|
|
+ }
|
2007-10-09 04:28:58 +02:00
|
|
|
+ if ((*pc == 0 || *pc == ':') && (*dc == '\n' || *dc == '=' || *dc == 0))
|
2011-01-10 17:53:49 +01:00
|
|
|
+ return 1;
|
2007-10-09 04:28:58 +02:00
|
|
|
+
|
|
|
|
+ while (*dc && *dc != '\n')
|
2011-01-10 17:53:49 +01:00
|
|
|
+ dc++;
|
2007-10-09 04:28:58 +02:00
|
|
|
+ if (*dc == '\n')
|
2011-01-10 17:53:49 +01:00
|
|
|
+ dc++;
|
2007-10-09 04:28:58 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
2011-01-10 17:53:49 +01:00
|
|
|
/* used by before_allocation and handle_option. */
|
|
|
|
static void
|
|
|
|
gld${EMULATION_NAME}_append_to_separated_string (char **to, char *op_arg)
|
2012-09-14 14:12:28 +02:00
|
|
|
@@ -1484,7 +1514,7 @@ gld${EMULATION_NAME}_append_to_separated
|
2007-10-09 04:28:58 +02:00
|
|
|
static void
|
|
|
|
gld${EMULATION_NAME}_before_allocation (void)
|
|
|
|
{
|
|
|
|
- const char *rpath;
|
|
|
|
+ char *rpath;
|
|
|
|
asection *sinterp;
|
2011-01-10 17:53:49 +01:00
|
|
|
bfd *abfd;
|
2007-10-09 04:28:58 +02:00
|
|
|
|
2012-09-14 14:12:28 +02:00
|
|
|
@@ -1500,7 +1530,65 @@ gld${EMULATION_NAME}_before_allocation (
|
2007-10-09 04:28:58 +02:00
|
|
|
by dynamic linking. */
|
|
|
|
rpath = command_line.rpath;
|
|
|
|
if (rpath == NULL)
|
|
|
|
- rpath = (const char *) getenv ("LD_RUN_PATH");
|
|
|
|
+ rpath = getenv ("LD_RUN_PATH");
|
|
|
|
+
|
2011-01-10 17:53:49 +01:00
|
|
|
+ if (rpath != NULL && getenv ("SUSE_IGNORED_RPATHS"))
|
2007-10-09 04:28:58 +02:00
|
|
|
+ {
|
|
|
|
+ char *dirs = 0;
|
|
|
|
+ FILE *ldso = fopen (getenv ("SUSE_IGNORED_RPATHS"), "r");
|
2011-01-10 17:53:49 +01:00
|
|
|
+ if (ldso)
|
|
|
|
+ {
|
|
|
|
+ off_t endcur = 0;
|
|
|
|
+ fseek (ldso, 0, SEEK_END);
|
|
|
|
+ endcur = ftell (ldso);
|
|
|
|
+ fseek (ldso, 0, SEEK_SET);
|
|
|
|
+ dirs = xmalloc (endcur);
|
|
|
|
+ if (fread (dirs, 1, endcur, ldso) != (size_t) endcur)
|
|
|
|
+ {
|
|
|
|
+ free (dirs);
|
|
|
|
+ dirs = NULL;
|
|
|
|
+ }
|
|
|
|
+ }
|
2007-10-09 04:28:58 +02:00
|
|
|
+ if (dirs)
|
2011-01-10 17:53:49 +01:00
|
|
|
+ {
|
|
|
|
+ char *cr;
|
|
|
|
+ rpath = xstrdup (rpath);
|
|
|
|
+ cr = rpath; /* cursor read */
|
2007-10-09 04:28:58 +02:00
|
|
|
+
|
2011-01-10 17:53:49 +01:00
|
|
|
+ while (*cr)
|
2007-10-09 04:28:58 +02:00
|
|
|
+ {
|
2011-01-10 17:53:49 +01:00
|
|
|
+ if (gld${EMULATION_NAME}_is_contained (cr, dirs)
|
|
|
|
+ || gld${EMULATION_NAME}_is_contained (cr, "$libpath_nl"))
|
|
|
|
+ {
|
|
|
|
+ char *cc = cr, *cw = cr;
|
|
|
|
+ while (*cc && *cc != ':')
|
|
|
|
+ cc++;
|
|
|
|
+ if (*cc == ':')
|
2007-10-09 04:28:58 +02:00
|
|
|
+ {
|
2011-01-10 17:53:49 +01:00
|
|
|
+ cc++;
|
|
|
|
+ for (; *cc; cc++, cw++)
|
|
|
|
+ *cw = *cc;
|
2007-10-09 04:28:58 +02:00
|
|
|
+ }
|
|
|
|
+ else if (cw > rpath)
|
|
|
|
+ cw[-1] = 0;
|
|
|
|
+
|
2011-01-10 17:53:49 +01:00
|
|
|
+ *cw = 0;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ while (*cr && *cr != ':')
|
|
|
|
+ cr++;
|
|
|
|
+ if (*cr == ':')
|
|
|
|
+ cr++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (*rpath == '\0')
|
|
|
|
+ {
|
|
|
|
+ free (rpath);
|
|
|
|
+ rpath = NULL;
|
|
|
|
+ }
|
|
|
|
+ }
|
2007-10-09 04:28:58 +02:00
|
|
|
+ }
|
2011-01-10 17:53:49 +01:00
|
|
|
|
|
|
|
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
|
|
|
|
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
|
2012-09-14 14:12:28 +02:00
|
|
|
|