microMIPS/GAS: Handle several percent-ops with macros
authorMaciej W. Rozycki <macro@mips.com>
Mon, 2 Jul 2018 22:57:22 +0000 (23:57 +0100)
committerMaciej W. Rozycki <macro@mips.com>
Mon, 2 Jul 2018 22:57:22 +0000 (23:57 +0100)
commit14c80123c05ad7cbb52fbb5d35c08b46a0e72d7f
tree05ae0db5fadf35df413af1bf98a1a8dbc4d74e20
parent156f2c001e22dfeee69c92bdb380d5eb28a3de78
microMIPS/GAS: Handle several percent-ops with macros

In the microMIPS mode also accept %half, %got, %call, %got_hi, %got_lo,
%call_hi, %call_lo, %neg, %got_page, %highest, %got_disp, %tlsgd,
%tlsldm, %dtprel_hi, %dtprel_lo, %gottprel, %tprel_hi and %tprel_lo
percent-ops with macros, so that they can be used with instructions that
expand into sequences if relocation is required due to their limited
offset span, such as LL, LWL, etc., fixing GAS assertions:

.../gas/testsuite/gas/mips/elf-rel28.s: Assembler messages:
.../gas/testsuite/gas/mips/elf-rel28.s:17: Internal error in macro_build at .../gas/config/tc-mips.c:8854.
Please report this bug.

observed if an attempt is made to assemble the `elf-rel28.s' test case
modified to use one of the affected instructions to microMIPS code.

gas/
* config/tc-mips.c (macro_build) <'i', 'j'>: Also accept
BFD_RELOC_16, BFD_RELOC_MIPS_GOT16, BFD_RELOC_MIPS_CALL16,
BFD_RELOC_MIPS_GOT_HI16, BFD_RELOC_MIPS_GOT_LO16,
BFD_RELOC_MIPS_CALL_HI16, BFD_RELOC_MIPS_CALL_LO16,
BFD_RELOC_MIPS_SUB, BFD_RELOC_MIPS_GOT_PAGE,
BFD_RELOC_MIPS_HIGHEST, BFD_RELOC_MIPS_GOT_DISP,
BFD_RELOC_MIPS_TLS_GD, BFD_RELOC_MIPS_TLS_LDM,
BFD_RELOC_MIPS_TLS_DTPREL_HI16, BFD_RELOC_MIPS_TLS_DTPREL_LO16,
BFD_RELOC_MIPS_TLS_GOTTPREL, BFD_RELOC_MIPS_TLS_TPREL_HI16 and
BFD_RELOC_MIPS_TLS_TPREL_LO16 relocations if in the microMIPS
mode.
* testsuite/gas/mips/elf-rel28-lldscd-n32.d: New test.
* testsuite/gas/mips/elf-rel28-lldscd-micromips-n32.d: New test.
* testsuite/gas/mips/elf-rel28-lldscd-n64.d: New test.
* testsuite/gas/mips/elf-rel28-lldscd-micromips-n64.d: New test.
* testsuite/gas/mips/elf-rel28.s: Add instruction selection.
* testsuite/gas/mips/mips.exp: Run the new tests.
gas/ChangeLog
gas/config/tc-mips.c
gas/testsuite/gas/mips/elf-rel28-lldscd-micromips-n32.d [new file with mode: 0644]
gas/testsuite/gas/mips/elf-rel28-lldscd-micromips-n64.d [new file with mode: 0644]
gas/testsuite/gas/mips/elf-rel28-lldscd-n32.d [new file with mode: 0644]
gas/testsuite/gas/mips/elf-rel28-lldscd-n64.d [new file with mode: 0644]
gas/testsuite/gas/mips/elf-rel28.s
gas/testsuite/gas/mips/mips.exp