This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] Fix handling of labels for .(d)tprel(d)word


For code like:

label:
        .tprelword a
        .word b

the label would get moved forward to ".word b" by the automatic
alignment handling.  This was due to a missing mips_clear_insn_labels
when processing .tprelword.

Tested on mips64-linux-gnu.  Applied to mainline and 2.22 branch.

Richard


gas/
	* config/tc-mips.c (s_tls_rel_directive): Call mips_clear_insn_labels.

gas/testsuite/
	* gas/mips/tls-relw.s, gas/mips/tls-relw.d: New test.
	* gas/mips/mips.exp: Run it.

Index: gas/config/tc-mips.c
===================================================================
--- gas/config/tc-mips.c	2012-01-08 12:10:47.000000000 +0000
+++ gas/config/tc-mips.c	2012-01-08 12:19:03.000000000 +0000
@@ -16630,6 +16630,7 @@ s_tls_rel_directive (const size_t bytes,
   md_number_to_chars (p, 0, bytes);
   fix_new_exp (frag_now, p - frag_now->fr_literal, bytes, &ex, FALSE, rtype);
   demand_empty_rest_of_line ();
+  mips_clear_insn_labels ();
 }
 
 /* Handle .dtprelword.  */
Index: gas/testsuite/gas/mips/tls-relw.s
===================================================================
--- /dev/null	2012-01-08 08:41:25.262776686 +0000
+++ gas/testsuite/gas/mips/tls-relw.s	2012-01-08 12:20:17.000000000 +0000
@@ -0,0 +1,12 @@
+	.data
+start:
+	.word	1
+a:
+	.tprelword t1
+	.word	2
+	.word	a-start
+b:
+	.dtprelword t2
+	.word	3
+	.word	b-start
+	.word	0
Index: gas/testsuite/gas/mips/tls-relw.d
===================================================================
--- /dev/null	2012-01-08 08:41:25.262776686 +0000
+++ gas/testsuite/gas/mips/tls-relw.d	2012-01-08 12:20:51.000000000 +0000
@@ -0,0 +1,8 @@
+# as: -EB
+# objdump: -sj.data
+
+.*
+
+Contents of section \.data:
+ 0000 00000001 00000000 00000002 00000004  ................
+ 0010 00000000 00000003 00000010 00000000  ................
Index: gas/testsuite/gas/mips/mips.exp
===================================================================
--- gas/testsuite/gas/mips/mips.exp	2012-01-08 12:21:06.000000000 +0000
+++ gas/testsuite/gas/mips/mips.exp	2012-01-08 12:21:26.000000000 +0000
@@ -913,6 +913,7 @@ if { [istarget mips*-*-vxworks*] } {
 
 	run_list_test "tls-ill" "-32"
 	run_dump_test "tls-o32"
+	run_dump_test "tls-relw"
 	run_dump_test "jalr2"
 
 	run_dump_test_arches "aent"	[mips_arch_list_matching mips1]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]