[PATCH] S390: Support PLT and GOT references in check-localplt.
Florian Weimer
fweimer@redhat.com
Fri Aug 26 11:50:00 GMT 2016
On 08/23/2016 01:28 PM, Stefan Liebler wrote:
> On 08/18/2016 12:42 PM, Stefan Liebler wrote:
>> On 08/17/2016 03:48 PM, Florian Weimer wrote:
>>> On 08/09/2016 04:22 PM, Stefan Liebler wrote:
>>>> On 08/09/2016 03:53 PM, Florian Weimer wrote:
>>>>> On 08/09/2016 03:34 PM, Stefan Liebler wrote:
>>>>>> After the commits __libc_memalign is only called in
>>>>>> elf/dl-minimal.c in
>>>>>> malloc() function in ld.so and gcc -O2/-O3 leads to R_390_GLOB_DAT
>>>>>> instead of R_390_JMP_SLOT. __libc_memalign is called via
>>>>>> function-pointer loaded from GOT instead of calling via a plt-stub.
>>>>>
>>>>> Huh. I wonder if this is intended. Surely the malloc
>>>>> implementation in
>>>>> elf/dl-minimal.c should always call the __libc_memalign implementation
>>>>> in the same file?
>>>>>
>>>>> Thanks,
>>>>> Florian
>>>>>
>>>>
>>>> Please have a look at the other localplt.data files, e.g.
>>>> sysdeps/x86_64/localplt.data:
>>>> # The dynamic loader uses __libc_memalign internally to allocate
>>>> aligned
>>>> # TLS storage. The other malloc family of functions are expected to
>>>> allow
>>>> # user symbol interposition.
>>>> ld.so: __libc_memalign + RELA R_X86_64_GLOB_DAT
>>>>
>>>> All contains the __libc_memalign relocation.
>>>> On s390x it has also existed before but a plt-stub was used. If you now
>>>> use the compiler flag -fno-optimize-sibling-calls you'll get the
>>>> plt-stub as before. With this optimization the relocation is done via a
>>>> function pointer.
>>>
>>> Okay, but shouldn't be __libc_memalign in dl-minimal.c declared as
>>> attribute_hidden?
>>>
>>> Thanks,
>>> Florian
>>>
>> I don't know. Can you simply do this as __libc_memalign is also
>> mentioned in elf/Versions file?
>> ld {
>> GLIBC_2.0 {
>> # Function from libc.so which must be shared with libc.
>> __libc_memalign; calloc; free; malloc; realloc;
>>
>> _r_debug;
>> }
>>
>
> Is there any news about __libc_memalign?
> Otherwise I'd like to commit this patch.
> I think if you change something about __libc_memalign you have to touch
> the other architectures as well.
Sorry, I don't feel qualified to comment on this.
What has changes is that we no longer reference __libc_memalign, in
order to simplify the interposition of a custom malloc.
I find all this rather puzzling because we really do not want to
interpose the dl-minimal.c malloc for the whole process, and yet the
elf/Versions file lists it â¦
Florian
More information about the Libc-alpha
mailing list