aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorliuzhensong <liuzhensong@loongson.cn>2022-02-21 14:28:29 +0800
committerliuzhensong <liuzhensong@loongson.cn>2022-03-20 09:37:12 +0800
commit3b14682a432e61c756ec9ad0b5bf5f8136e2cdce (patch)
treef6902033039cad8bc0a80090702d2c8e149f6145 /include
parent1848a40fdd134c5579e743d93f1ca9acc0b4b486 (diff)
downloadgdb-3b14682a432e61c756ec9ad0b5bf5f8136e2cdce.zip
gdb-3b14682a432e61c756ec9ad0b5bf5f8136e2cdce.tar.gz
gdb-3b14682a432e61c756ec9ad0b5bf5f8136e2cdce.tar.bz2
LoongArch: Update ABI eflag in elf header.
Update LoongArch ABI eflag in elf header. ilp32s 0x5 ilp32f 0x6 ilp32d 0x7 lp64s 0x1 lp64f 0x2 lp64d 0x3 bfd/ * elfnn-loongarch.c Check object flags while ld. gas/ * tc-loongarch.c Write eflag to elf header. include/elf * loongarch.h Define ABI number.
Diffstat (limited to 'include')
-rw-r--r--include/elf/loongarch.h37
1 files changed, 23 insertions, 14 deletions
diff --git a/include/elf/loongarch.h b/include/elf/loongarch.h
index 1893ef5..b7aa4ff 100644
--- a/include/elf/loongarch.h
+++ b/include/elf/loongarch.h
@@ -93,27 +93,36 @@ RELOC_NUMBER (R_LARCH_GNU_VTENTRY, 58)
END_RELOC_NUMBERS (R_LARCH_count)
/* Processor specific flags for the ELF header e_flags field. */
-#define EF_LOONGARCH_ABI_ILP32 0x1
-#define EF_LOONGARCH_ABI_LP64 0x3
-#define EF_LOONGARCH_ABI_MASK 0x3
+/*The flag lp64s/lp64f/lp64d/ilp32s/ilp32f/ilp32d 3bits. */
+#define EF_LOONGARCH_ABI_LP64_SOFT_FLOAT 0x1
+#define EF_LOONGARCH_ABI_LP64_SINGLE_FLOAT 0x2
+#define EF_LOONGARCH_ABI_LP64_DOUBLE_FLOAT 0x3
-#define EF_LOONGARCH_FLOAT_ABI_SOFT 0x0c
-#define EF_LOONGARCH_FLOAT_ABI_SINGLE 0x08
-#define EF_LOONGARCH_FLOAT_ABI_DOUBLE 0x00
-#define EF_LOONGARCH_FLOAT_ABI_MASK 0x3c
+#define EF_LOONGARCH_ABI_ILP32_SOFT_FLOAT 0x5
+#define EF_LOONGARCH_ABI_ILP32_SINGLE_FLOAT 0x6
+#define EF_LOONGARCH_ABI_ILP32_DOUBLE_FLOAT 0x7
+
+#define EF_LOONGARCH_ABI_MASK 0x7
+#define EF_LOONGARCH_ABI_ILP32_MASK 0x4
+#define EF_LOONGARCH_ABI_FLOAT_MASK 0x3
+#define EF_LOONGARCH_ABI_SOFT_FLOAT_MASK 0x1
+#define EF_LOONGARCH_ABI_SINGLE_FLOAT_MASK 0x2
+#define EF_LOONGARCH_ABI_DOUBLE_FLOAT_MASK 0x3
+
+#define EF_LOONGARCH_ABI(abi) (EF_LOONGARCH_ABI_MASK & (abi))
#define EF_LOONGARCH_IS_LP64(abi) \
- ((abi & EF_LOONGARCH_ABI_MASK) == EF_LOONGARCH_ABI_LP64)
+ (EF_LOONGARCH_ABI(abi) && (!(EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_ILP32_MASK)))
#define EF_LOONGARCH_IS_ILP32(abi) \
- ((abi & EF_LOONGARCH_ABI_MASK) == EF_LOONGARCH_ABI_ILP32)
+ (EF_LOONGARCH_ABI(abi) && (EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_ILP32_MASK))
#define EF_LOONGARCH_IS_SOFT_FLOAT(abi) \
- ((abi & EF_LOONGARCH_FLOAT_ABI_MASK) == EF_LOONGARCH_FLOAT_ABI_SOFT)
+ (!((EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_FLOAT_MASK) ^ EF_LOONGARCH_ABI_SOFT_FLOAT_MASK))
+
#define EF_LOONGARCH_IS_SINGLE_FLOAT(abi) \
- ((abi & EF_LOONGARCH_FLOAT_ABI_MASK) == EF_LOONGARCH_FLOAT_ABI_SINGLE)
-#define EF_LOONGARCH_IS_DOUBLE_FLOAT(abi) \
- ((abi & EF_LOONGARCH_FLOAT_ABI_MASK) == EF_LOONGARCH_FLOAT_ABI_DOUBLE)
+ (!((EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_FLOAT_MASK) ^ EF_LOONGARCH_ABI_SINGLE_FLOAT_MASK))
-#define EF_LOONGARCH_ABI (EF_LOONGARCH_ABI_MASK | EF_LOONGARCH_FLOAT_ABI_MASK)
+#define EF_LOONGARCH_IS_DOUBLE_FLOAT(abi) \
+ (!((EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_FLOAT_MASK) ^ EF_LOONGARCH_ABI_DOUBLE_FLOAT_MASK))
#endif /* _ELF_LOONGARCH_H */