Subject: Re: ld --as-needed broken ?
To: Patrick Welche <>
From: Todd Vierling <>
List: tech-toolchain
Date: 05/06/2005 14:30:56
On Fri, 6 May 2005, Patrick Welche wrote:

> `--as-needed'
> `--no-as-needed'
>      This option affects ELF DT_NEEDED tags for dynamic libraries
>      mentioned on the command line after the `--as-needed' option.
>      Normally, the linker will add a DT_NEEDED tag for each dynamic
>      library mentioned on the command line, regardless of whether the
>      library is actually needed. `--as-needed' causes DT_NEEDED tags to
>      only be emitted for libraries that satisfy some reference from
>      regular objects.  `--no-as-needed' restores the default behaviour.
> So, does that mean that as none of the object files directly reference
> libtermcap, it is dropped from the "needed" list as there isn't a way
> of knowing that libedit depends on libtermcap?

That's exactly why it isn't working.  NetBSD's src/lib (at least as of
netbsd-2) doesn't create ELF interdependencies, though it very likely
should.  There's always the argument about static linking, but third party
apps are caring less and less about static linking anyway....

-- Todd Vierling <> <> <>