public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Chris McCraw <fool@cs.utexas.edu>
To: binutils@sources.redhat.com
Subject: Re: ld's RPATH versus gcc's
Date: Thu, 20 Jan 2005 21:43:00 -0000	[thread overview]
Message-ID: <20050120214343.GP5239@fidleyhutch.cs.utexas.edu> (raw)
In-Reply-To: <m3r7kgygjj.fsf@gossamer.airs.com>

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;


  reply	other threads:[~2005-01-20 21:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-20  0:10 Chris McCraw
2005-01-20  2:35 ` Ian Lance Taylor
2005-01-20 21:43   ` Chris McCraw [this message]
2005-01-20 23:47     ` Andreas Schwab
2005-01-20 23:54       ` Chris McCraw
2005-01-21  0:47         ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050120214343.GP5239@fidleyhutch.cs.utexas.edu \
    --to=fool@cs.utexas.edu \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).