From 684d5a10b1332e2a1b03a1d6e7a899ef87b3ea16 Mon Sep 17 00:00:00 2001 From: John Eric Martin Date: Wed, 19 Jul 2017 09:56:55 +0200 Subject: [PATCH] [ARC] Add JLI support. The following relocation types were added to GCC/binutils: ARC_JLI_SECTOFF is a relocation type in Metaware that is now used by GCC as well to adjust the index of function calls to functions with attribute jli_call_always. bfd/ 2017-07-19 Claudiu Zissulescu John Eric Martin * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elf32-arc.c (JLI): Define. * reloc.c: Add JLI relocations. gas/ 2017-07-19 Claudiu Zissulescu * testsuite/gas/arc/jli-1.d: New file. * testsuite/gas/arc/jli-1.s: Likewise. * testsuite/gas/arc/taux.d: Update for jli_base. include/ 2017-07-19 Claudiu Zissulescu John Eric Martin * elf/arc-reloc.def: Add JLI relocs howto. * opcode/arc-func.h (replace_jli): New function. ld/ 2017-07-19 Claudiu Zissulescu John Eric Martin * emulparams/arcelf.sh (JLI_START_TABLE): Define. * scripttempl/elfarc.sc: Handle jlitab section. * scripttempl/elfarcv2.sc: Likewise. * testsuite/ld-arc/arc.exp: Add JLI test. * testsuite/ld-arc/jli-script.ld: New file. * testsuite/ld-arc/jli-simple.dd: Likewise. * testsuite/ld-arc/jli-simple.rd: Likewise. * testsuite/ld-arc/jli-simple.s: Likewise. * testsuite/ld/testsuite/ld-arc/jli-overflow.s: Likewise. * testsuite/ld/testsuite/ld-arc/jli-overflow.d: Likewise. * testsuite/ld/testsuite/ld-arc/jli-overflow.err: Likewise. opcode/ 2017-07-19 Claudiu Zissulescu John Eric Martin * arc-opc.c (UIMM10_6_S_JLIOFF): Define. (UIMM3_23): Adjust accordingly. * arc-regs.h: Add/correct jli_base register. * arc-tbl.h (jli_s): Likewise. --- bfd/ChangeLog | 8 + bfd/bfd-in2.h | 1 + bfd/elf32-arc.c | 3 +- bfd/libbfd.h | 1 + bfd/reloc.c | 2 + gas/ChangeLog | 6 + gas/testsuite/gas/arc/jli-1.d | 25 + gas/testsuite/gas/arc/jli-1.s | 11 + gas/testsuite/gas/arc/taux.d | 1 + include/ChangeLog | 6 + include/elf/arc-reloc.def | 7 + include/opcode/arc-func.h | 15 +- ld/ChangeLog | 15 + ld/emulparams/arcelf.sh | 1 + ld/emulparams/arcv2elf.sh | 3 +- ld/emulparams/arcv2elfx.sh | 3 +- ld/scripttempl/elfarc.sc | 6 + ld/scripttempl/elfarcv2.sc | 5 + ld/testsuite/ld-arc/arc.exp | 5 + ld/testsuite/ld-arc/jli-overflow.d | 4 + ld/testsuite/ld-arc/jli-overflow.err | 3 + ld/testsuite/ld-arc/jli-overflow.s | 1050 ++++++++++++++++++++++++++ ld/testsuite/ld-arc/jli-script.ld | 20 + ld/testsuite/ld-arc/jli-simple.dd | 26 + ld/testsuite/ld-arc/jli-simple.rd | 10 + ld/testsuite/ld-arc/jli-simple.s | 24 + opcodes/ChangeLog | 8 + opcodes/arc-opc.c | 8 +- opcodes/arc-regs.h | 2 +- opcodes/arc-tbl.h | 1 + 30 files changed, 1274 insertions(+), 6 deletions(-) create mode 100644 gas/testsuite/gas/arc/jli-1.d create mode 100644 gas/testsuite/gas/arc/jli-1.s create mode 100644 ld/testsuite/ld-arc/jli-overflow.d create mode 100644 ld/testsuite/ld-arc/jli-overflow.err create mode 100644 ld/testsuite/ld-arc/jli-overflow.s create mode 100644 ld/testsuite/ld-arc/jli-script.ld create mode 100644 ld/testsuite/ld-arc/jli-simple.dd create mode 100644 ld/testsuite/ld-arc/jli-simple.rd create mode 100644 ld/testsuite/ld-arc/jli-simple.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bdffccf63f5..94ccaa04861 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2017-07-19 Claudiu Zissulescu + John Eric Martin + + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * elf32-arc.c (JLI): Define. + * reloc.c: Add JLI relocations. + 2017-07-18 Nick Clifton PR 21775 diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 1343780c8ce..d126aed0868 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -3800,6 +3800,7 @@ pc-relative or some form of GOT-indirect relocation. */ BFD_RELOC_ARC_S25W_PCREL_PLT, BFD_RELOC_ARC_S21H_PCREL_PLT, BFD_RELOC_ARC_NPS_CMEM16, + BFD_RELOC_ARC_JLI_SECTOFF, /* ADI Blackfin 16 bit immediate absolute reloc. */ BFD_RELOC_BFIN_16_IMM, diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c index 93b21de4685..cdecdb14528 100644 --- a/bfd/elf32-arc.c +++ b/bfd/elf32-arc.c @@ -1182,7 +1182,7 @@ arc_special_overflow_checks (const struct arc_relocation_data reloc_data, + (reloc_data.reloc_offset)))) #define SECTSTART (bfd_signed_vma) (reloc_data.sym_section->output_section->vma \ + reloc_data.sym_section->output_offset) - +#define JLI (bfd_signed_vma) (reloc_data.sym_section->output_section->vma) #define _SDA_BASE_ (bfd_signed_vma) (reloc_data.sdata_begin_symbol_vma) #define TLS_REL (bfd_signed_vma) \ ((elf_hash_table (info))->tls_sec->output_section->vma) @@ -1359,6 +1359,7 @@ arc_do_relocation (bfd_byte * contents, #undef P #undef SECTSTAR #undef SECTSTART +#undef JLI #undef _SDA_BASE_ #undef none diff --git a/bfd/libbfd.h b/bfd/libbfd.h index ae9bf768144..17acda5c3a6 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -1752,6 +1752,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_ARC_S25W_PCREL_PLT", "BFD_RELOC_ARC_S21H_PCREL_PLT", "BFD_RELOC_ARC_NPS_CMEM16", + "BFD_RELOC_ARC_JLI_SECTOFF", "BFD_RELOC_BFIN_16_IMM", "BFD_RELOC_BFIN_16_HIGH", "BFD_RELOC_BFIN_4_PCREL", diff --git a/bfd/reloc.c b/bfd/reloc.c index aa70fa58740..8512261c66d 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -3695,6 +3695,8 @@ ENUMX BFD_RELOC_ARC_S21H_PCREL_PLT ENUMX BFD_RELOC_ARC_NPS_CMEM16 +ENUMX + BFD_RELOC_ARC_JLI_SECTOFF ENUMDOC ARC relocs. diff --git a/gas/ChangeLog b/gas/ChangeLog index dd6a34f858b..d247a5b57ff 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2017-07-19 Claudiu Zissulescu + + * testsuite/gas/arc/jli-1.d: New file. + * testsuite/gas/arc/jli-1.s: Likewise. + * testsuite/gas/arc/taux.d: Update for jli_base. + 2017-07-19 Tristan Gingold * as.c (start_sbrk): Remove. diff --git a/gas/testsuite/gas/arc/jli-1.d b/gas/testsuite/gas/arc/jli-1.d new file mode 100644 index 00000000000..10550a2d0dc --- /dev/null +++ b/gas/testsuite/gas/arc/jli-1.d @@ -0,0 +1,25 @@ +#as: +#objdump: -Dr + +.*: +file format .* + + +Disassembly of section .group: + +00000000 : + 0: 0[10] 00 00 0[01] .word 0x00000001 + 4: 0[60] 00 00 0[06] .word 0x00000006 + +Disassembly of section .text: + +00000000 <.text>: + 0: 5800 jli_s 0 + 0: R_ARC_JLI_SECTOFF __jli.foo + +Disassembly of section .jlitab: + +00000000 <__jli.foo>: + 0: 0001 0000 b 0 + 0: R_ARC_S25H_PCREL foo + +#... diff --git a/gas/testsuite/gas/arc/jli-1.s b/gas/testsuite/gas/arc/jli-1.s new file mode 100644 index 00000000000..6890147e97f --- /dev/null +++ b/gas/testsuite/gas/arc/jli-1.s @@ -0,0 +1,11 @@ +;;; Test basic JLI relocs and constructs. + + .cpu em4 + + jli_s __jli.foo ; Generates R_ARC_JLI_SECTOFF + + .section .jlitab,"axG",%progbits,jlitab.foo,comdat + .align 4 +__jli.foo: + .weak __jli.foo + b @foo diff --git a/gas/testsuite/gas/arc/taux.d b/gas/testsuite/gas/arc/taux.d index 10f50ee08c0..6303146ef3e 100644 --- a/gas/testsuite/gas/arc/taux.d +++ b/gas/testsuite/gas/arc/taux.d @@ -16,6 +16,7 @@ .* U d2l .* U dpfp_status .* U fp_status +.* U jli_base .* mx0 .* mx1 .* my0 diff --git a/include/ChangeLog b/include/ChangeLog index cecaa88cab2..a31f62eea4e 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2017-07-19 Claudiu Zissulescu + John Eric Martin + + * elf/arc-reloc.def: Add JLI relocs howto. + * opcode/arc-func.h (replace_jli): New function. + 2017-07-18 Nick Clifton PR 21775 diff --git a/include/elf/arc-reloc.def b/include/elf/arc-reloc.def index aa2309c6012..c58ca96a8f2 100644 --- a/include/elf/arc-reloc.def +++ b/include/elf/arc-reloc.def @@ -414,6 +414,13 @@ ARC_RELOC_HOWTO(ARC_S25H_PCREL_PLT, 61, \ signed, \ ( ME ( ( ( ( L + A ) - P ) >> 1 ) ) )) +ARC_RELOC_HOWTO(ARC_JLI_SECTOFF, 63, \ + 1, \ + 10, \ + replace_jli, \ + bitfield, \ + ( ( S - JLI ) >> 2)) + ARC_RELOC_HOWTO(ARC_TLS_DTPMOD, 66, \ 2, \ 32, \ diff --git a/include/opcode/arc-func.h b/include/opcode/arc-func.h index c794593de1b..fb45b07d7ee 100644 --- a/include/opcode/arc-func.h +++ b/include/opcode/arc-func.h @@ -274,8 +274,21 @@ replace_disp12s (unsigned insn, int value ATTRIBUTE_UNUSED) insn = insn & ~0xfff; insn |= ((value >> 0) & 0x003f) << 6; insn |= ((value >> 6) & 0x003f) << 0; - return insn; } #endif /* REPLACE_disp12s */ + +/* mask = 0000001111111111. */ +#ifndef REPLACE_jli +#define REPLACE_jli +ATTRIBUTE_UNUSED static unsigned +replace_jli (unsigned insn, int value) +{ + insn = insn & ~0x3ff; + insn |= ((value >> 0) & 0x03ff) << 0; + + return insn; +} + +#endif /* REPLACE_jli */ diff --git a/ld/ChangeLog b/ld/ChangeLog index 4525236a6b7..00eada7a44a 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,18 @@ +2017-07-19 Claudiu Zissulescu + John Eric Martin + + * emulparams/arcelf.sh (JLI_START_TABLE): Define. + * scripttempl/elfarc.sc: Handle jlitab section. + * scripttempl/elfarcv2.sc: Likewise. + * testsuite/ld-arc/arc.exp: Add JLI test. + * testsuite/ld-arc/jli-script.ld: New file. + * testsuite/ld-arc/jli-simple.dd: Likewise. + * testsuite/ld-arc/jli-simple.rd: Likewise. + * testsuite/ld-arc/jli-simple.s: Likewise. + * testsuite/ld-arc/jli-overflow.s: Likewise. + * testsuite/ld-arc/jli-overflow.d: Likewise. + * testsuite/ld-arc/jli-overflow.err: Likewise. + 2017-07-19 Tristan Gingold * ldmain.c (main): Remove display of data size. diff --git a/ld/emulparams/arcelf.sh b/ld/emulparams/arcelf.sh index 9b52e2c81d7..21c5c82d4cc 100644 --- a/ld/emulparams/arcelf.sh +++ b/ld/emulparams/arcelf.sh @@ -16,6 +16,7 @@ ARCH=arc MACHINE= ENTRY=__start SDATA_START_SYMBOLS='__SDATA_BEGIN__ = . + 0x100;' +JLI_START_TABLE='__JLI_TABLE__ = .;' OTHER_SECTIONS="/DISCARD/ : { *(.__arc_profile_*) }" EMBEDDED=yes diff --git a/ld/emulparams/arcv2elf.sh b/ld/emulparams/arcv2elf.sh index e21882b159c..feedbe8980c 100644 --- a/ld/emulparams/arcv2elf.sh +++ b/ld/emulparams/arcv2elf.sh @@ -22,5 +22,6 @@ LITTLE_OUTPUT_FORMAT="elf32-littlearc" BIG_OUTPUT_FORMAT="elf32-bigarc" TEXT_START_ADDR=0x100 ENTRY=__start -SDATA_START_SYMBOLS='__SDATA_BEGIN__ = .;' +SDATA_START_SYMBOLS='__SDATA_BEGIN__ = . + 0x100;' +JLI_START_TABLE='__JLI_TABLE__ = .;' OTHER_SECTIONS="/DISCARD/ : { *(.__arc_profile_*) }" diff --git a/ld/emulparams/arcv2elfx.sh b/ld/emulparams/arcv2elfx.sh index 7a4f28414c4..8a56509a02c 100644 --- a/ld/emulparams/arcv2elfx.sh +++ b/ld/emulparams/arcv2elfx.sh @@ -18,6 +18,7 @@ LITTLE_OUTPUT_FORMAT="elf32-littlearc" BIG_OUTPUT_FORMAT="elf32-bigarc" TEXT_START_ADDR=0x100 ENTRY=__start -SDATA_START_SYMBOLS='__SDATA_BEGIN__ = .;' +SDATA_START_SYMBOLS='__SDATA_BEGIN__ = . + 0x100;' +JLI_START_TABLE='__JLI_TABLE__ = .;' OTHER_SECTIONS="/DISCARD/ : { *(.__arc_profile_*) }" EMBEDDED=yes diff --git a/ld/scripttempl/elfarc.sc b/ld/scripttempl/elfarc.sc index 6754c028c51..4d8fef0c19b 100644 --- a/ld/scripttempl/elfarc.sc +++ b/ld/scripttempl/elfarc.sc @@ -262,6 +262,12 @@ cat < ${TEXT_MEMORY}} .gcc_except_table : { *(.gcc_except_table) *(.gcc_except_table.*) } ${RELOCATING+> ${TEXT_MEMORY}} .plt : { *(.plt) } ${RELOCATING+> ${TEXT_MEMORY}} + .jlitab : + { + ${RELOCATING+${JLI_START_TABLE}} + jlitab*.o:(.jlitab*) *(.jlitab*) + } ${RELOCATING+> ${TEXT_MEMORY}} .rodata ${RELOCATING-0} : { diff --git a/ld/testsuite/ld-arc/arc.exp b/ld/testsuite/ld-arc/arc.exp index 2f2abe2e848..66f39cdb9cf 100644 --- a/ld/testsuite/ld-arc/arc.exp +++ b/ld/testsuite/ld-arc/arc.exp @@ -40,6 +40,11 @@ set arccommon_tests { {tls-dtpoff.s} {{objdump -fdw tls-dtpoff.dd} {readelf --relocs tls-dtpoff.rd}} "sda-relocs.so" } + { "JLI simple" + "-q -T jli-script.ld -A elf32-arclittle" "" "-mcpu=em4 -EL" + {jli-simple.s} + {{objdump -fdw jli-simple.dd} {readelf --relocs jli-simple.rd}} + "jli-simple.so" } } run_ld_link_tests $arccommon_tests diff --git a/ld/testsuite/ld-arc/jli-overflow.d b/ld/testsuite/ld-arc/jli-overflow.d new file mode 100644 index 00000000000..b1a2663798e --- /dev/null +++ b/ld/testsuite/ld-arc/jli-overflow.d @@ -0,0 +1,4 @@ +#source: jli-overflow.s +#as: +#ld: -q -T jli-script.ld +#error_output: jli-overflow.err diff --git a/ld/testsuite/ld-arc/jli-overflow.err b/ld/testsuite/ld-arc/jli-overflow.err new file mode 100644 index 00000000000..022434e408a --- /dev/null +++ b/ld/testsuite/ld-arc/jli-overflow.err @@ -0,0 +1,3 @@ +.*\.o: In function `test_1025': +.*: relocation truncated to fit: R_ARC_JLI_SECTOFF against symbol.* +#... diff --git a/ld/testsuite/ld-arc/jli-overflow.s b/ld/testsuite/ld-arc/jli-overflow.s new file mode 100644 index 00000000000..7961cc99bbc --- /dev/null +++ b/ld/testsuite/ld-arc/jli-overflow.s @@ -0,0 +1,1050 @@ +;;;Macro + .macro jlifunc num + .section .text + .align 4 + .global func\num + .type func\num, @function +func\num: + j_s.d [blink] + add_s r0,r0,1 + .size func\num, .-func\num + .align 4 + .global test_\num + .type test_\num, @function +test_\num: + jli_s @__jli.func\num + j_s [blink] + .size test_\num, .-test_\num + .section .jlitab, "axG", @progbits, .jlitab.func\num, comdat + .align 4 +__jli.func\num: + .weak __jli.func\num + b @func\num + .endm + + .cpu HS + jlifunc 1 + jlifunc 2 + jlifunc 3 + jlifunc 4 + jlifunc 5 + jlifunc 6 + jlifunc 7 + jlifunc 8 + jlifunc 9 + jlifunc 10 + jlifunc 11 + jlifunc 12 + jlifunc 13 + jlifunc 14 + jlifunc 15 + jlifunc 16 + jlifunc 17 + jlifunc 18 + jlifunc 19 + jlifunc 20 + jlifunc 21 + jlifunc 22 + jlifunc 23 + jlifunc 24 + jlifunc 25 + jlifunc 26 + jlifunc 27 + jlifunc 28 + jlifunc 29 + jlifunc 30 + jlifunc 31 + jlifunc 32 + jlifunc 33 + jlifunc 34 + jlifunc 35 + jlifunc 36 + jlifunc 37 + jlifunc 38 + jlifunc 39 + jlifunc 40 + jlifunc 41 + jlifunc 42 + jlifunc 43 + jlifunc 44 + jlifunc 45 + jlifunc 46 + jlifunc 47 + jlifunc 48 + jlifunc 49 + jlifunc 50 + jlifunc 51 + jlifunc 52 + jlifunc 53 + jlifunc 54 + jlifunc 55 + jlifunc 56 + jlifunc 57 + jlifunc 58 + jlifunc 59 + jlifunc 60 + jlifunc 61 + jlifunc 62 + jlifunc 63 + jlifunc 64 + jlifunc 65 + jlifunc 66 + jlifunc 67 + jlifunc 68 + jlifunc 69 + jlifunc 70 + jlifunc 71 + jlifunc 72 + jlifunc 73 + jlifunc 74 + jlifunc 75 + jlifunc 76 + jlifunc 77 + jlifunc 78 + jlifunc 79 + jlifunc 80 + jlifunc 81 + jlifunc 82 + jlifunc 83 + jlifunc 84 + jlifunc 85 + jlifunc 86 + jlifunc 87 + jlifunc 88 + jlifunc 89 + jlifunc 90 + jlifunc 91 + jlifunc 92 + jlifunc 93 + jlifunc 94 + jlifunc 95 + jlifunc 96 + jlifunc 97 + jlifunc 98 + jlifunc 99 + jlifunc 100 + jlifunc 101 + jlifunc 102 + jlifunc 103 + jlifunc 104 + jlifunc 105 + jlifunc 106 + jlifunc 107 + jlifunc 108 + jlifunc 109 + jlifunc 110 + jlifunc 111 + jlifunc 112 + jlifunc 113 + jlifunc 114 + jlifunc 115 + jlifunc 116 + jlifunc 117 + jlifunc 118 + jlifunc 119 + jlifunc 120 + jlifunc 121 + jlifunc 122 + jlifunc 123 + jlifunc 124 + jlifunc 125 + jlifunc 126 + jlifunc 127 + jlifunc 128 + jlifunc 129 + jlifunc 130 + jlifunc 131 + jlifunc 132 + jlifunc 133 + jlifunc 134 + jlifunc 135 + jlifunc 136 + jlifunc 137 + jlifunc 138 + jlifunc 139 + jlifunc 140 + jlifunc 141 + jlifunc 142 + jlifunc 143 + jlifunc 144 + jlifunc 145 + jlifunc 146 + jlifunc 147 + jlifunc 148 + jlifunc 149 + jlifunc 150 + jlifunc 151 + jlifunc 152 + jlifunc 153 + jlifunc 154 + jlifunc 155 + jlifunc 156 + jlifunc 157 + jlifunc 158 + jlifunc 159 + jlifunc 160 + jlifunc 161 + jlifunc 162 + jlifunc 163 + jlifunc 164 + jlifunc 165 + jlifunc 166 + jlifunc 167 + jlifunc 168 + jlifunc 169 + jlifunc 170 + jlifunc 171 + jlifunc 172 + jlifunc 173 + jlifunc 174 + jlifunc 175 + jlifunc 176 + jlifunc 177 + jlifunc 178 + jlifunc 179 + jlifunc 180 + jlifunc 181 + jlifunc 182 + jlifunc 183 + jlifunc 184 + jlifunc 185 + jlifunc 186 + jlifunc 187 + jlifunc 188 + jlifunc 189 + jlifunc 190 + jlifunc 191 + jlifunc 192 + jlifunc 193 + jlifunc 194 + jlifunc 195 + jlifunc 196 + jlifunc 197 + jlifunc 198 + jlifunc 199 + jlifunc 200 + jlifunc 201 + jlifunc 202 + jlifunc 203 + jlifunc 204 + jlifunc 205 + jlifunc 206 + jlifunc 207 + jlifunc 208 + jlifunc 209 + jlifunc 210 + jlifunc 211 + jlifunc 212 + jlifunc 213 + jlifunc 214 + jlifunc 215 + jlifunc 216 + jlifunc 217 + jlifunc 218 + jlifunc 219 + jlifunc 220 + jlifunc 221 + jlifunc 222 + jlifunc 223 + jlifunc 224 + jlifunc 225 + jlifunc 226 + jlifunc 227 + jlifunc 228 + jlifunc 229 + jlifunc 230 + jlifunc 231 + jlifunc 232 + jlifunc 233 + jlifunc 234 + jlifunc 235 + jlifunc 236 + jlifunc 237 + jlifunc 238 + jlifunc 239 + jlifunc 240 + jlifunc 241 + jlifunc 242 + jlifunc 243 + jlifunc 244 + jlifunc 245 + jlifunc 246 + jlifunc 247 + jlifunc 248 + jlifunc 249 + jlifunc 250 + jlifunc 251 + jlifunc 252 + jlifunc 253 + jlifunc 254 + jlifunc 255 + jlifunc 256 + jlifunc 257 + jlifunc 258 + jlifunc 259 + jlifunc 260 + jlifunc 261 + jlifunc 262 + jlifunc 263 + jlifunc 264 + jlifunc 265 + jlifunc 266 + jlifunc 267 + jlifunc 268 + jlifunc 269 + jlifunc 270 + jlifunc 271 + jlifunc 272 + jlifunc 273 + jlifunc 274 + jlifunc 275 + jlifunc 276 + jlifunc 277 + jlifunc 278 + jlifunc 279 + jlifunc 280 + jlifunc 281 + jlifunc 282 + jlifunc 283 + jlifunc 284 + jlifunc 285 + jlifunc 286 + jlifunc 287 + jlifunc 288 + jlifunc 289 + jlifunc 290 + jlifunc 291 + jlifunc 292 + jlifunc 293 + jlifunc 294 + jlifunc 295 + jlifunc 296 + jlifunc 297 + jlifunc 298 + jlifunc 299 + jlifunc 300 + jlifunc 301 + jlifunc 302 + jlifunc 303 + jlifunc 304 + jlifunc 305 + jlifunc 306 + jlifunc 307 + jlifunc 308 + jlifunc 309 + jlifunc 310 + jlifunc 311 + jlifunc 312 + jlifunc 313 + jlifunc 314 + jlifunc 315 + jlifunc 316 + jlifunc 317 + jlifunc 318 + jlifunc 319 + jlifunc 320 + jlifunc 321 + jlifunc 322 + jlifunc 323 + jlifunc 324 + jlifunc 325 + jlifunc 326 + jlifunc 327 + jlifunc 328 + jlifunc 329 + jlifunc 330 + jlifunc 331 + jlifunc 332 + jlifunc 333 + jlifunc 334 + jlifunc 335 + jlifunc 336 + jlifunc 337 + jlifunc 338 + jlifunc 339 + jlifunc 340 + jlifunc 341 + jlifunc 342 + jlifunc 343 + jlifunc 344 + jlifunc 345 + jlifunc 346 + jlifunc 347 + jlifunc 348 + jlifunc 349 + jlifunc 350 + jlifunc 351 + jlifunc 352 + jlifunc 353 + jlifunc 354 + jlifunc 355 + jlifunc 356 + jlifunc 357 + jlifunc 358 + jlifunc 359 + jlifunc 360 + jlifunc 361 + jlifunc 362 + jlifunc 363 + jlifunc 364 + jlifunc 365 + jlifunc 366 + jlifunc 367 + jlifunc 368 + jlifunc 369 + jlifunc 370 + jlifunc 371 + jlifunc 372 + jlifunc 373 + jlifunc 374 + jlifunc 375 + jlifunc 376 + jlifunc 377 + jlifunc 378 + jlifunc 379 + jlifunc 380 + jlifunc 381 + jlifunc 382 + jlifunc 383 + jlifunc 384 + jlifunc 385 + jlifunc 386 + jlifunc 387 + jlifunc 388 + jlifunc 389 + jlifunc 390 + jlifunc 391 + jlifunc 392 + jlifunc 393 + jlifunc 394 + jlifunc 395 + jlifunc 396 + jlifunc 397 + jlifunc 398 + jlifunc 399 + jlifunc 400 + jlifunc 401 + jlifunc 402 + jlifunc 403 + jlifunc 404 + jlifunc 405 + jlifunc 406 + jlifunc 407 + jlifunc 408 + jlifunc 409 + jlifunc 410 + jlifunc 411 + jlifunc 412 + jlifunc 413 + jlifunc 414 + jlifunc 415 + jlifunc 416 + jlifunc 417 + jlifunc 418 + jlifunc 419 + jlifunc 420 + jlifunc 421 + jlifunc 422 + jlifunc 423 + jlifunc 424 + jlifunc 425 + jlifunc 426 + jlifunc 427 + jlifunc 428 + jlifunc 429 + jlifunc 430 + jlifunc 431 + jlifunc 432 + jlifunc 433 + jlifunc 434 + jlifunc 435 + jlifunc 436 + jlifunc 437 + jlifunc 438 + jlifunc 439 + jlifunc 440 + jlifunc 441 + jlifunc 442 + jlifunc 443 + jlifunc 444 + jlifunc 445 + jlifunc 446 + jlifunc 447 + jlifunc 448 + jlifunc 449 + jlifunc 450 + jlifunc 451 + jlifunc 452 + jlifunc 453 + jlifunc 454 + jlifunc 455 + jlifunc 456 + jlifunc 457 + jlifunc 458 + jlifunc 459 + jlifunc 460 + jlifunc 461 + jlifunc 462 + jlifunc 463 + jlifunc 464 + jlifunc 465 + jlifunc 466 + jlifunc 467 + jlifunc 468 + jlifunc 469 + jlifunc 470 + jlifunc 471 + jlifunc 472 + jlifunc 473 + jlifunc 474 + jlifunc 475 + jlifunc 476 + jlifunc 477 + jlifunc 478 + jlifunc 479 + jlifunc 480 + jlifunc 481 + jlifunc 482 + jlifunc 483 + jlifunc 484 + jlifunc 485 + jlifunc 486 + jlifunc 487 + jlifunc 488 + jlifunc 489 + jlifunc 490 + jlifunc 491 + jlifunc 492 + jlifunc 493 + jlifunc 494 + jlifunc 495 + jlifunc 496 + jlifunc 497 + jlifunc 498 + jlifunc 499 + jlifunc 500 + jlifunc 501 + jlifunc 502 + jlifunc 503 + jlifunc 504 + jlifunc 505 + jlifunc 506 + jlifunc 507 + jlifunc 508 + jlifunc 509 + jlifunc 510 + jlifunc 511 + jlifunc 512 + jlifunc 513 + jlifunc 514 + jlifunc 515 + jlifunc 516 + jlifunc 517 + jlifunc 518 + jlifunc 519 + jlifunc 520 + jlifunc 521 + jlifunc 522 + jlifunc 523 + jlifunc 524 + jlifunc 525 + jlifunc 526 + jlifunc 527 + jlifunc 528 + jlifunc 529 + jlifunc 530 + jlifunc 531 + jlifunc 532 + jlifunc 533 + jlifunc 534 + jlifunc 535 + jlifunc 536 + jlifunc 537 + jlifunc 538 + jlifunc 539 + jlifunc 540 + jlifunc 541 + jlifunc 542 + jlifunc 543 + jlifunc 544 + jlifunc 545 + jlifunc 546 + jlifunc 547 + jlifunc 548 + jlifunc 549 + jlifunc 550 + jlifunc 551 + jlifunc 552 + jlifunc 553 + jlifunc 554 + jlifunc 555 + jlifunc 556 + jlifunc 557 + jlifunc 558 + jlifunc 559 + jlifunc 560 + jlifunc 561 + jlifunc 562 + jlifunc 563 + jlifunc 564 + jlifunc 565 + jlifunc 566 + jlifunc 567 + jlifunc 568 + jlifunc 569 + jlifunc 570 + jlifunc 571 + jlifunc 572 + jlifunc 573 + jlifunc 574 + jlifunc 575 + jlifunc 576 + jlifunc 577 + jlifunc 578 + jlifunc 579 + jlifunc 580 + jlifunc 581 + jlifunc 582 + jlifunc 583 + jlifunc 584 + jlifunc 585 + jlifunc 586 + jlifunc 587 + jlifunc 588 + jlifunc 589 + jlifunc 590 + jlifunc 591 + jlifunc 592 + jlifunc 593 + jlifunc 594 + jlifunc 595 + jlifunc 596 + jlifunc 597 + jlifunc 598 + jlifunc 599 + jlifunc 600 + jlifunc 601 + jlifunc 602 + jlifunc 603 + jlifunc 604 + jlifunc 605 + jlifunc 606 + jlifunc 607 + jlifunc 608 + jlifunc 609 + jlifunc 610 + jlifunc 611 + jlifunc 612 + jlifunc 613 + jlifunc 614 + jlifunc 615 + jlifunc 616 + jlifunc 617 + jlifunc 618 + jlifunc 619 + jlifunc 620 + jlifunc 621 + jlifunc 622 + jlifunc 623 + jlifunc 624 + jlifunc 625 + jlifunc 626 + jlifunc 627 + jlifunc 628 + jlifunc 629 + jlifunc 630 + jlifunc 631 + jlifunc 632 + jlifunc 633 + jlifunc 634 + jlifunc 635 + jlifunc 636 + jlifunc 637 + jlifunc 638 + jlifunc 639 + jlifunc 640 + jlifunc 641 + jlifunc 642 + jlifunc 643 + jlifunc 644 + jlifunc 645 + jlifunc 646 + jlifunc 647 + jlifunc 648 + jlifunc 649 + jlifunc 650 + jlifunc 651 + jlifunc 652 + jlifunc 653 + jlifunc 654 + jlifunc 655 + jlifunc 656 + jlifunc 657 + jlifunc 658 + jlifunc 659 + jlifunc 660 + jlifunc 661 + jlifunc 662 + jlifunc 663 + jlifunc 664 + jlifunc 665 + jlifunc 666 + jlifunc 667 + jlifunc 668 + jlifunc 669 + jlifunc 670 + jlifunc 671 + jlifunc 672 + jlifunc 673 + jlifunc 674 + jlifunc 675 + jlifunc 676 + jlifunc 677 + jlifunc 678 + jlifunc 679 + jlifunc 680 + jlifunc 681 + jlifunc 682 + jlifunc 683 + jlifunc 684 + jlifunc 685 + jlifunc 686 + jlifunc 687 + jlifunc 688 + jlifunc 689 + jlifunc 690 + jlifunc 691 + jlifunc 692 + jlifunc 693 + jlifunc 694 + jlifunc 695 + jlifunc 696 + jlifunc 697 + jlifunc 698 + jlifunc 699 + jlifunc 700 + jlifunc 701 + jlifunc 702 + jlifunc 703 + jlifunc 704 + jlifunc 705 + jlifunc 706 + jlifunc 707 + jlifunc 708 + jlifunc 709 + jlifunc 710 + jlifunc 711 + jlifunc 712 + jlifunc 713 + jlifunc 714 + jlifunc 715 + jlifunc 716 + jlifunc 717 + jlifunc 718 + jlifunc 719 + jlifunc 720 + jlifunc 721 + jlifunc 722 + jlifunc 723 + jlifunc 724 + jlifunc 725 + jlifunc 726 + jlifunc 727 + jlifunc 728 + jlifunc 729 + jlifunc 730 + jlifunc 731 + jlifunc 732 + jlifunc 733 + jlifunc 734 + jlifunc 735 + jlifunc 736 + jlifunc 737 + jlifunc 738 + jlifunc 739 + jlifunc 740 + jlifunc 741 + jlifunc 742 + jlifunc 743 + jlifunc 744 + jlifunc 745 + jlifunc 746 + jlifunc 747 + jlifunc 748 + jlifunc 749 + jlifunc 750 + jlifunc 751 + jlifunc 752 + jlifunc 753 + jlifunc 754 + jlifunc 755 + jlifunc 756 + jlifunc 757 + jlifunc 758 + jlifunc 759 + jlifunc 760 + jlifunc 761 + jlifunc 762 + jlifunc 763 + jlifunc 764 + jlifunc 765 + jlifunc 766 + jlifunc 767 + jlifunc 768 + jlifunc 769 + jlifunc 770 + jlifunc 771 + jlifunc 772 + jlifunc 773 + jlifunc 774 + jlifunc 775 + jlifunc 776 + jlifunc 777 + jlifunc 778 + jlifunc 779 + jlifunc 780 + jlifunc 781 + jlifunc 782 + jlifunc 783 + jlifunc 784 + jlifunc 785 + jlifunc 786 + jlifunc 787 + jlifunc 788 + jlifunc 789 + jlifunc 790 + jlifunc 791 + jlifunc 792 + jlifunc 793 + jlifunc 794 + jlifunc 795 + jlifunc 796 + jlifunc 797 + jlifunc 798 + jlifunc 799 + jlifunc 800 + jlifunc 801 + jlifunc 802 + jlifunc 803 + jlifunc 804 + jlifunc 805 + jlifunc 806 + jlifunc 807 + jlifunc 808 + jlifunc 809 + jlifunc 810 + jlifunc 811 + jlifunc 812 + jlifunc 813 + jlifunc 814 + jlifunc 815 + jlifunc 816 + jlifunc 817 + jlifunc 818 + jlifunc 819 + jlifunc 820 + jlifunc 821 + jlifunc 822 + jlifunc 823 + jlifunc 824 + jlifunc 825 + jlifunc 826 + jlifunc 827 + jlifunc 828 + jlifunc 829 + jlifunc 830 + jlifunc 831 + jlifunc 832 + jlifunc 833 + jlifunc 834 + jlifunc 835 + jlifunc 836 + jlifunc 837 + jlifunc 838 + jlifunc 839 + jlifunc 840 + jlifunc 841 + jlifunc 842 + jlifunc 843 + jlifunc 844 + jlifunc 845 + jlifunc 846 + jlifunc 847 + jlifunc 848 + jlifunc 849 + jlifunc 850 + jlifunc 851 + jlifunc 852 + jlifunc 853 + jlifunc 854 + jlifunc 855 + jlifunc 856 + jlifunc 857 + jlifunc 858 + jlifunc 859 + jlifunc 860 + jlifunc 861 + jlifunc 862 + jlifunc 863 + jlifunc 864 + jlifunc 865 + jlifunc 866 + jlifunc 867 + jlifunc 868 + jlifunc 869 + jlifunc 870 + jlifunc 871 + jlifunc 872 + jlifunc 873 + jlifunc 874 + jlifunc 875 + jlifunc 876 + jlifunc 877 + jlifunc 878 + jlifunc 879 + jlifunc 880 + jlifunc 881 + jlifunc 882 + jlifunc 883 + jlifunc 884 + jlifunc 885 + jlifunc 886 + jlifunc 887 + jlifunc 888 + jlifunc 889 + jlifunc 890 + jlifunc 891 + jlifunc 892 + jlifunc 893 + jlifunc 894 + jlifunc 895 + jlifunc 896 + jlifunc 897 + jlifunc 898 + jlifunc 899 + jlifunc 900 + jlifunc 901 + jlifunc 902 + jlifunc 903 + jlifunc 904 + jlifunc 905 + jlifunc 906 + jlifunc 907 + jlifunc 908 + jlifunc 909 + jlifunc 910 + jlifunc 911 + jlifunc 912 + jlifunc 913 + jlifunc 914 + jlifunc 915 + jlifunc 916 + jlifunc 917 + jlifunc 918 + jlifunc 919 + jlifunc 920 + jlifunc 921 + jlifunc 922 + jlifunc 923 + jlifunc 924 + jlifunc 925 + jlifunc 926 + jlifunc 927 + jlifunc 928 + jlifunc 929 + jlifunc 930 + jlifunc 931 + jlifunc 932 + jlifunc 933 + jlifunc 934 + jlifunc 935 + jlifunc 936 + jlifunc 937 + jlifunc 938 + jlifunc 939 + jlifunc 940 + jlifunc 941 + jlifunc 942 + jlifunc 943 + jlifunc 944 + jlifunc 945 + jlifunc 946 + jlifunc 947 + jlifunc 948 + jlifunc 949 + jlifunc 950 + jlifunc 951 + jlifunc 952 + jlifunc 953 + jlifunc 954 + jlifunc 955 + jlifunc 956 + jlifunc 957 + jlifunc 958 + jlifunc 959 + jlifunc 960 + jlifunc 961 + jlifunc 962 + jlifunc 963 + jlifunc 964 + jlifunc 965 + jlifunc 966 + jlifunc 967 + jlifunc 968 + jlifunc 969 + jlifunc 970 + jlifunc 971 + jlifunc 972 + jlifunc 973 + jlifunc 974 + jlifunc 975 + jlifunc 976 + jlifunc 977 + jlifunc 978 + jlifunc 979 + jlifunc 980 + jlifunc 981 + jlifunc 982 + jlifunc 983 + jlifunc 984 + jlifunc 985 + jlifunc 986 + jlifunc 987 + jlifunc 988 + jlifunc 989 + jlifunc 990 + jlifunc 991 + jlifunc 992 + jlifunc 993 + jlifunc 994 + jlifunc 995 + jlifunc 996 + jlifunc 997 + jlifunc 998 + jlifunc 999 + jlifunc 1000 + jlifunc 1001 + jlifunc 1002 + jlifunc 1003 + jlifunc 1004 + jlifunc 1005 + jlifunc 1006 + jlifunc 1007 + jlifunc 1008 + jlifunc 1009 + jlifunc 1010 + jlifunc 1011 + jlifunc 1012 + jlifunc 1013 + jlifunc 1014 + jlifunc 1015 + jlifunc 1016 + jlifunc 1017 + jlifunc 1018 + jlifunc 1019 + jlifunc 1020 + jlifunc 1021 + jlifunc 1022 + jlifunc 1023 + jlifunc 1024 + jlifunc 1025 diff --git a/ld/testsuite/ld-arc/jli-script.ld b/ld/testsuite/ld-arc/jli-script.ld new file mode 100644 index 00000000000..fdb9e902e58 --- /dev/null +++ b/ld/testsuite/ld-arc/jli-script.ld @@ -0,0 +1,20 @@ +/* Default linker script, for normal executables. */ +OUTPUT_FORMAT("elf32-littlearc", "elf32-bigarc", + "elf32-littlearc") + +OUTPUT_ARCH(arc) +ENTRY(__start) + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + PROVIDE (__start = 0x10000); + . = 0x10000 + SIZEOF_HEADERS; + + .text : {*(.text .stub .text.*)} =0 + .jlitab : {jlitab*.o(.jlitab*) *(.jlitab*) } + .tdata : {.tdata = .; *(.tdata .tdata.* .gnu.linkonce.td.*) } + .tbss : {.tbss = .; *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } + + /DISCARD/ : { *(.note.GNU-stack) } +} diff --git a/ld/testsuite/ld-arc/jli-simple.dd b/ld/testsuite/ld-arc/jli-simple.dd new file mode 100644 index 00000000000..cea0194728e --- /dev/null +++ b/ld/testsuite/ld-arc/jli-simple.dd @@ -0,0 +1,26 @@ + +.*: file format .* +architecture: ARCv2, flags 0x00000113: +HAS_RELOC, EXEC_P, HAS_SYMS, D_PAGED +start address 0x00010000 + + +Disassembly of section .text: + +00010054 : + 10054: 5800 jli_s 0 + 10056: 5801 jli_s 0x1 + +00010058 : + 10058: 2000 0000 add r0,r0,r0 + +0001005c : + 1005c: 2100 0080 add r0,r1,r2 + +Disassembly of section .jlitab: + +00010060 <__jli.foo>: + 10060: 07f9 ffcf b 10058 + +00010064 <__jli.bar>: + 10064: 07f9 ffcf b 1005c diff --git a/ld/testsuite/ld-arc/jli-simple.rd b/ld/testsuite/ld-arc/jli-simple.rd new file mode 100644 index 00000000000..13b85bb4da8 --- /dev/null +++ b/ld/testsuite/ld-arc/jli-simple.rd @@ -0,0 +1,10 @@ + +Relocation section '\.rela\.text' .*: + Offset +Info +Type +Sym.Value +Sym. Name \+ Addend +00010054 [0-9a-f]+ R_ARC_JLI_SECTOFF 00010060 __jli\.foo \+ 0 +00010056 [0-9a-f]+ R_ARC_JLI_SECTOFF 00010064 __jli\.bar \+ 0 + +Relocation section '\.rela\.jlitab' .*: + Offset +Info +Type +Sym.Value +Sym. Name \+ Addend +00010060 [0-9a-f]+ R_ARC_S25H_PCREL 00010054 .text \+ 4 +00010064 [0-9a-f]+ R_ARC_S25H_PCREL 00010054 .text \+ 8 diff --git a/ld/testsuite/ld-arc/jli-simple.s b/ld/testsuite/ld-arc/jli-simple.s new file mode 100644 index 00000000000..660fa05e399 --- /dev/null +++ b/ld/testsuite/ld-arc/jli-simple.s @@ -0,0 +1,24 @@ + .cpu em4 + .text + .align 4 +test: + jli_s __jli.foo + jli_s __jli.bar + + .align 4 +foo: + add r0,r0,r0 + + .align 4 +bar: + add r0,r1,r2 + + .section .jlitab,"axG",%progbits,jli_group,comdat + .align 4 +__jli.foo: + .weak __jli.foo + b @foo + .align 4 +__jli.bar: + .weak __jli.bar + b @bar diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index c01397492ac..e7890035125 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,11 @@ +2017-07-19 Claudiu Zissulescu + John Eric Martin + + * arc-opc.c (UIMM10_6_S_JLIOFF): Define. + (UIMM3_23): Adjust accordingly. + * arc-regs.h: Add/correct jli_base register. + * arc-tbl.h (jli_s): Likewise. + 2017-07-18 Nick Clifton PR 21775 diff --git a/opcodes/arc-opc.c b/opcodes/arc-opc.c index c266f4f1ac9..7f934ce5b5d 100644 --- a/opcodes/arc-opc.c +++ b/opcodes/arc-opc.c @@ -2039,8 +2039,14 @@ const struct arc_operand arc_operands[] = | ARC_OPERAND_TRUNCATE | ARC_OPERAND_PCREL, insert_simm8_a16_9_s, extract_simm8_a16_9_s}, +/* UIMM10_6_S_JLIOFF mask = 0000001111111111. */ +#define UIMM10_6_S_JLIOFF (SIMM8_A16_9_S + 1) + {12, 0, BFD_RELOC_ARC_JLI_SECTOFF, ARC_OPERAND_UNSIGNED + | ARC_OPERAND_ALIGNED32 | ARC_OPERAND_TRUNCATE, insert_uimm10_6_s, + extract_uimm10_6_s}, + /* UIMM3_23 mask = 00000000000000000000000111000000. */ -#define UIMM3_23 (SIMM8_A16_9_S + 1) +#define UIMM3_23 (UIMM10_6_S_JLIOFF + 1) {3, 0, 0, ARC_OPERAND_UNSIGNED, insert_uimm3_23, extract_uimm3_23}, /* UIMM10_6_S mask = 0000001111111111. */ diff --git a/opcodes/arc-regs.h b/opcodes/arc-regs.h index 0bdbd92a949..99c39a4d263 100644 --- a/opcodes/arc-regs.h +++ b/opcodes/arc-regs.h @@ -69,7 +69,6 @@ DEF (0x23, ARC_OPCODE_ARCALL, NONE, limit0) DEF (0x24, ARC_OPCODE_ARCALL, NONE, pcport) DEF (0x25, ARC_OPCODE_ARCALL, NONE, int_vector_base) DEF (0x26, ARC_OPCODE_ARCALL, NONE, aux_vbfdw_mode) -DEF (0x26, ARC_OPCODE_ARCALL, NONE, jli_base) DEF (0x27, ARC_OPCODE_ARCALL, NONE, aux_vbfdw_bm0) DEF (0x28, ARC_OPCODE_ARCALL, NONE, aux_vbfdw_bm1) DEF (0x29, ARC_OPCODE_ARCALL, NONE, aux_vbfdw_accu) @@ -261,6 +260,7 @@ DEF (0x236, ARC_OPCODE_ARCALL, NONE, ap_amm7) DEF (0x237, ARC_OPCODE_ARCALL, NONE, ap_ac7) DEF (0x278, ARC_OPCODE_ARCALL, NONE, pct_control) DEF (0x279, ARC_OPCODE_ARCALL, NONE, pct_bank) +DEF (0x290, ARC_OPCODE_ARCV2, NONE, jli_base) DEF (0x300, ARC_OPCODE_ARCFPX, DPX, fp_status) DEF (0x301, ARC_OPCODE_ARCFPX, DPX, aux_dpfp1l) DEF (0x301, ARC_OPCODE_ARCFPX, DPX, d1l) diff --git a/opcodes/arc-tbl.h b/opcodes/arc-tbl.h index 79e6b8989c5..07ff304acc8 100644 --- a/opcodes/arc-tbl.h +++ b/opcodes/arc-tbl.h @@ -7955,6 +7955,7 @@ /* jli_s u10 010110uuuuuuuuuu. */ { "jli_s", 0x00005800, 0x0000FC00, ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, JLI, CD1, { UIMM10_6_S }, { 0 }}, +{ "jli_s", 0x00005800, 0x0000FC00, ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, JLI, CD1, { UIMM10_6_S_JLIOFF }, { 0 }}, /* jl_s b 01111bbb01000000. */ { "jl_s", 0x00007840, 0x0000F8FF, ARC_OPCODE_ARC600 | ARC_OPCODE_ARC700, JUMP, NONE, { BRAKET, RB_S, BRAKETdup }, { 0 }}, -- 2.30.2