sync with in-tree binutils:
date: 2002/03/19 02:02:57; author: pvalchev; state: Exp; lines: +27 -5 When one shared library requires another, it will try to locate the required shared library and include it in the link if it's not specified explicitly. This change makes ld look at the -L arguments specified, and build search path. This avoids the need for -rpath-link, and somewhat resembles the a.out linker behaviour. However behaviour of -rpath and -rpath-link is still preserved as a GNU extension.
This commit is contained in:
parent
46554012a9
commit
a818d63366
@ -1,6 +1,6 @@
|
||||
$OpenBSD: patch-ld_emultempl_elf32_em,v 1.1.1.1 2002/02/19 04:19:21 fgsch Exp $
|
||||
--- ld/emultempl/elf32.em.orig Sat Feb 16 19:42:58 2002
|
||||
+++ ld/emultempl/elf32.em Sat Feb 16 20:03:36 2002
|
||||
$OpenBSD: patch-ld_emultempl_elf32_em,v 1.2 2002/04/26 00:44:40 pvalchev Exp $
|
||||
--- ld/emultempl/elf32.em.orig Thu Apr 25 15:41:38 2002
|
||||
+++ ld/emultempl/elf32.em Thu Apr 25 18:28:55 2002
|
||||
@@ -71,6 +71,155 @@ static boolean gld${EMULATION_NAME}_plac
|
||||
static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
|
||||
|
||||
@ -157,7 +157,67 @@ $OpenBSD: patch-ld_emultempl_elf32_em,v 1.1.1.1 2002/02/19 04:19:21 fgsch Exp $
|
||||
|
||||
# Import any needed special functions and/or overrides.
|
||||
#
|
||||
@@ -888,7 +1037,15 @@ gld${EMULATION_NAME}_open_dynamic_archiv
|
||||
@@ -605,7 +754,7 @@ gld${EMULATION_NAME}_after_open ()
|
||||
rpath_link, rpath, then the environment variable
|
||||
LD_LIBRARY_PATH (native only), then the DT_RPATH/DT_RUNPATH
|
||||
entries (native only), then the linker script LIB_SEARCH_DIRS.
|
||||
- We do not search using the -L arguments.
|
||||
+ We look at the -L arguments to build search path.
|
||||
|
||||
We search twice. The first time, we skip objects which may
|
||||
introduce version mismatches. The second time, we force
|
||||
@@ -619,7 +768,7 @@ if [ "x${host}" = "x${target}" ] ; then
|
||||
case " ${EMULATION_LIBPATH} " in
|
||||
*" ${EMULATION_NAME} "*)
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
- const char *lib_path;
|
||||
+ char *lib_path;
|
||||
struct bfd_link_needed_list *rp;
|
||||
int found;
|
||||
EOF
|
||||
@@ -639,15 +788,38 @@ cat >>e${EMULATION_NAME}.c <<EOF
|
||||
if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
|
||||
l->name, force))
|
||||
break;
|
||||
- if (command_line.rpath_link == NULL
|
||||
+ if (getenv("LD_RUN_PATH") != NULL
|
||||
+ && command_line.rpath_link == NULL
|
||||
&& command_line.rpath == NULL)
|
||||
{
|
||||
- lib_path = (const char *) getenv ("LD_RUN_PATH");
|
||||
+ lib_path = getenv ("LD_RUN_PATH");
|
||||
if (gld${EMULATION_NAME}_search_needed (lib_path, l->name,
|
||||
force))
|
||||
break;
|
||||
}
|
||||
- lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
|
||||
+
|
||||
+ len = strlen(search_head->name);
|
||||
+ lib_path = xstrdup(search_head->name);
|
||||
+ for (search = search_head->next; search != NULL;
|
||||
+ search = search->next)
|
||||
+ {
|
||||
+ size_t nlen;
|
||||
+
|
||||
+ nlen = strlen(search->name);
|
||||
+ lib_path = xrealloc(lib_path, len + nlen + 2);
|
||||
+ lib_path[len] = ':';
|
||||
+ strcpy(lib_path + len + 1, search->name);
|
||||
+ len += nlen + 1;
|
||||
+ }
|
||||
+
|
||||
+ if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, force))
|
||||
+ {
|
||||
+ free(lib_path);
|
||||
+ break;
|
||||
+ }
|
||||
+ free(lib_path);
|
||||
+
|
||||
+ lib_path = getenv ("LD_LIBRARY_PATH");
|
||||
if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, force))
|
||||
break;
|
||||
|
||||
@@ -888,7 +1060,15 @@ gld${EMULATION_NAME}_open_dynamic_archiv
|
||||
return false;
|
||||
|
||||
filename = entry->filename;
|
||||
@ -174,7 +234,7 @@ $OpenBSD: patch-ld_emultempl_elf32_em,v 1.1.1.1 2002/02/19 04:19:21 fgsch Exp $
|
||||
/* This allocates a few bytes too many when EXTRA_SHLIB_EXTENSION
|
||||
is defined, but it does not seem worth the headache to optimize
|
||||
away those two bytes of space. */
|
||||
@@ -902,6 +1059,10 @@ gld${EMULATION_NAME}_open_dynamic_archiv
|
||||
@@ -902,6 +1082,10 @@ gld${EMULATION_NAME}_open_dynamic_archiv
|
||||
|
||||
sprintf (string, "%s/lib%s%s.so", search->name, filename, arch);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user