NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/47922 (build fail/risk building 6.1.x on 6.99.x>19 (ld picks wrong lib))
The following reply was made to PR bin/47922; it has been noted by GNATS.
From: Joerg Sonnenberger <joerg%britannica.bec.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/47922 (build fail/risk building 6.1.x on 6.99.x>19 (ld picks
wrong lib))
Date: Tue, 25 Jun 2013 00:03:36 +0200
--Dxnq1zWXvFF0Q93v
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Newer version of the patch.
--Dxnq1zWXvFF0Q93v
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="elf32.em.diff"
Index: binutils/dist/ld/emultempl/elf32.em
===================================================================
RCS file:
/home/joerg/repo/netbsd/src/external/gpl3/binutils/dist/ld/emultempl/elf32.em,v
retrieving revision 1.5
diff -u -p -r1.5 elf32.em
--- binutils/dist/ld/emultempl/elf32.em 7 Aug 2012 01:09:13 -0000
1.5
+++ binutils/dist/ld/emultempl/elf32.em 24 Jun 2013 22:02:07 -0000
@@ -452,15 +452,25 @@ fragment <<EOF
static bfd_boolean
gld${EMULATION_NAME}_search_needed (const char *path,
- struct dt_needed *n, int force)
+ struct dt_needed *n, int force, int
prepend_sysroot)
{
const char *s;
const char *name = n->name;
size_t len;
struct dt_needed needed;
- if (name[0] == '/')
+ if (name[0] == '/') {
+ if (prepend_sysroot && ld_sysroot) {
+ bfd_boolean rv;
+ needed.by = n->by;
+ char *filename= concat(ld_sysroot, n->name, (const char *)NULL);
+ needed.name = filename;
+ rv = gld${EMULATION_NAME}_try_needed (&needed, force);
+ free(filename);
+ return rv;
+ }
return gld${EMULATION_NAME}_try_needed (n, force);
+ }
if (path == NULL || *path == '\0')
return FALSE;
@@ -499,6 +509,13 @@ gld${EMULATION_NAME}_search_needed (cons
}
strcpy (sset, name);
+ if (prepend_sysroot && filename[0] == '=')
+ abort();
+ if (filename[0] == '/' && prepend_sysroot && ld_sysroot) {
+ char *filename2 = concat(ld_sysroot, filename, (const char *)NULL);
+ free(filename);
+ filename = filename2;
+ }
needed.name = filename;
if (gld${EMULATION_NAME}_try_needed (&needed, force))
return TRUE;
@@ -613,7 +630,7 @@ gld${EMULATION_NAME}_check_ld_elf_hints
needed.by = NULL;
needed.name = name;
return gld${EMULATION_NAME}_search_needed (ld_elf_hints, & needed,
- force);
+ force, 0);
}
EOF
# FreeBSD
@@ -824,7 +841,7 @@ gld${EMULATION_NAME}_check_ld_so_conf (c
needed.by = NULL;
needed.name = name;
- return gld${EMULATION_NAME}_search_needed (ld_so_conf, &needed, force);
+ return gld${EMULATION_NAME}_search_needed (ld_so_conf, &needed, force, 0);
}
EOF
@@ -1256,13 +1273,13 @@ fi
fragment <<EOF
if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link,
- &n, force))
+ &n, force, 0))
break;
EOF
if [ "x${USE_LIBPATH}" = xyes ] ; then
fragment <<EOF
if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
- &n, force))
+ &n, force, 1))
break;
EOF
fi
@@ -1273,11 +1290,11 @@ fragment <<EOF
{
lib_path = (const char *) getenv ("LD_RUN_PATH");
if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
- force))
+ force, 0))
break;
}
lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
- if (gld${EMULATION_NAME}_search_needed (lib_path, &n, force))
+ if (gld${EMULATION_NAME}_search_needed (lib_path, &n, force, 0))
break;
EOF
fi
@@ -1287,12 +1304,10 @@ fragment <<EOF
rp = bfd_elf_get_runpath_list (link_info.output_bfd, &link_info);
for (; !found && rp != NULL; rp = rp->next)
{
- char *tmpname = gld${EMULATION_NAME}_add_sysroot (rp->name);
found = (rp->by == l->by
- && gld${EMULATION_NAME}_search_needed (tmpname,
+ && gld${EMULATION_NAME}_search_needed (rp->name,
&n,
- force));
- free (tmpname);
+ force, 1));
}
if (found)
break;
--Dxnq1zWXvFF0Q93v--
Home |
Main Index |
Thread Index |
Old Index