This is the mail archive of the binutils@sourceware.org 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: PATCH: Support LD_AS_NEEDED


On Thu, May 7, 2009 at 8:19 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, May 07, 2009 at 04:01:17PM +0100, Nick Clifton wrote:
>> >I got a request to support LD_AS_NEEDED. ?OK for trunk?
>>
>> Nope.
>>
>> No patch that adds the passing of command line switches via environment
>> variables is ever going to be accepted.
>>
>> It confuses users when the linker does not behave in way that looking at
>> the linker command line would suggest. ?Plus it makes debugging even
>> more difficult since it can be very difficult to determine exactly what
>> the environment variables contain at the time that the linker is executed.
>
> Yeah, 100% agreed.
> Plus users that want --as-needed to be by default the first
> option can always do
> mkdir -p ~/bin
> echo '#!/bin/sh' > ~/bin/ld
> echo 'exec /usr/bin/ld --as-needed "$@"' >> ~/bin/ld
> chmod 755 ~/bin/ld
> PATH=~/bin:$PATH make
>

Then your

# gcc ....

behaves differently from mine

# gcc ...

I don't see there is a big difference here as far as gcc is
concerned. If we ran into any linker problems, we can always
ask users to provide their LD_XXXs.  Today we have

emultempl/aix.em:  from_outside = getenv (TARGET_ENVIRON);
emultempl/elf32.em:	      lib_path = (const char *) getenv ("LD_RUN_PATH");
emultempl/elf32.em:	  lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
emultempl/elf32.em:    rpath = (const char *) getenv ("LD_RUN_PATH");
emultempl/gld960c.em:  env =  getenv("G960LIB");
emultempl/gld960c.em:  env = getenv("G960BASE");
emultempl/gld960c.em:  char *from_outside = getenv(TARGET_ENVIRON);
emultempl/gld960.em:  env =  getenv("G960LIB");
emultempl/gld960.em:  env = getenv("G960BASE");
emultempl/gld960.em:  char *from_outside = getenv(TARGET_ENVIRON);
emultempl/lnk960.em:  char *name = getenv ("I960BASE");
emultempl/lnk960.em:      name = getenv("G960BASE");
emultempl/lnk960.em:  char *from_outside = getenv (TARGET_ENVIRON);
emultempl/sunos.em:  env = (const char *) getenv ("LD_LIBRARY_PATH");
emultempl/sunos.em:	lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
ldemul.c:  char *from_outside = getenv (TARGET_ENVIRON);
ldmain.c:  demangling = getenv ("COLLECT_NO_DEMANGLE") == NULL;
ldmain.c:  emulation = getenv (EMULATION_ENVIRON);

I don't recall any of those have caused any serious issues for
linker debugging.

-- 
H.J.


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