This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 1/2] MIPS/gas: Retain ISA mode bit for labels with .insn annotation
- From: Faraz Shahbazker <fshahbazker at wavecomp dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: Faraz Shahbazker <fshahbazker at wavecomp dot com>, Paul Hua <paul dot hua dot gm at gmail dot com>
- Date: Mon, 5 Aug 2019 23:38:46 +0000
- Subject: [PATCH 1/2] MIPS/gas: Retain ISA mode bit for labels with .insn annotation
- Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=wavecomp.com;dmarc=pass action=none header.from=wavecomp.com;dkim=pass header.d=wavecomp.com;arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z7cRdFdS0XYvsJYwoaG1yK52XnzZ5N59QrO5dJnPOxE=; b=EY81+kVBzCwvkmHbsecexDDpTuCLxTsv/8DPdepV44MJCRjh4dCYmgDYkOx9RNY7QU2F9xegJk41fU00D5RY5FYnFlxWXS4z1rvC0eNTWRs1NYIEvc+y6BgdUlyy8hstf/t2r0U9O0ivXZGXzu70M8Y4eGWvx28g9b3KKJu0IqFcVZm2rwm3zqsL6xQl3YgORm+EOyapQ+/fjI513Lx8NeYciOifrKw0Y0SgvBWX3fsUcQo7jeUZRA+yErrrCuQNgKbH9pPmyB+ai0qZ+BQDN7QoHFra0TESpMMbx20fHamaULwqffq3Mxh6ZMdxVYVjHcr0dJvlw8UjPtvlp1yG9Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C6NzypJ3E34yH57sl3xf2p6BiW7GwiMoxm+yI6OG3xdczCSgkGNujSLIOkTQ3gYBedI9VitZVWIBtKa+F+zmQN7O+apVEDK7gVYcB88GLplg7zBUaLu17hU7v8LLlRsXNc7RtEnQjhhbCgOzBoh5sv1qgn4GrHEJM/27J2iDiex5YWfHB2WRgBau5UMQCvYe0zWb2lfRK6n+/y35ZQqzGZcNw+AVEeHsDW7SfrqIyQMPu5Ohl/1Bp2zELc3WgfkFUCx+rPr15frSBq8ggCsaJOMkJvJBgKOWgSH/LlKdynN8UM6FekR84eiLfXYXnjvUxlSvtniybfHznHzsFihkNA==
- References: <20190805233847.183450-1-fshahbazker@wavecomp.com>
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.
---
gas/config/tc-mips.c | 7 ++++---
gas/testsuite/gas/mips/insn-isa-mode.d | 16 ++++++++++++++++
gas/testsuite/gas/mips/insn-isa-mode.s | 14 ++++++++++++++
gas/testsuite/gas/mips/mips.exp | 1 +
4 files changed, 35 insertions(+), 3 deletions(-)
create mode 100644 gas/testsuite/gas/mips/insn-isa-mode.d
create mode 100644 gas/testsuite/gas/mips/insn-isa-mode.s
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index b7b4b69..38a1b8c 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -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
diff --git a/gas/testsuite/gas/mips/insn-isa-mode.d b/gas/testsuite/gas/mips/insn-isa-mode.d
new file mode 100644
index 0000000..9d2c61b
--- /dev/null
+++ b/gas/testsuite/gas/mips/insn-isa-mode.d
@@ -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
+ \.\.\.
diff --git a/gas/testsuite/gas/mips/insn-isa-mode.s b/gas/testsuite/gas/mips/insn-isa-mode.s
new file mode 100644
index 0000000..ecc520f
--- /dev/null
+++ b/gas/testsuite/gas/mips/insn-isa-mode.s
@@ -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
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index eaeb488..2084ee0 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -2093,4 +2093,5 @@ if { [istarget mips*-*-vxworks*] } {
} else {
run_dump_test "pr14798"
}
+ run_dump_test "insn-isa-mode"
}
--
2.9.5