MIPS/gas: Retain ISA mode bit for labels with .insn annotation

gas/
	* config/tc-mips.c (mips_move_labels): Retain ISA mode bit
	when moving labels in text segments.
	(mips_align): Indicate text mode when aligning labels in
	text segments.
	* gas/testsuite/gas/mips/insn-isa-mode.d: New test.
	* gas/testsuite/gas/mips/insn-isa-mode.s: New test source.
	* gas/testsuite/gas/mips/mips.exp: Run the new test.
This commit is contained in:
Faraz Shahbazker 2019-08-05 23:38:46 +00:00
parent 7ce8f214f1
commit 770c015139
5 changed files with 45 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2019-08-19 Faraz Shahbazker <fshahbazker@wavecomp.com>
* config/tc-mips.c (mips_move_labels): Retain ISA mode bit
when moving labels in text segments.
(mips_align): Indicate text mode when aligning labels in
text segments.
* gas/testsuite/gas/mips/insn-isa-mode.d: New test.
* gas/testsuite/gas/mips/insn-isa-mode.s: New test source.
* gas/testsuite/gas/mips/mips.exp: Run the new test.
2019-08-19 Barnaby Wilks <Barnaby.Wilks@arm.com>
* config/tc-arm.c (md_atof): Add precision check. Formatting.

View File

@ -4441,9 +4441,10 @@ mips_move_labels (struct insn_label_list *labels, bfd_boolean text_p)
gas_assert (S_GET_SEGMENT (l->label) == now_seg);
symbol_set_frag (l->label, frag_now);
val = (valueT) frag_now_fix ();
/* MIPS16/microMIPS text labels are stored as odd. */
/* MIPS16/microMIPS text labels are stored as odd.
We just carry the ISA mode bit forward. */
if (text_p && HAVE_CODE_COMPRESSION)
++val;
val |= (S_GET_VALUE (l->label) & 0x1);
S_SET_VALUE (l->label, val);
}
}
@ -16218,7 +16219,7 @@ mips_align (int to, int *fill, struct insn_label_list *labels)
else
frag_align (to, fill ? *fill : 0, 0);
record_alignment (now_seg, to);
mips_move_labels (labels, FALSE);
mips_move_labels (labels, subseg_text_p (now_seg));
}
/* Align to a given power of two. .align 0 turns off the automatic

View File

@ -0,0 +1,16 @@
#objdump: -dr --show-raw-insn
#name: microMIPS ISA mode for .insn label references
#as: -32
.*: +file format .*mips.*
Disassembly of section \.text:
00000000 <test1>:
0: 3c030000 lui v1,0x0
0: R_MIPS_HI16 \.text
4: 2463000b addiu v1,v1,11
4: R_MIPS_LO16 \.text
00000008 <test2>:
8: 0c00 nop
a: 0c00 nop
\.\.\.

View File

@ -0,0 +1,14 @@
.text
.set nomicromips
.globl test1
.type test1, @function
test1:
la $3,test2+2
.set micromips
test2:
.insn
.half 0x0c00
.half 0x0c00
# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
.align 4, 0
.space 16

View File

@ -2093,4 +2093,5 @@ if { [istarget mips*-*-vxworks*] } {
} else {
run_dump_test "pr14798"
}
run_dump_test "insn-isa-mode"
}