From 3b14682a432e61c756ec9ad0b5bf5f8136e2cdce Mon Sep 17 00:00:00 2001 From: liuzhensong Date: Mon, 21 Feb 2022 14:28:29 +0800 Subject: 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. --- include/elf/loongarch.h | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'include') 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 */ -- cgit v1.1