[21/29,AARCH64] Add ILP32 to makefiles
diff mbox

Message ID 1414396793-9005-22-git-send-email-apinski@cavium.com
State New
Headers show

Commit Message

Andrew Pinski Oct. 27, 2014, 7:59 a.m. UTC
This patch adds ilp32 and ilp32_be as abi variants to the aarch64 linux
makefile.

* sysdeps/unix/sysv/linux/aarch64/Makefile (abi-variants): Add ilp32
and ilp32_be.
(abi-lp64-options): Add defining of LP64 and undef of ILP32 macros.
(abi-lp64-condition): Check word size macro also.
(abi-lp64_be-options): Add defining of LP64 and undef of ILP32 macros.
(abi-lp64_be-condition): Check word size macro also.
(abi-ilp32-options): Define.
(abi-ilp32-condition): Likewise.
(abi-ilp32_be-options): Define.
(abi-ilp32_be-condition): Likewise.
---
 sysdeps/unix/sysv/linux/aarch64/Makefile |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

Comments

Mike Frysinger Oct. 28, 2014, 8:14 p.m. UTC | #1
On 27 Oct 2014 00:59, Andrew Pinski wrote:
> -abi-lp64-options := -U__AARCH64EB__
> -abi-lp64-condition := !defined __AARCH64EB__
> +abi-lp64-options := -U__AARCH64EB__ -D__LP64__ -U__ILP32__
> +abi-lp64-condition := __WORDSIZE == 64 && !defined __AARCH64EB__
>  
> -abi-lp64_be-options := -D__AARCH64EB__
> -abi-lp64_be-condition := defined __AARCH64EB__
> +abi-lp64_be-options := -D__AARCH64EB__ -D__LP64__ -U__ILP32__
> +abi-lp64_be-condition := __WORDSIZE == 64 && defined __AARCH64EB__
> +
> +abi-ilp32-options := -U__AARCH64EB__ -U__LP64__ -D__ILP32__
> +abi-ilp32-condition := __WORDSIZE == 32 && !defined __AARCH64EB__
> +
> +abi-ilp32_be-options := -D__AARCH64EB__ -U__LP64__ -D__ILP32__
> +abi-ilp32_be-condition := __WORDSIZE == 32 && defined __AARCH64EB__

why all this CPP magic ?  shouldn't the compiler be producing the right objects 
in the first place with all the right defines ?
-mike
Joseph Myers Oct. 28, 2014, 10:46 p.m. UTC | #2
On Tue, 28 Oct 2014, Mike Frysinger wrote:

> On 27 Oct 2014 00:59, Andrew Pinski wrote:
> > -abi-lp64-options := -U__AARCH64EB__
> > -abi-lp64-condition := !defined __AARCH64EB__
> > +abi-lp64-options := -U__AARCH64EB__ -D__LP64__ -U__ILP32__
> > +abi-lp64-condition := __WORDSIZE == 64 && !defined __AARCH64EB__
> >  
> > -abi-lp64_be-options := -D__AARCH64EB__
> > -abi-lp64_be-condition := defined __AARCH64EB__
> > +abi-lp64_be-options := -D__AARCH64EB__ -D__LP64__ -U__ILP32__
> > +abi-lp64_be-condition := __WORDSIZE == 64 && defined __AARCH64EB__
> > +
> > +abi-ilp32-options := -U__AARCH64EB__ -U__LP64__ -D__ILP32__
> > +abi-ilp32-condition := __WORDSIZE == 32 && !defined __AARCH64EB__
> > +
> > +abi-ilp32_be-options := -D__AARCH64EB__ -U__LP64__ -D__ILP32__
> > +abi-ilp32_be-condition := __WORDSIZE == 32 && defined __AARCH64EB__
> 
> why all this CPP magic ?  shouldn't the compiler be producing the right objects 
> in the first place with all the right defines ?

abi-$(variant)-options is used to generate bits/syscall.h, with a single 
glibc install generating a version of bits/syscall.h suitable for all 
ABIs.  This means that a compiler with options set up to generate code for 
one ABI needs to be forced to define macros that make asm/unistd.h define 
the syscall macros for another ABI.

If we moved bits/syscall.h to the same approach as gnu/stubs.h and 
gnu/lib-names.h (a glibc build only generates a full header for its own 
ABI, and a wrapper that selects such a header depending on the ABI in 
use), it should no longer be necessary to have abi-$(variant)-options 
variables at all.

Patch
diff mbox

diff --git a/sysdeps/unix/sysv/linux/aarch64/Makefile b/sysdeps/unix/sysv/linux/aarch64/Makefile
index f2f28ee..dfb5cce 100644
--- a/sysdeps/unix/sysv/linux/aarch64/Makefile
+++ b/sysdeps/unix/sysv/linux/aarch64/Makefile
@@ -25,13 +25,21 @@  endif
 
 abi-variants := lp64
 abi-variants += lp64_be
+abi-variants += ilp32
+abi-variants += ilp32_be
 
 ifeq (,$(filter $(default-abi),$(abi-variants)))
 Unknown ABI, must be one of $(abi-variants)
 endif
 
-abi-lp64-options := -U__AARCH64EB__
-abi-lp64-condition := !defined __AARCH64EB__
+abi-lp64-options := -U__AARCH64EB__ -D__LP64__ -U__ILP32__
+abi-lp64-condition := __WORDSIZE == 64 && !defined __AARCH64EB__
 
-abi-lp64_be-options := -D__AARCH64EB__
-abi-lp64_be-condition := defined __AARCH64EB__
+abi-lp64_be-options := -D__AARCH64EB__ -D__LP64__ -U__ILP32__
+abi-lp64_be-condition := __WORDSIZE == 64 && defined __AARCH64EB__
+
+abi-ilp32-options := -U__AARCH64EB__ -U__LP64__ -D__ILP32__
+abi-ilp32-condition := __WORDSIZE == 32 && !defined __AARCH64EB__
+
+abi-ilp32_be-options := -D__AARCH64EB__ -U__LP64__ -D__ILP32__
+abi-ilp32_be-condition := __WORDSIZE == 32 && defined __AARCH64EB__