aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@arm.com>2017-05-22 09:50:19 +0100
committerJiong Wang <jiong.wang@arm.com>2017-05-22 13:27:11 +0100
commit3c0367d0e2df21717b7345a1ccadef39183457ab (patch)
treefccfbda79fe69e3ede043e5d11a426ccd0fd7d69 /gas/config
parente11b3cdc565c5e86e43ef79d25fc5e8b88162ec1 (diff)
downloadgdb-3c0367d0e2df21717b7345a1ccadef39183457ab.zip
gdb-3c0367d0e2df21717b7345a1ccadef39183457ab.tar.gz
gdb-3c0367d0e2df21717b7345a1ccadef39183457ab.tar.bz2
[AArch64, gas] Support ILP32 triplet aarch64*-linux-gnu_ilp32
This patch allows AArch64 GAS defaulting to ILP32 if it is configured with aarch64*-linux-gnu_ilp32. "md_after_parse_args" is implemented to update ABI into ILP32 if DEFAULT_ARCH is "aarch64:32". gas/ * configure.tgt: Set "arch" to "aarch64" if ${cpu} equals "aarch64". Recognize the new triplet name aarch64*-linux-gnu_ilp32. * configure.ac: Output DEFAULT_ARCH macro for AArch64. * configure: Regenerate. * config/tc-aarch64.h (aarch64_after_parse_args): New declaration. (md_after_parse_args): New define. * config/tc-aarch64.c (aarch64_abi_type): New enumeration AARCH64_ABI_NONE. (DEFAULT_ARCH): New define. (aarch64_abi): Set default value to AARCH64_ABI_NONE. (aarch64_after_parse_args): New function.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-aarch64.c30
-rw-r--r--gas/config/tc-aarch64.h3
2 files changed, 30 insertions, 3 deletions
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 72b98fd..cdb2903 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -62,12 +62,20 @@ static symbolS *GOT_symbol;
/* Which ABI to use. */
enum aarch64_abi_type
{
- AARCH64_ABI_LP64 = 0,
- AARCH64_ABI_ILP32 = 1
+ AARCH64_ABI_NONE = 0,
+ AARCH64_ABI_LP64 = 1,
+ AARCH64_ABI_ILP32 = 2
};
+#ifndef DEFAULT_ARCH
+#define DEFAULT_ARCH "aarch64"
+#endif
+
+/* DEFAULT_ARCH is initialized in gas/configure.tgt. */
+static const char *default_arch = DEFAULT_ARCH;
+
/* AArch64 ABI for the output file. */
-static enum aarch64_abi_type aarch64_abi = AARCH64_ABI_LP64;
+static enum aarch64_abi_type aarch64_abi = AARCH64_ABI_NONE;
/* 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
@@ -7975,6 +7983,22 @@ aarch64_force_relocation (struct fix *fixp)
#ifdef OBJ_ELF
+/* Implement md_after_parse_args. This is the earliest time we need to decide
+ ABI. If no -mabi specified, the ABI will be decided by target triplet. */
+
+void
+aarch64_after_parse_args (void)
+{
+ if (aarch64_abi != AARCH64_ABI_NONE)
+ return;
+
+ /* DEFAULT_ARCH will have ":32" extension if it's configured for ILP32. */
+ if (strlen (default_arch) > 7 && strcmp (default_arch + 7, ":32") == 0)
+ aarch64_abi = AARCH64_ABI_ILP32;
+ else
+ aarch64_abi = AARCH64_ABI_LP64;
+}
+
const char *
elf64_aarch64_target_format (void)
{
diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h
index 5bf1399..4aa3494 100644
--- a/gas/config/tc-aarch64.h
+++ b/gas/config/tc-aarch64.h
@@ -192,6 +192,9 @@ struct aarch64_segment_info_type
#define tc_regname_to_dw2regnum tc_aarch64_regname_to_dw2regnum
#define tc_cfi_frame_initial_instructions tc_aarch64_frame_initial_instructions
+extern void aarch64_after_parse_args (void);
+#define md_after_parse_args() aarch64_after_parse_args ()
+
#else /* Not OBJ_ELF. */
#define GLOBAL_OFFSET_TABLE_NAME "__GLOBAL_OFFSET_TABLE_"
#endif