aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2018-10-05 11:41:40 +0900
committerStafford Horne <shorne@gmail.com>2018-10-05 11:41:40 +0900
commit1c4f3780f7d939402cfe555007ebff45c8e38951 (patch)
treee4707fb11ce08c16f01e8dbee9504e2b29b43ddd /gas
parent4677effd9e320d9f09337ef17bf0dc0377a9e8ce (diff)
downloadgdb-1c4f3780f7d939402cfe555007ebff45c8e38951.zip
gdb-1c4f3780f7d939402cfe555007ebff45c8e38951.tar.gz
gdb-1c4f3780f7d939402cfe555007ebff45c8e38951.tar.bz2
or1k: Add relocations for high-signed and low-stores
This patch adds the following target relocations: - BFD_RELOC_HI16_S High 16-bit relocation, for used with signed asm: ha() lower. - BFD_RELOC_HI16_S_GOTOFF High 16-bit GOT offset relocation for local asm: gotoffha() symbols, for use with signed lower. - BFD_RELOC_OR1K_TLS_IE_AHI16 High 16-bit TLS relocation with initial asm: gottpoffha() executable calculation, for use with signed lower. - BFD_RELOC_OR1K_TLS_LE_AHI16 High 16-bit TLS relocation for local executable asm: tpoffha() variables, for use with signed lower. - BFD_RELOC_OR1K_SLO16 Split lower 16-bit relocation, used with asm: lo() OpenRISC store instructions. - BFD_RELOC_OR1K_GOTOFF_SLO16 Split lower 16-bit GOT offset relocation for asm: gotofflo() local symbols, used with OpenRISC store instructions. - BFD_RELOC_OR1K_TLS_LE_SLO16 Split lower 16-bit relocation for TLS local asm: tpofflo() executable variables, used with OpenRISC store instructions. bfd/ChangeLog: yyyy-mm-dd Richard Henderson <rth@twiddle.net> Stafford Horne <shorne@gmail.com> * bfd-in2.h: Regenerated. * elf32-or1k.c (N_ONES): New macro. (or1k_elf_howto_table): Fix R_OR1K_PLT26 to complain on overflow. Add definitions for R_OR1K_TLS_TPOFF, R_OR1K_TLS_DTPOFF, R_OR1K_TLS_DTPMOD, R_OR1K_AHI16, R_OR1K_GOTOFF_AHI16, R_OR1K_TLS_IE_AHI16, R_OR1K_TLS_LE_AHI16, R_OR1K_SLO16, R_OR1K_GOTOFF_SLO16, R_OR1K_TLS_LE_SLO16. (or1k_reloc_map): Add entries for BFD_RELOC_HI16_S, BFD_RELOC_LO16_GOTOFF, BFD_RELOC_HI16_GOTOFF, BFD_RELOC_HI16_S_GOTOFF, BFD_RELOC_OR1K_TLS_IE_AHI16, BFD_RELOC_OR1K_TLS_LE_AHI16, BFD_RELOC_OR1K_SLO16, BFD_RELOC_OR1K_GOTOFF_SLO16, BFD_RELOC_OR1K_TLS_LE_SLO16. (or1k_reloc_type_lookup): Change search loop to start ad index 0 and also check results before returning. (or1k_reloc_name_lookup): Simplify loop to use R_OR1K_max as index limit. (or1k_final_link_relocate): New function. (or1k_elf_relocate_section): Add support for new AHI and SLO relocations. Use or1k_final_link_relocate instead of generic _bfd_final_link_relocate. (or1k_elf_check_relocs): Add support for new AHI and SLO relocations. * reloc.c: Add new enums for BFD_RELOC_OR1K_SLO16, BFD_RELOC_OR1K_GOTOFF_SLO16, BFD_RELOC_OR1K_TLS_IE_AHI16, BFD_RELOC_OR1K_TLS_IE_AHI16, BFD_RELOC_OR1K_TLS_LE_AHI16, BFD_RELOC_OR1K_TLS_LE_SLO16. Remove unused BFD_RELOC_OR1K_GOTOFF_HI16 and BFD_RELOC_OR1K_GOTOFF_LO16. * libbfd.h: Regenerated. cpu/ChangeLog: yyyy-mm-dd Richard Henderson <rth@twiddle.net> * or1k.opc: Add RTYPE_ enum. (INVALID_STORE_RELOC): New string. (or1k_imm16_relocs): New array array. (parse_reloc): New static function that just does the parsing. (parse_imm16): New static function for generic parsing. (parse_simm16): Change to just call parse_imm16. (parse_simm16_split): New function. (parse_uimm16): Change to call parse_imm16. (parse_uimm16_split): New function. * or1korbis.cpu (simm16-split): Change to use new simm16_split. (uimm16-split): Change to use new uimm16_split. gas/ChangeLog: yyyy-mm-dd Richard Henderson <rth@twiddle.net> * testsuite/gas/or1k/allinsn.d (l_ha): Add result for ha() relocation. * testsuite/gas/or1k/allinsn.s (l_ha): Add test for ha() relocations. * testsuite/gas/or1k/allinsn.exp: Renamed to or1k.exp. * testsuite/gas/or1k/or1k.exp: Add reloc-2 list test. * testsuite/gas/or1k/reloc-1.d: New file. * testsuite/gas/or1k/reloc-1.s: New file. * testsuite/gas/or1k/reloc-2.l: New file. * testsuite/gas/or1k/reloc-2.s: New file. include/ChangeLog: yyyy-mm-dd Richard Henderson <rth@twiddle.net> * elf/or1k.h (elf_or1k_reloc_type): Add R_OR1K_AHI16, R_OR1K_GOTOFF_AHI16, R_OR1K_TLS_IE_AHI16, R_OR1K_TLS_LE_AHI16, R_OR1K_SLO16, R_OR1K_GOTOFF_SLO16, R_OR1K_TLS_LE_SLO16. ld/ChangeLog: yyyy-mm-dd Richard Henderson <rth@twiddle.net> * testsuite/ld-or1k/offsets1.d: New file. * testsuite/ld-or1k/offsets1.s: New file. * testsuite/ld-or1k/or1k.exp: New file. opcodes/ChangeLog: yyyy-mm-dd Richard Henderson <rth@twiddle.net> * or1k-asm.c: Regenerate.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog11
-rw-r--r--gas/testsuite/gas/or1k/allinsn.d19
-rw-r--r--gas/testsuite/gas/or1k/allinsn.s2
-rw-r--r--gas/testsuite/gas/or1k/or1k.exp (renamed from gas/testsuite/gas/or1k/allinsn.exp)1
-rw-r--r--gas/testsuite/gas/or1k/reloc-1.d56
-rw-r--r--gas/testsuite/gas/or1k/reloc-1.s56
-rw-r--r--gas/testsuite/gas/or1k/reloc-2.l10
-rw-r--r--gas/testsuite/gas/or1k/reloc-2.s12
8 files changed, 159 insertions, 8 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index c065699..d2f3b98 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,14 @@
+2018-10-05 Richard Henderson <rth@twiddle.net>
+
+ * testsuite/gas/or1k/allinsn.d (l_ha): Add result for ha() relocation.
+ * testsuite/gas/or1k/allinsn.s (l_ha): Add test for ha() relocations.
+ * testsuite/gas/or1k/allinsn.exp: Renamed to or1k.exp.
+ * testsuite/gas/or1k/or1k.exp: Add reloc-2 list test.
+ * testsuite/gas/or1k/reloc-1.d: New file.
+ * testsuite/gas/or1k/reloc-1.s: New file.
+ * testsuite/gas/or1k/reloc-2.l: New file.
+ * testsuite/gas/or1k/reloc-2.s: New file.
+
2018-10-03 Tamar Christina <tamar.christina@arm.com>
* testsuite/gas/aarch64/sve-movprfx_1.d: New test.
diff --git a/gas/testsuite/gas/or1k/allinsn.d b/gas/testsuite/gas/or1k/allinsn.d
index 27884fe..1b36cce 100644
--- a/gas/testsuite/gas/or1k/allinsn.d
+++ b/gas/testsuite/gas/or1k/allinsn.d
@@ -679,11 +679,14 @@ Disassembly of section \.text:
00000824 <l_hi>:
824: 18 20 de ad l\.movhi r1,0xdead
-00000828 <l_mac>:
- 828: c4 01 10 01 l.mac r1,r2
-
-0000082c <l_maci>:
- 82c: 4c 01 00 00 l\.maci r1,0
- 830: 4c 02 ff ff l\.maci r2,-1
- 834: 4c 02 7f ff l\.maci r2,32767
- 838: 4c 02 80 00 l\.maci r2,-32768
+00000828 <l_ha>:
+ 828: 18 20 de ae l\.movhi r1,0xdeae
+
+0000082c <l_mac>:
+ 82c: c4 01 10 01 l.mac r1,r2
+
+00000830 <l_maci>:
+ 830: 4c 01 00 00 l\.maci r1,0
+ 834: 4c 02 ff ff l\.maci r2,-1
+ 838: 4c 02 7f ff l\.maci r2,32767
+ 83c: 4c 02 80 00 l\.maci r2,-32768
diff --git a/gas/testsuite/gas/or1k/allinsn.s b/gas/testsuite/gas/or1k/allinsn.s
index 05647f2..321aea3 100644
--- a/gas/testsuite/gas/or1k/allinsn.s
+++ b/gas/testsuite/gas/or1k/allinsn.s
@@ -667,6 +667,8 @@ l_lo:
l.addi r1, r1, lo(0xdeadbeef)
l_hi:
l.movhi r1, hi(0xdeadbeef)
+l_ha:
+ l.movhi r1, ha(0xdeadbeef)
l_mac:
l.mac r1,r2
diff --git a/gas/testsuite/gas/or1k/allinsn.exp b/gas/testsuite/gas/or1k/or1k.exp
index 11eacd7..e0e0515 100644
--- a/gas/testsuite/gas/or1k/allinsn.exp
+++ b/gas/testsuite/gas/or1k/or1k.exp
@@ -2,4 +2,5 @@
if [istarget or1k*-*-*] {
run_dump_tests [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+ run_list_test "reloc-2" ""
}
diff --git a/gas/testsuite/gas/or1k/reloc-1.d b/gas/testsuite/gas/or1k/reloc-1.d
new file mode 100644
index 0000000..f90a1ae
--- /dev/null
+++ b/gas/testsuite/gas/or1k/reloc-1.d
@@ -0,0 +1,56 @@
+#as:
+#objdump: -r
+#name: reloc
+
+.*: +file format .*
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+00000000 R_OR1K_HI_16_IN_INSN x
+00000004 R_OR1K_HI_16_IN_INSN x
+00000008 R_OR1K_HI_16_IN_INSN x
+0000000c R_OR1K_HI_16_IN_INSN x
+00000010 R_OR1K_LO_16_IN_INSN x
+00000014 R_OR1K_LO_16_IN_INSN x
+00000018 R_OR1K_LO_16_IN_INSN x
+0000001c R_OR1K_LO_16_IN_INSN x
+00000020 R_OR1K_LO_16_IN_INSN x
+00000024 R_OR1K_LO_16_IN_INSN x
+00000028 R_OR1K_LO_16_IN_INSN x
+0000002c R_OR1K_LO_16_IN_INSN x
+00000030 R_OR1K_LO_16_IN_INSN x
+00000034 R_OR1K_LO_16_IN_INSN x
+00000038 R_OR1K_SLO16 x
+0000003c R_OR1K_SLO16 x
+00000040 R_OR1K_SLO16 x
+00000044 R_OR1K_SLO16 x
+00000048 R_OR1K_AHI16 x
+0000004c R_OR1K_AHI16 x
+00000050 R_OR1K_AHI16 x
+00000054 R_OR1K_GOT16 x
+00000058 R_OR1K_GOT16 x
+0000005c R_OR1K_GOT16 x
+00000060 R_OR1K_GOTPC_HI16 _GLOBAL_OFFSET_TABLE_-0x00000004
+00000064 R_OR1K_GOTPC_LO16 _GLOBAL_OFFSET_TABLE_-0x00000008
+00000068 R_OR1K_GOTOFF_HI16 x
+0000006c R_OR1K_GOTOFF_LO16 x
+00000070 R_OR1K_GOTOFF_AHI16 x
+00000074 R_OR1K_GOTOFF_LO16 x
+00000078 R_OR1K_GOTOFF_SLO16 x
+0000007c R_OR1K_TLS_GD_HI16 x
+00000080 R_OR1K_TLS_GD_LO16 x
+00000084 R_OR1K_TLS_LDM_HI16 x
+00000088 R_OR1K_TLS_LDM_LO16 x
+0000008c R_OR1K_TLS_LDO_HI16 x
+00000090 R_OR1K_TLS_LDO_LO16 x
+00000094 R_OR1K_TLS_IE_HI16 x
+00000098 R_OR1K_TLS_IE_LO16 x
+0000009c R_OR1K_TLS_IE_AHI16 x
+000000a0 R_OR1K_TLS_IE_LO16 x
+000000a4 R_OR1K_TLS_LE_HI16 x
+000000a8 R_OR1K_TLS_LE_LO16 x
+000000ac R_OR1K_TLS_LE_AHI16 x
+000000b0 R_OR1K_TLS_LE_LO16 x
+000000b4 R_OR1K_TLS_LE_SLO16 x
+
+
diff --git a/gas/testsuite/gas/or1k/reloc-1.s b/gas/testsuite/gas/or1k/reloc-1.s
new file mode 100644
index 0000000..4966dc5
--- /dev/null
+++ b/gas/testsuite/gas/or1k/reloc-1.s
@@ -0,0 +1,56 @@
+ l.movhi r3,hi(x)
+ l.ori r3,r4,hi(x)
+ l.addi r3,r4,hi(x)
+ l.lwz r3,hi(x)(r4)
+
+ l.movhi r3,lo(x)
+ l.ori r3,r4,lo(x)
+ l.addi r3,r4,lo(x)
+ l.lwz r3,lo(x)(r4)
+ l.lws r3,lo(x)(r4)
+ l.lhz r3,lo(x)(r4)
+ l.lhs r3,lo(x)(r4)
+ l.lbz r3,lo(x)(r4)
+ l.lbs r3,lo(x)(r4)
+ l.lwa r3,lo(x)(r4)
+ l.sw lo(x)(r4),r3
+ l.sh lo(x)(r4),r3
+ l.sb lo(x)(r4),r3
+ l.swa lo(x)(r4),r3
+
+ l.movhi r3,ha(x)
+ l.ori r3,r4,ha(x)
+ l.addi r3,r4,ha(x)
+
+ l.ori r3,r0,got(x)
+ l.addi r3,r4,got(x)
+ l.lwz r3,got(x)(r4)
+
+ l.movhi r3,gotpchi(_GLOBAL_OFFSET_TABLE_-4)
+ l.ori r3,r3,gotpclo(_GLOBAL_OFFSET_TABLE_-8)
+
+ l.movhi r3,gotoffhi(x)
+ l.ori r3,r3,gotofflo(x)
+ l.movhi r3,gotoffha(x)
+ l.lwz r3,gotofflo(x)(r3)
+ l.sw gotofflo(x)(r3),r3
+
+ l.movhi r3,tlsgdhi(x)
+ l.ori r3,r3,tlsgdlo(x)
+
+ l.movhi r3,tlsldmhi(x)
+ l.ori r3,r3,tlsldmlo(x)
+
+ l.movhi r3,dtpoffhi(x)
+ l.ori r3,r3,dtpofflo(x)
+
+ l.movhi r3,gottpoffhi(x)
+ l.ori r3,r3,gottpofflo(x)
+ l.movhi r3,gottpoffha(x)
+ l.lwz r3,gottpofflo(x)(r3)
+
+ l.movhi r3,tpoffhi(x)
+ l.ori r3,r3,tpofflo(x)
+ l.movhi r3,tpoffha(x)
+ l.lwz r3,tpofflo(x)(r3)
+ l.sw tpofflo(x)(r3),r3
diff --git a/gas/testsuite/gas/or1k/reloc-2.l b/gas/testsuite/gas/or1k/reloc-2.l
new file mode 100644
index 0000000..7a32a7d
--- /dev/null
+++ b/gas/testsuite/gas/or1k/reloc-2.l
@@ -0,0 +1,10 @@
+.*: Assembler messages:
+.*:2: Error: relocation invalid for store .*
+.*:3: Error: relocation invalid for store .*
+.*:4: Error: relocation invalid for store .*
+.*:6: Error: relocation invalid for store .*
+.*:7: Error: relocation invalid for store .*
+.*:8: Error: relocation invalid for store .*
+.*:9: Error: relocation invalid for store .*
+.*:11: Error: relocation invalid for store .*
+.*:12: Error: relocation invalid for store .*
diff --git a/gas/testsuite/gas/or1k/reloc-2.s b/gas/testsuite/gas/or1k/reloc-2.s
new file mode 100644
index 0000000..835dd1c
--- /dev/null
+++ b/gas/testsuite/gas/or1k/reloc-2.s
@@ -0,0 +1,12 @@
+ l.sw lo(x)(r4),r3
+ l.sw hi(x)(r4),r3
+ l.sw ha(x)(r4),r3
+ l.sw got(x)(r4),r3
+ l.sw gotofflo(x)(r4),r3
+ l.sw gotoffhi(x)(r4),r3
+ l.sw gotoffha(x)(r4),r3
+ l.sw dtpoffhi(x)(r4),r3
+ l.sw gottpoffhi(x)(r4),r3
+ l.sw tpofflo(x)(r4),r3
+ l.sw tpoffhi(x)(r4),r3
+ l.sw tpoffha(x)(r4),r3