[PATCH][AArch64] Use __getauxval instead of getauxval in LSE detection code in libgcc

Kyrylo Tkachov Kyrylo.Tkachov@arm.com
Wed May 6 09:51:35 GMT 2020



> -----Original Message-----
> From: Joseph Myers <joseph@codesourcery.com>
> Sent: 05 May 2020 22:30
> To: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>
> Cc: Szabolcs Nagy <Szabolcs.Nagy@arm.com>; Florian Weimer
> <fweimer@redhat.com>; gcc-patches@gcc.gnu.org
> Subject: RE: [PATCH][AArch64] Use __getauxval instead of getauxval in LSE
> detection code in libgcc
> 
> On Tue, 5 May 2020, Kyrylo Tkachov wrote:
> 
> > This version of the fix uses __getauxval instead of getauxval.
> > The whole thing is guarded simply on __GLIBC__ >= 2.
> > __getauxval was introduced in 2.16 but the aarch64 port was added in 2.17
> so in practice I expect all aarch64 glibcs to support __getauxval.
> 
> Testing __GLIBC__ doesn't work because that's only defined in headers and
> the point of duplicating definitions here is to avoid libgcc and thus libc
> contents depending on whether headers were available when libgcc was
> built.  However, given your point that the AArch64 glibc port postdates
> the addition of __getauxval to glibc, you can test __gnu_linux__ instead,
> as a macro GCC predefines only when configured to use glibc on the target,
> and don't need a version test after all.

Right, thanks for the pointer.
This version of the fix uses __getauxval instead of getauxval.
The whole thing is guarded simply on __gnu_linux__.
__getauxval was introduced in 2.16 but the aarch64 port was added in 2.17 so in practice I expect all aarch64 glibcs to support __getauxval.

Bootstrapped and tested on aarch64-none-linux-gnu.
Also tested on aarch64-none-elf.

Checked that the lse-init.o binary contains the __getauxval call for aarch64-none-linux-gnu and is empty for aarch64-none-elf (a newlib target).
Is this okay for trunk and the GCC 10 branch?

Thanks,
Kyrill

2020-05-06  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* config/aarch64/lse-init.c (init_have_lse_atomics): Use __getauxval
	instead of getauxval.
	(AT_HWCAP): Define.
	(HWCAP_ATOMICS): Define.
	Guard detection on __gnu_linux__.

> 
> --
> Joseph S. Myers
> joseph@codesourcery.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ool-glibc.patch
Type: application/octet-stream
Size: 1198 bytes
Desc: ool-glibc.patch
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200506/a7aae4e9/attachment-0001.obj>


More information about the Gcc-patches mailing list