aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authormengqinggang <mengqinggang@loongson.cn>2023-04-18 11:49:21 +0100
committerNick Clifton <nickc@redhat.com>2023-04-18 11:49:21 +0100
commita02676b77d84d8229b5d4b01259535234cded19e (patch)
tree5303783009550d51a718453a7ff335ea57f582fd /gas
parent01996a7a49bb278a50e72cb9a70011b8f907968e (diff)
downloadgdb-a02676b77d84d8229b5d4b01259535234cded19e.zip
gdb-a02676b77d84d8229b5d4b01259535234cded19e.tar.gz
gdb-a02676b77d84d8229b5d4b01259535234cded19e.tar.bz2
Symbols with GOT relocatios do not fix adjustbale
gas * config/tc-loongarch.c (loongarch_fix_adjustable): Symbols with GOT relocatios do not fix adjustbale. * testsuite/gas/loongarch/macro_op_large_abs.d: Regenerated. * testsuite/gas/loongarch/macro_op_large_pc.d: Regenerated. ld * testsuite/ld-loongarch-elf/macro_op.d: Regenerated. -
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/config/tc-loongarch.c15
-rw-r--r--gas/testsuite/gas/loongarch/macro_op_large_abs.d120
-rw-r--r--gas/testsuite/gas/loongarch/macro_op_large_pc.d18
4 files changed, 91 insertions, 69 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 760230d..80548d2 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+2023-04-18 mengqinggang <mengqinggang@loongson.cn>
+
+ * config/tc-loongarch.c (loongarch_fix_adjustable): Symbols with
+ GOT relocatios do not fix adjustbale.
+ * testsuite/gas/loongarch/macro_op_large_abs.d: Regenerated.
+ * testsuite/gas/loongarch/macro_op_large_pc.d: Regenerated.
+
2023-04-18 Thomas Koenig <tkoenig@netcologne.de>
* doc/internals.texi (Relaxing with a table): Describe handling of
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index dd47581..7d8749c 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -1270,6 +1270,21 @@ loongarch_fix_adjustable (fixS *fix)
|| S_FORCE_RELOC (fix->fx_addsy, true))
return 0;
+ /* Loongarch loads extern symbols by GOT, and if there are embedded
+ asm(".local S"), gcc just output ".local S" to assembly file.
+ For a local symbol with GOT relocations, this adjustments will make
+ GOT relocation's addend not equal to zero. So this adjustments is
+ forbidden for got relocs. */
+ if(fix->fx_r_type == BFD_RELOC_LARCH_GOT_PC_HI20
+ || fix->fx_r_type == BFD_RELOC_LARCH_GOT_PC_LO12
+ || fix->fx_r_type == BFD_RELOC_LARCH_GOT64_PC_LO20
+ || fix->fx_r_type == BFD_RELOC_LARCH_GOT64_PC_HI12
+ || fix->fx_r_type == BFD_RELOC_LARCH_GOT_HI20
+ || fix->fx_r_type == BFD_RELOC_LARCH_GOT_LO12
+ || fix->fx_r_type == BFD_RELOC_LARCH_GOT64_LO20
+ || fix->fx_r_type == BFD_RELOC_LARCH_GOT64_HI12)
+ return 0;
+
return 1;
}
diff --git a/gas/testsuite/gas/loongarch/macro_op_large_abs.d b/gas/testsuite/gas/loongarch/macro_op_large_abs.d
index c3214a8..c0b98db 100644
--- a/gas/testsuite/gas/loongarch/macro_op_large_abs.d
+++ b/gas/testsuite/gas/loongarch/macro_op_large_abs.d
@@ -1,4 +1,4 @@
-#as:
+#as: -mla-global-with-abs
#objdump: -dr
#skip: loongarch32-*-*
@@ -7,7 +7,7 @@
Disassembly of section .text:
-00000000.* <.text>:
+00000000.* <.L1>:
[ ]+0:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
[ ]+0:[ ]+R_LARCH_PCALA_HI20[ ]+.text
[ ]+4:[ ]+02c00005[ ]+addi.d[ ]+\$a1,[ ]+\$zero,[ ]+0
@@ -17,61 +17,61 @@ Disassembly of section .text:
[ ]+c:[ ]+030000a5[ ]+lu52i.d[ ]+\$a1,[ ]+\$a1,[ ]+0
[ ]+c:[ ]+R_LARCH_PCALA64_HI12[ ]+.text
[ ]+10:[ ]+00109484[ ]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i.d[ ]+\$a1,[ ]+0
+[ ]+84:[ ]+R_LARCH_GOT64_PC_LO20[ ]+TLS1
+[ ]+88:[ ]+030000a5[ ]+lu52i.d[ ]+\$a1,[ ]+\$a1,[ ]+0
+[ ]+88:[ ]+R_LARCH_GOT64_PC_HI12[ ]+TLS1
+[ ]+8c:[ ]+00109484[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$a1
diff --git a/gas/testsuite/gas/loongarch/macro_op_large_pc.d b/gas/testsuite/gas/loongarch/macro_op_large_pc.d
index c3214a8..3b53275 100644
--- a/gas/testsuite/gas/loongarch/macro_op_large_pc.d
+++ b/gas/testsuite/gas/loongarch/macro_op_large_pc.d
@@ -7,7 +7,7 @@
Disassembly of section .text:
-00000000.* <.text>:
+00000000.* <.L1>:
[ ]+0:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
[ ]+0:[ ]+R_LARCH_PCALA_HI20[ ]+.text
[ ]+4:[ ]+02c00005[ ]+addi.d[ ]+\$a1,[ ]+\$zero,[ ]+0
@@ -18,13 +18,13 @@ Disassembly of section .text:
[ ]+c:[ ]+R_LARCH_PCALA64_HI12[ ]+.text
[ ]+10:[ ]+00109484[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$a1
[ ]+14:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0
-[ ]+14:[ ]+R_LARCH_GOT_PC_HI20[ ]+.text
+[ ]+14:[ ]+R_LARCH_GOT_PC_HI20[ ]+.L1
[ ]+18:[ ]+02c00005[ ]+addi.d[ ]+\$a1,[ ]+\$zero,[ ]+0
-[ ]+18:[ ]+R_LARCH_GOT_PC_LO12[ ]+.text
+[ ]+18:[ ]+R_LARCH_GOT_PC_LO12[ ]+.L1
[ ]+1c:[ ]+16000005[ ]+lu32i.d[ ]+\$a1,[ ]+0
-[ ]+1c:[ ]+R_LARCH_GOT64_PC_LO20[ ]+.text
+[ ]+1c:[ ]+R_LARCH_GOT64_PC_LO20[ ]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