gold: Fix hardcoded library search path
authorJohn Marino <draco@marino.st>
Wed, 20 Jul 2011 22:26:13 +0000 (00:26 +0200)
committerJohn Marino <draco@marino.st>
Wed, 20 Jul 2011 22:26:13 +0000 (00:26 +0200)
Gold was hard-coded to search "/lib" and "/usr/lib" directories at a
minimum.  The "/lib" directory was removed and a prefix was passed
via CFLAGS to use a different default library path for the cross-tool
version.

contrib/binutils-2.21/README.DRAGONFLY
contrib/binutils-2.21/gold/options.cc
gnu/usr.bin/binutils221/libgold/Makefile

index efc071f..0e460ea 100644 (file)
@@ -14,5 +14,6 @@ A list of files and directories removed is in README.DELETED
 Local modifications applied to following files:
        binutils/arlex.1
        bfd/bfdver.h (new)
+       gold/options.cc
        gold/options.h
        ld/ldlex.l
index 6839ba4..3d9115d 100644 (file)
@@ -1105,10 +1105,7 @@ General_options::finalize()
     }
   else if (!this->nostdlib())
     {
-      // Even if they don't specify it, we add -L /lib and -L /usr/lib.
-      // FIXME: We should only do this when configured in native mode.
-      this->add_to_library_path_with_sysroot("/lib");
-      this->add_to_library_path_with_sysroot("/usr/lib");
+      this->add_to_library_path_with_sysroot(USRDATA_PREFIX "/usr/lib");
     }
 
   // Parse the contents of -retain-symbols-file into a set.
index 26372f6..62414af 100644 (file)
@@ -58,6 +58,7 @@ CFLAGS+= -DGOLD_DEFAULT_MACHINE=${GOLD_DEFAULT_MACHINE}
 CFLAGS+= -DGOLD_DEFAULT_SIZE=${GOLD_DEFAULT_SIZE}
 CFLAGS+= -DBINDIR="\"${TOOLS_PREFIX}${BINDIR}\""
 CFLAGS+= -DTOOLBINDIR="\"${TOOLS_PREFIX}${BINDIR}\""
+CFLAGS+= -DUSRDATA_PREFIX="\"${USRDATA_PREFIX}\""
 CFLAGS+= -I. -I${.CURDIR}
 CFLAGS+= -I${SRCDIR}/gold
 CFLAGS+= -I${SRCDIR}/include -I${SRCDIR}/elfcpp