LoongArch: gas: Simplify relocations in sections with debuging flag
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Testing passed
|
Commit Message
Gas should not emit ADD/SUB relocation pairs for label differences
in non-exec section when relax enabled, because the real value can
be compute out in assembly stage. Thus, correct the definition of
TC_FORCE_RELOCATION_SUB_SAME.
---
gas/config/tc-loongarch.h | 4 +---
gas/testsuite/gas/loongarch/relax_debug_line.d | 11 +++++++++++
gas/testsuite/gas/loongarch/relax_debug_line.s | 6 ++++++
3 files changed, 18 insertions(+), 3 deletions(-)
create mode 100644 gas/testsuite/gas/loongarch/relax_debug_line.d
create mode 100644 gas/testsuite/gas/loongarch/relax_debug_line.s
@@ -91,9 +91,7 @@ extern bool loongarch_frag_align_code (int, int);
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
(LARCH_opts.relax ? \
(GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC) \
- || ((SEC)->flags & SEC_CODE) != 0 \
- || ((SEC)->flags & SEC_DEBUGGING) != 0 \
- || TC_FORCE_RELOCATION (FIX)) \
+ || ((SEC)->flags & SEC_CODE) != 0) \
: (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC))) \
#define TC_LINKRELAX_FIXUP(seg) ((seg->flags & SEC_CODE) \
new file mode 100644
@@ -0,0 +1,11 @@
+#as: --gdwarf-5
+#readelf: -r --wide
+
+Relocation section '\.rela\.debug_line' at offset .* contains 5 entries:
+#...
+0+22.*R_LARCH_32[ \t]+[0-9]+.*
+0+2c.*R_LARCH_32[ \t]+[0-9]+.*
+0+36.*R_LARCH_64[ \t]+[0-9]+.*
+0+42.*R_LARCH_ADD16[ \t]+[0-9]+.*
+0+42.*R_LARCH_SUB16[ \t]+[0-9]+.*
+#pass
new file mode 100644
@@ -0,0 +1,6 @@
+ .file 0 "test"
+ .text
+ .loc 0 10 0
+ nop
+
+.section .debug_line, "", @progbits