[PATCH 4/4] Update tests for protected data and function symbols

Florian Weimer fweimer@redhat.com
Mon Jun 21 12:57:34 GMT 2021


* H. J. Lu:

> On Mon, Jun 21, 2021 at 12:19 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * H. J. Lu via Libc-alpha:
>>
>> > Protected data and function symbols don't work well without
>> > -fsingle-global-definition:
>> >
>> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37611
>> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44166
>> >
>> > 1. Compile tst-protected1[ab].c and tst-protected1mod[ab].c with
>> > -fsingle-global-definition if possible so that GOT entries are used
>> > for undefined data accesses.
>> > 2. Add tests for protected function pointers.
>> > 3. Build tst-prelink.c without single global definition to keepp COPY
>> > relocation.
>>
>> I think these tests need to check that the statically linked bits from
>> GCC have been built with -fsingle-global-definition.  I don't think
>> that's guaranteed even if GCC supports -fsingle-global-definition.
>>
>> I think this shows the limitation of the single bit of markup: the
>> statically linked GCC bits are all hidden, so setting
>> GNU_PROPERTY_1_NEEDED_SINGLE_GLOBAL_DEFINITION so is not correct as a
>> marker to *require* a single global definition, but neither is not
>> setting it because libgcc.a etc. should be *compatible* with
>> GNU_PROPERTY_1_NEEDED_SINGLE_GLOBAL_DEFINITION.
>
> The output bit is ORed from all inputs.   When one input object file doesn't
> work with COPY relocation, the final output object is marked incompatible
> with COPY relocation even if some inputs do work with COPY relocation.

But for the main executable, it has to work the other way round.

Thanks,
Florian



More information about the Libc-alpha mailing list