This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ld's RPATH versus gcc's


On Wed, Jan 19, 2005 at 09:34:40PM -0500, Ian Lance Taylor wrote:
 
> I don't know what is happening, but I do know that the linker's
> handling of RPATH is quite simple.  The RPATH in the executable will
> be to the directories specified using the -R or --rpath option.  If no
> -R or --rpath is used, then the RPATH will be set to the value of the
> environment variable LD_RUN_PATH.  If that is not, then the RPATH will
> not be set.
> 
> So you should check the LD_RUN_PATH environment variable, and you
> should check precisely how gcc is invoking the linker.  To see the
> latter, pass -v on the link line, e.g., by putting it in LDFLAGS.

the root of my main problem turned out to be in libtool ignoring $CFLAGS
during linking of shared libraries.  thanks for the encouragement to keep
getting more verbosity out of ld, though it leads me here:

i think there is a third vector for RPATH entries--adding "-v -Wl,--verbose"
to the LDFLAGS shows the following output.  note particularly the line
with SEARCH_DIR.
those directories are mentioned nowhere in any specs file or options
passed via gcc or collect2--they are apparently internal to ld.  i am
only guessing here, since we have no directory
"/lusr/gnu/sparc-sun-solaris2.7/lib" but there was one around when this
LD was built.


---begin included---
gcc -v -specs /u/fool/specs -v -Wl,--verbose -o .libs/esdcat esdcat.o  ./.libs/libesd.so -L/lusr/opt/kde-3.3.2/lib /lusr/opt/kde-3.3.2/lib/libaudiofile.so -lm -lrt -lresolv -lsocket -Wl,--rpath -Wl,/lusr/opt/kde-3.3.2/lib                   Reading specs from /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/specs
Reading specs from /u/fool/specs
rename spec link to old_link
Configured with: /u/fool/Work/build/gcc-3.4.3/configure --prefix=/lusr/opt/gcc-3.4.3 --with-gnu-as --with-as=/lusr/gnu/bin/as --with-gnu-ld --with-ld=/lusr/gnu/bin/ld --enable-languages=c,c++,f77,objc,java,ada : (reconfigured) /u/fool/Work/build/gcc-3.4.3/configure --prefix=/lusr/opt/gcc-3.4.3 --with-gnu-as --with-as=/lusr/gnu/bin/as --with-gnu-ld --with-ld=/lusr/gnu/bin/ld --enable-languages=c,c++,f77,objc,java,ada                                                             Thread model: posix
gcc version 3.4.3
 /lusr/opt/gcc-3.4.3/libexec/gcc/sparc-sun-solaris2.9/3.4.3/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -rpath-link /usr/lib -Qy -R/lusr/kde3/lib -R/lusr/opt/gcc-3.4.3/lib -R/lusr/BerkeleyDB.4.2/lib -R/lusr/ssl/lib -R/lusr/netpbm/lib -L/lusr/kde3/lib -L/lusr/opt/gcc-3.4.3/lib -L/lusr/BerkeleyDB.4.2/lib -L/lusr/ssl/lib -L/lusr/netpbm/lib -L/lusr/ssl/lib -o .libs/esdcat /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/crt1.o /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/crti.o /usr/ccs/lib/values-Xa.o /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/crtbegin.o -L/lusr/opt/kde-3.3.2/lib -L/lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3 -L/usr/ccs/bin -L/usr/ccs/lib -L/lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/../../.. --verbose esdcat.o ./.libs/libesd.so /lusr/opt/kde-3.3.2/lib/libaudiofile.so -lm -lrt -lresolv -lsocket --rpath /lusr/opt/kde-3.3.2/lib -lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/crtend.o /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/crtn.o                                                             GNU ld version 2.13.2.1
  Supported emulations:
   elf32_sparc
   elf64_sparc
GNU ld version 2.13.2.1
  Supported emulations:
   elf32_sparc
   elf64_sparc
using internal linker script:
==================================================
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf32-sparc", "elf32-sparc",
          "elf32-sparc")
OUTPUT_ARCH(sparc)
ENTRY(_start)
SEARCH_DIR("/lusr/gnu/sparc-sun-solaris2.7/lib"); SEARCH_DIR("/lusr/gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/usr/ccs/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");

---end included---

SEARCH_DIR("/lusr/gnu/sparc-sun-solaris2.7/lib"); SEARCH_DIR("/lusr/gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/usr/ccs/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");




gcc -v -specs /u/fool/specs -v -Wl,--verbose -o .libs/esdcat esdcat.o  ./.libs/libesd.so -L/lusr/opt/kde-3.3.2/lib /lusr/opt/kde-3.3.2/lib/libaudiofile.so -lm -lrt -lresolv -lsocket -Wl,--rpath -Wl,/lusr/opt/kde-3.3.2/lib
Reading specs from /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/specs
Reading specs from /u/fool/specs
rename spec link to old_link
Configured with: /u/fool/Work/build/gcc-3.4.3/configure --prefix=/lusr/opt/gcc-3.4.3 --with-gnu-as --with-as=/lusr/gnu/bin/as --with-gnu-ld --with-ld=/lusr/gnu/bin/ld --enable-languages=c,c++,f77,objc,java,ada : (reconfigured) /u/fool/Work/build/gcc-3.4.3/configure --prefix=/lusr/opt/gcc-3.4.3 --with-gnu-as --with-as=/lusr/gnu/bin/as --with-gnu-ld --with-ld=/lusr/gnu/bin/ld --enable-languages=c,c++,f77,objc,java,ada
Thread model: posix
gcc version 3.4.3
 /lusr/opt/gcc-3.4.3/libexec/gcc/sparc-sun-solaris2.9/3.4.3/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -rpath-link /usr/lib -Qy -R/lusr/kde3/lib -R/lusr/opt/gcc-3.4.3/lib -R/lusr/BerkeleyDB.4.2/lib -R/lusr/ssl/lib -R/lusr/netpbm/lib -L/lusr/kde3/lib -L/lusr/opt/gcc-3.4.3/lib -L/lusr/BerkeleyDB.4.2/lib -L/lusr/ssl/lib -L/lusr/netpbm/lib -L/lusr/ssl/lib -o .libs/esdcat /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/crt1.o /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/crti.o /usr/ccs/lib/values-Xa.o /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/crtbegin.o -L/lusr/opt/kde-3.3.2/lib -L/lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3 -L/usr/ccs/bin -L/usr/ccs/lib -L/lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/../../.. --verbose esdcat.o ./.libs/libesd.so /lusr/opt/kde-3.3.2/lib/libaudiofile.so -lm -lrt -lresolv -lsocket --rpath /lusr/opt/kde-3.3.2/lib -lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/crtend.o /lusr/opt/gcc-3.4.3/lib/gcc/sparc-sun-solaris2.9/3.4.3/crtn.o
GNU ld version 2.13.2.1
  Supported emulations:
   elf32_sparc
   elf64_sparc
GNU ld version 2.13.2.1
  Supported emulations:
   elf32_sparc
   elf64_sparc
using internal linker script:
==================================================
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf32-sparc", "elf32-sparc",
          "elf32-sparc")
OUTPUT_ARCH(sparc)
ENTRY(_start)
SEARCH_DIR("/lusr/gnu/sparc-sun-solaris2.7/lib"); SEARCH_DIR("/lusr/gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/usr/ccs/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
/* Do we need any of these for elf?
   __DYNAMIC = 0;    */
SECTIONS
{
  /* Read-only sections, merged into text segment: */
  . = 0x10000 + SIZEOF_HEADERS;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]