aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJinyang He <hejinyang@loongson.cn>2024-04-22 17:49:50 +0800
committerliuzhensong <liuzhensong@loongson.cn>2024-04-25 11:53:15 +0800
commit035068a0cd846653e1fb0903aece42f4258803fb (patch)
tree70219d99f339e89d9312cc8a3096465fd775fcd6 /gas/testsuite
parent66156bae7a0581879763514382d112716464db8a (diff)
downloadbinutils-035068a0cd846653e1fb0903aece42f4258803fb.zip
binutils-035068a0cd846653e1fb0903aece42f4258803fb.tar.gz
binutils-035068a0cd846653e1fb0903aece42f4258803fb.tar.bz2
LoongArch: gas: Simplify relocations in sections without code flag
Gas should not emit ADD/SUB relocation pairs for label differences if they are in the same section without code flag even relax enabled. Because the real value is not be affected by relaxation and it can be compute out in assembly stage. Thus, correct the `TC_FORCE_RELOCATION _SUB_SAME` and the label differences in same section without code flag can be resolved in fixup_segment().
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/loongarch/relax_debug_line.d12
-rw-r--r--gas/testsuite/gas/loongarch/relax_debug_line.s6
2 files changed, 18 insertions, 0 deletions
diff --git a/gas/testsuite/gas/loongarch/relax_debug_line.d b/gas/testsuite/gas/loongarch/relax_debug_line.d
new file mode 100644
index 0000000..c17813c
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/relax_debug_line.d
@@ -0,0 +1,12 @@
+#as: --gdwarf-5
+#readelf: -r --wide
+#skip: loongarch32-*-*
+
+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
diff --git a/gas/testsuite/gas/loongarch/relax_debug_line.s b/gas/testsuite/gas/loongarch/relax_debug_line.s
new file mode 100644
index 0000000..d2852bb
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/relax_debug_line.s
@@ -0,0 +1,6 @@
+ .file 0 "test"
+ .text
+ .loc 0 10 0
+ nop
+
+.section .debug_line, "", @progbits