This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Committed: fix for CRIS gas TLS-support
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: binutils at sourceware dot org
- Date: Wed, 19 Nov 2008 07:17:12 +0100
- Subject: Committed: fix for CRIS gas TLS-support
Noticed the moment I started trying to link stuff...
Committed.
gas:
* config/tc-cris.c (cris_number_to_imm): Apply S_SET_THREAD_LOCAL
on symbols in TLS relocs.
gas/testsuite:
* gas/cris/rd-tls-1.d, gas/cris/rd-tls-1.s: Use a local thread
variable instead of .text location for :GD decoration test.
Index: gas/cris/rd-tls-1.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cris/rd-tls-1.d,v
retrieving revision 1.1
diff -p -u -r1.1 rd-tls-1.d
--- gas/cris/rd-tls-1.d 4 Oct 2008 17:23:44 -0000 1.1
+++ gas/cris/rd-tls-1.d 19 Nov 2008 06:12:58 -0000
@@ -8,7 +8,7 @@ Disassembly of section \.text:
0+ <start>:
[ ]+0:[ ]+af1e 0000 0000[ ]+sub\.d 0 <start>,\$?r1
-[ ]+2:[ ]+R_CRIS_32_GD \.text
+[ ]+2:[ ]+R_CRIS_32_GD x
[ ]+6:[ ]+2f9e 0000 0000[ ]+add\.d 0 <start>,\$?r9
[ ]+8:[ ]+R_CRIS_32_GD extsym2
[ ]+c:[ ]+6f3d 0000 0000 6aaa[ ]+move\.d \[\$?r3\+0 <start>\],\$?r10
Index: gas/cris/rd-tls-1.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cris/rd-tls-1.s,v
retrieving revision 1.1
diff -p -u -r1.1 rd-tls-1.s
--- gas/cris/rd-tls-1.s 4 Oct 2008 17:23:44 -0000 1.1
+++ gas/cris/rd-tls-1.s 19 Nov 2008 06:12:58 -0000
@@ -1,9 +1,16 @@
; Check that non-PIC TLS operands get their right relocation type.
; First some expected uses, similar to what GCC will emit.
+
+ .section .tdata,"awT",@progbits
+ .type x, @object
+ .size x, 4
+x:
+ .dword 0
+
.text
.syntax no_register_prefix
start:
- sub.d .:GD,r1
+ sub.d x:GD,r1
add.d extsym2:GD,r9
move.d [r3+extsym:TPOFF],r10
move.w extsym14:TPOFF16+77,r10
Index: config/tc-cris.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-cris.c,v
retrieving revision 1.42
diff -p -u -r1.42 tc-cris.c
--- config/tc-cris.c 12 Nov 2008 03:09:31 -0000 1.42
+++ config/tc-cris.c 19 Nov 2008 06:14:32 -0000
@@ -3627,13 +3627,6 @@ cris_number_to_imm (char *bufp, long val
regression tests on the object file contents. FIXME: Seems
uninteresting now that we have a test suite. */
- case BFD_RELOC_CRIS_16_GOT:
- case BFD_RELOC_CRIS_32_GOT:
- case BFD_RELOC_CRIS_32_GOTREL:
- case BFD_RELOC_CRIS_16_GOTPLT:
- case BFD_RELOC_CRIS_32_GOTPLT:
- case BFD_RELOC_CRIS_32_PLT_GOTREL:
- case BFD_RELOC_CRIS_32_PLT_PCREL:
case BFD_RELOC_CRIS_32_GOT_GD:
case BFD_RELOC_CRIS_16_GOT_GD:
case BFD_RELOC_CRIS_32_GD:
@@ -3643,6 +3636,19 @@ cris_number_to_imm (char *bufp, long val
case BFD_RELOC_CRIS_16_GOT_TPREL:
case BFD_RELOC_CRIS_32_TPREL:
case BFD_RELOC_CRIS_16_TPREL:
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+ if (IS_ELF && fixP->fx_addsy != NULL)
+ S_SET_THREAD_LOCAL (fixP->fx_addsy);
+#endif
+ /* Fall through. */
+
+ case BFD_RELOC_CRIS_16_GOT:
+ case BFD_RELOC_CRIS_32_GOT:
+ case BFD_RELOC_CRIS_32_GOTREL:
+ case BFD_RELOC_CRIS_16_GOTPLT:
+ case BFD_RELOC_CRIS_32_GOTPLT:
+ case BFD_RELOC_CRIS_32_PLT_GOTREL:
+ case BFD_RELOC_CRIS_32_PLT_PCREL:
/* We don't want to put in any kind of non-zero bits in the data
being relocated for these. */
md_number_to_chars (bufp, 0, n);
brgds, H-P