From 69091a2cc4cfdd51d5b63c2925ab50ba6aa094cf Mon Sep 17 00:00:00 2001 From: Yufeng Zhang Date: Fri, 19 Jul 2013 16:25:54 +0000 Subject: [PATCH] [AArch64, ILP32] Retire -milp32 and -mlp64; use -mabi=ilp32 and -mabi=lp64. gas/ * config/tc-aarch64.c (enum aarch64_abi_type): New enumeration tag. (AARCH64_ABI_LP64, AARCH64_ABI_ILP32): New enumerators. (aarch64_abi): New variable. (ilp32_p): Change to be a macro. (aarch64_opts): Remove the support for option -milp32 and -mlp64. (struct aarch64_option_abi_value_table): New struct. (aarch64_abis): New table. (aarch64_parse_abi): New function. (aarch64_long_opts): Add entry for -mabi=. * doc/as.texinfo (Target AArch64 options): Document -mabi. * doc/c-aarch64.texi: Likewise. gas/testsuite/ * gas/aarch64/ilp32-basic.d (#as): Update to use -mabi=ilp32 --- gas/ChangeLog | 14 +++++++ gas/config/tc-aarch64.c | 56 ++++++++++++++++++++++--- gas/doc/as.texinfo | 1 + gas/doc/c-aarch64.texi | 6 +++ gas/testsuite/ChangeLog | 4 ++ gas/testsuite/gas/aarch64/ilp32-basic.d | 2 +- 6 files changed, 77 insertions(+), 6 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 04229f9ba8..d906cc6333 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,17 @@ +2013-07-19 Yufeng Zhang + + * config/tc-aarch64.c (enum aarch64_abi_type): New enumeration tag. + (AARCH64_ABI_LP64, AARCH64_ABI_ILP32): New enumerators. + (aarch64_abi): New variable. + (ilp32_p): Change to be a macro. + (aarch64_opts): Remove the support for option -milp32 and -mlp64. + (struct aarch64_option_abi_value_table): New struct. + (aarch64_abis): New table. + (aarch64_parse_abi): New function. + (aarch64_long_opts): Add entry for -mabi=. + * doc/as.texinfo (Target AArch64 options): Document -mabi. + * doc/c-aarch64.texi: Likewise. + 2013-07-18 Jim Thomas * config/tc-i386-intel.c (i386_intel_operand): Fixed signed vs diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 7b21396fb2..14ffdadc13 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -61,11 +61,21 @@ static const aarch64_feature_set aarch64_arch_none = AARCH64_ARCH_NONE; /* Pre-defined "_GLOBAL_OFFSET_TABLE_" */ static symbolS *GOT_symbol; +/* Which ABI to use. */ +enum aarch64_abi_type +{ + AARCH64_ABI_LP64 = 0, + AARCH64_ABI_ILP32 = 1 +}; + +/* AArch64 ABI for the output file. */ +static enum aarch64_abi_type aarch64_abi = AARCH64_ABI_LP64; + /* When non-zero, program to a 32-bit model, in which the C data types int, long and all pointer types are 32-bit objects (ILP32); or to a 64-bit model, in which the C int type is 32-bits but the C long type and all pointer types are 64-bit objects (LP64). */ -static int ilp32_p = 0; +#define ilp32_p (aarch64_abi == AARCH64_ABI_ILP32) #endif enum neon_el_type @@ -7090,10 +7100,6 @@ static struct aarch64_option_table aarch64_opts[] = { {"mbig-endian", N_("assemble for big-endian"), &target_big_endian, 1, NULL}, {"mlittle-endian", N_("assemble for little-endian"), &target_big_endian, 0, NULL}, -#ifdef OBJ_ELF - {"mlp64", N_("select the LP64 model"), &ilp32_p, 0, NULL}, - {"milp32", N_("select the ILP32 model"), &ilp32_p, 1, NULL}, -#endif /* OBJ_ELF */ #ifdef DEBUG_AARCH64 {"mdebug-dump", N_("temporary switch for dumping"), &debug_dump, 1, NULL}, #endif /* DEBUG_AARCH64 */ @@ -7312,7 +7318,47 @@ aarch64_parse_arch (char *str) return 0; } +/* ABIs. */ +struct aarch64_option_abi_value_table +{ + char *name; + enum aarch64_abi_type value; +}; + +static const struct aarch64_option_abi_value_table aarch64_abis[] = { + {"ilp32", AARCH64_ABI_ILP32}, + {"lp64", AARCH64_ABI_LP64}, + {NULL, 0} +}; + +static int +aarch64_parse_abi (char *str) +{ + const struct aarch64_option_abi_value_table *opt; + size_t optlen = strlen (str); + + if (optlen == 0) + { + as_bad (_("missing abi name `%s'"), str); + return 0; + } + + for (opt = aarch64_abis; opt->name != NULL; opt++) + if (strlen (opt->name) == optlen && strncmp (str, opt->name, optlen) == 0) + { + aarch64_abi = opt->value; + return 1; + } + + as_bad (_("unknown abi `%s'\n"), str); + return 0; +} + static struct aarch64_long_option_table aarch64_long_opts[] = { +#ifdef OBJ_ELF + {"mabi=", N_("\t specify for ABI "), + aarch64_parse_abi, NULL}, +#endif /* OBJ_ELF */ {"mcpu=", N_("\t assemble for CPU "), aarch64_parse_cpu, NULL}, {"march=", N_("\t assemble for architecture "), diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index a2771d7b27..de6b5b0213 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -248,6 +248,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. @emph{Target AArch64 options:} [@b{-EB}|@b{-EL}] + [@b{-mabi}=@var{ABI}] @end ifset @ifset ALPHA diff --git a/gas/doc/c-aarch64.texi b/gas/doc/c-aarch64.texi index 3939fee5f0..6019006346 100644 --- a/gas/doc/c-aarch64.texi +++ b/gas/doc/c-aarch64.texi @@ -44,6 +44,12 @@ be marked as being encoded for a big-endian processor. This option specifies that the output generated by the assembler should be marked as being encoded for a little-endian processor. +@cindex @code{-mabi=} command line option, AArch64 +@item -mabi=@var{abi} +Specify which ABI the source code uses. The recognized arguments +are: @code{ilp32} and @code{lp64}, which decides the generated object +file in ELF32 and ELF64 format respectively. The default is @code{lp64}. + @end table @c man end diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 45fe092323..a4240a2685 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-07-19 Yufeng Zhang + + * gas/aarch64/ilp32-basic.d (#as): Update to use -mabi=ilp32 + 2013-07-14 Richard Sandiford * gas/mips/vr5400-ill.s, gas/mips/vr5400-ill.l: Add some more cases. diff --git a/gas/testsuite/gas/aarch64/ilp32-basic.d b/gas/testsuite/gas/aarch64/ilp32-basic.d index b876c7aa43..2e5146a880 100644 --- a/gas/testsuite/gas/aarch64/ilp32-basic.d +++ b/gas/testsuite/gas/aarch64/ilp32-basic.d @@ -1,4 +1,4 @@ -#as: -milp32 +#as: -mabi=ilp32 #objdump: -dr .*: file format elf32-.*aarch64 -- 2.34.1