[PATCH] x32: Set GLRO(dl_platform) to "x86_64" by default [BZ #22363]

H.J. Lu hjl.tools@gmail.com
Mon Oct 30 12:39:00 GMT 2017


On Mon, Oct 30, 2017 at 2:47 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 10/30/2017 08:05 AM, Andreas Schwab wrote:
>>
>> On Okt 29 2017, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>>
>>> Set dl_platform to "x86_64" for x32 by default since kernel may set it
>>> to "i686".
>>
>>
>> Why does it do that?  Isn't that a kernel bug?
>
>
> The whole thing is a bit iffy.  Why does the kernel set AT_PLATFORM to i686
> when running on a x86_64 machine?  x86_64 would make more sense because it

Before x32 has 32-bit address space, it uses

include/asm/elf.h:#define COMPAT_ELF_PLATFORM         ("i686")

It is correct for i386 program, but incorrect for x32 program.

> allows the loader to select libraries which were compiled with
> -march=x86-64.  I think AT_PLATFORM should be about CPU capabilities, not
> the initial CPU mode after process creation.  The latter requires separate
> search paths anyway.
>

The whole AT_PLATFORM was useful before we implemented early CPUID
check in glibc.

-- 
H.J.



More information about the Libc-alpha mailing list