DT_NEEDED entries for libraries not on the command line.

Kurt Roeckx kurt@roeckx.be
Sun Sep 18 19:34:00 GMT 2005


Hi,

I'm trying to understand why a library can up in the DT_NEEDED
list while it was it was not on the command line, but it
is (indirectly) in the DT_NEEDED of a lib I'm linking too.

I've been reading the source, and saw the following comment:
              /* A symbol from a library loaded via DT_NEEDED of some
                 other library is referenced by a regular object.
                 Add a DT_NEEDED entry for it.  */
Or:
      /* If this dynamic lib was specified on the command line with
         --as-needed in effect, then we don't want to add a DT_NEEDED
         tag unless the lib is actually used.  Similary for libs brought
         in by another lib's DT_NEEDED.  */

So I'm guessing this is expected behaviour.  This does not
seem to be happening in all cases, so I have to wonder
why it is happening.

Under what conditions does it add a DT_NEEDED from the
DT_NEEDED of an other lib?  Would things break if it
didn't do that?  Maybe a short example can help me
understand this?


PS: Please CC me, I'm not on the list.


Kurt



More information about the Binutils mailing list