This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] Fix tst-array{2,5} with --as-needed


On Mon, Jan 21, 2013 at 10:55 PM, Adam Conrad <adconrad@0c3.net> wrote:
> 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".

This is a much better explanation.

I agree, this is not the same case as tst-cond24, whose solution was
to reorder the reference before the definition such that when the linker
got to the definition it would include the DSO (even with as-needed).

In the case of these two tests there are no references between the
application under test and the DSO under test, and I'd like to keep it
that way since it's simpler.

Adding no-as-needed is correct here.

Please check this in on Wednesday if nobody raises any objections.

Cheers,
Carlos.


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