This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix tst-array{2,5} with --as-needed
On Tue, Jan 22, 2013 at 01:47:19PM +1000, Allan McRae wrote:
> >> * elf/Makefile (LDFLAGS-tst-array2): Add $(no-as-needed).
> >> (LDFLAGS-tst-array5): Likewise.
>
> This issue is essentially the same as [1] - although that disappeared
> when some functions were moved from librt.
Is it actually the same issue, really? The way tst-array* is written,
as-needed would seem entirely in its rights to exclude the arrayNdep
libraries as they don't actually contain any symbols we don't already
have.
This isn't complaining about undefined references (as your example),
it's really just failing to link extraneously, thus affecting the
runtime of the rather cleverly-written test (and excluding whatever
output would have been generated by the dep.so).
Avoiding extraneous linking is exactly what --as-needed is meant to
do, it's absolutely working as advertised, but the test is written
to assume that won't happen. And before someone suggests redesigning
the test, I'll short that with "why bother, it does exactly what the
author intended, as long as you don't let your linker override his
clever with its own".
... Adam