summaryrefslogtreecommitdiff
path: root/bfd/cpu-aarch64.c
diff options
context:
space:
mode:
authorJedidiah Thompson <wej22007@outlook.com>2022-10-19 10:57:12 +0200
committerZac Walker <zac.walker@linaro.org>2022-10-19 10:57:12 +0200
commitc60b3806799abf1d7f6cf5108a1b0e733a950b13 (patch)
treea203af8ed31ff48618e57a76a668faea3673fb0e /bfd/cpu-aarch64.c
parent740a19d914a83423122fe81eec9508fa1dbb0559 (diff)
downloadbinutils-gdb-c60b3806799abf1d7f6cf5108a1b0e733a950b13.tar.gz
aarch64-pe support for LD, GAS and BFD
Allows aarch64-pe to be targeted natively, not having to use objcopy to convert it from ELF to PE. Based on initial work by Jedidiah Thompson Co-authored-by: Jedidiah Thompson <wej22007@outlook.com> Co-authored-by: Zac Walker <zac.walker@linaro.org>
Diffstat (limited to 'bfd/cpu-aarch64.c')
-rw-r--r--bfd/cpu-aarch64.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/bfd/cpu-aarch64.c b/bfd/cpu-aarch64.c
index e1bd8fc4789..eb88d0ef861 100644
--- a/bfd/cpu-aarch64.c
+++ b/bfd/cpu-aarch64.c
@@ -39,8 +39,8 @@ compatible (const bfd_arch_info_type * a, const bfd_arch_info_type * b)
if (a->mach == b->mach)
return a;
- /* Don't allow mixing ilp32 with lp64. */
- if ((a->mach & bfd_mach_aarch64_ilp32) != (b->mach & bfd_mach_aarch64_ilp32))
+ /* Don't allow mixing data models. */
+ if ((a->mach ^ b->mach) & (bfd_mach_aarch64_ilp32 | bfd_mach_aarch64_llp64))
return NULL;
/* Otherwise if either a or b is the 'default' machine
@@ -102,20 +102,33 @@ scan (const struct bfd_arch_info *info, const char *string)
return false;
}
-#define N(NUMBER, PRINT, WORDSIZE, DEFAULT, NEXT) \
- { WORDSIZE, WORDSIZE, 8, bfd_arch_aarch64, NUMBER, \
- "aarch64", PRINT, 4, DEFAULT, compatible, scan, \
- bfd_arch_default_fill, NEXT, 0 }
+/* Figure out if llp64 is default */
+#if DEFAULT_VECTOR == aarch64_pe_le_vec
+#define LLP64_DEFAULT true
+#define AARCH64_DEFAULT false
+#else
+#define LLP64_DEFAULT false
+#define AARCH64_DEFAULT true
+#endif
-static const bfd_arch_info_type bfd_aarch64_arch_v8_r =
- N (bfd_mach_aarch64_8R, "aarch64:armv8-r", 64, false, NULL);
+#define N(NUMBER, PRINT, WORDSIZE, ADDRSIZE, DEFAULT, NEXT) \
+ { WORDSIZE, ADDRSIZE, 8, bfd_arch_aarch64, NUMBER, \
+ "aarch64", PRINT, 4, DEFAULT, compatible, scan, \
+ bfd_arch_default_fill, NEXT, 0 }
+
+ static const bfd_arch_info_type bfd_aarch64_arch_v8_r =
+ N (bfd_mach_aarch64_8R, "aarch64:armv8-r", 64, 64, false, NULL);
static const bfd_arch_info_type bfd_aarch64_arch_ilp32 =
- N (bfd_mach_aarch64_ilp32, "aarch64:ilp32", 32, false,
+ N (bfd_mach_aarch64_ilp32, "aarch64:ilp32", 32, 32, false,
&bfd_aarch64_arch_v8_r);
-const bfd_arch_info_type bfd_aarch64_arch =
- N (0, "aarch64", 64, true, &bfd_aarch64_arch_ilp32);
+static const bfd_arch_info_type bfd_aarch64_arch_llp64 =
+ N (bfd_mach_aarch64_llp64, "aarch64:llp64", 32, 64, LLP64_DEFAULT,
+ &bfd_aarch64_arch_ilp32);
+
+ const bfd_arch_info_type bfd_aarch64_arch =
+ N (0, "aarch64", 64, 64, AARCH64_DEFAULT, &bfd_aarch64_arch_llp64);
bool
bfd_is_aarch64_special_symbol_name (const char *name, int type)