aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2009-03-04 05:50:50 +0000
committerAlan Modra <amodra@gmail.com>2009-03-04 05:50:50 +0000
commit727fc41e077139570ea8b8ddfd6c546b2a55627c (patch)
treecb2e0c6f5409224e1658daa9ca5b8e8fea3a4503 /ld
parent51dec22749b3733b1fa3df0c1290a50967887ccf (diff)
downloadgdb-727fc41e077139570ea8b8ddfd6c546b2a55627c.zip
gdb-727fc41e077139570ea8b8ddfd6c546b2a55627c.tar.gz
gdb-727fc41e077139570ea8b8ddfd6c546b2a55627c.tar.bz2
include/elf/
* ppc.h (R_PPC_TLSGD, R_PPC_TLSLD): Add new relocs. * ppc64.h (R_PPC64_TLSGD, R_PPC64_TLSLD): Add new relocs. bfd/ * reloc.c (BFD_RELOC_PPC_TLSGD, BFD_RELOC_PPC_TLSLD): New. * section.c (struct bfd_section): Add has_tls_get_addr_call. (BFD_FAKE_SECTION): Init new flag. * ecoff.c (bfd_debug_section): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elf32-ppc.c (ppc_elf_howto_raw): Add R_PPC_TLSGD and R_PPC_TLSLD. (ppc_elf_reloc_type_lookup): Handle new relocs. (ppc_elf_check_relocs): Set has_tls_get_addr_call on finding such without marker relocs. (ppc_elf_tls_optimize): Allow out-of-order __tls_get_addr relocs if section has no old-style calls. (ppc_elf_relocate_section): Set tls_mask for non-tls relocs too. Don't try to optimize new-style __tls_get_addr call when handling arg setup relocs. Instead do so for R_PPC_TLSGD and R_PPC_TLSLD relocs. * elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_TLSGD, R_PPC64_TLSLD. (ppc64_elf_reloc_type_lookup): Handle new relocs. (ppc64_elf_check_relocs): Set has_tls_get_addr_call on finding such without marker relocs. (ppc64_elf_tls_optimize): Allow out-of-order __tls_get_addr relocs if section has no old-style calls. Set toc_ref for new relocs as appropriate. (ppc64_elf_relocate_section): Set tls_mask for non-tls relocs too. Don't try to optimize new-style __tls_get_addr call when handling arg setup relocs. Instead do so for R_PPC_TLSGD and R_PPC_TLSLD relocs. gas/ * config/tc-ppc.c (ppc_elf_suffix): Error if ppc32 tls got relocs have non-zero addend. (md_assemble): Parse args of __tls_get_addr calls. (md_apply_fix): Handle BFD_RELOC_PPC_TLSGD and BFD_RELOC_PPC_TLSLD. ld/testsuite/ * ld-powerpc/tlsmark.s, * ld-powerpc/tlsmark.d: New test. * ld-powerpc/tlsmark32.s, * ld-powerpc/tlsmark32.d: New test. * ld-powerpc/powerpc.exp: Run them.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp8
-rw-r--r--ld/testsuite/ld-powerpc/tlsmark.d42
-rw-r--r--ld/testsuite/ld-powerpc/tlsmark.s55
-rw-r--r--ld/testsuite/ld-powerpc/tlsmark32.d29
-rw-r--r--ld/testsuite/ld-powerpc/tlsmark32.s27
6 files changed, 166 insertions, 1 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index c338bb4..60465f7 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-04 Alan Modra <amodra@bigpond.net.au>
+
+ * ld-powerpc/tlsmark.s, * ld-powerpc/tlsmark.d: New test.
+ * ld-powerpc/tlsmark32.s, * ld-powerpc/tlsmark32.d: New test.
+ * ld-powerpc/powerpc.exp: Run them.
+
2009-03-02 Sebastian Huber <sebastian.huber@embedded-brains.de>
* ld-scripts/regions-alias-1.t: New file.
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 1630cd7..2ed41f2 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -1,5 +1,5 @@
# Expect script for ld-powerpc tests
-# Copyright 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation
+# Copyright 2002, 2003, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
#
# This file is part of the GNU Binutils.
#
@@ -112,6 +112,9 @@ set ppcelftests {
{{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
{objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
"tls32.so"}
+ {"TLS32 markers" "-melf32ppc" "-a32" {tlsmark32.s tlslib32.s}
+ {{objdump -dr tlsmark32.d}}
+ "tlsmark32"}
{"Shared library with global symbol" "-shared -melf32ppc" "-a32" {sdalib.s}
{} "sdalib.so"}
{"Dynamic application with SDA" "-melf32ppc tmpdir/sdalib.so" "-a32" {sdadyn.s}
@@ -145,6 +148,9 @@ set ppc64elftests {
{{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
{objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
"tlstoc.so"}
+ {"TLS markers" "-melf64ppc" "-a64" {tlsmark.s tlslib.s}
+ {{objdump -dr tlsmark.d}}
+ "tlsmark"}
{"sym@tocbase" "-shared -melf64ppc" "-a64" {symtocbase-1.s symtocbase-2.s}
{{objdump -dj.data symtocbase.d}} "symtocbase.so"}
}
diff --git a/ld/testsuite/ld-powerpc/tlsmark.d b/ld/testsuite/ld-powerpc/tlsmark.d
new file mode 100644
index 0000000..8ba350e
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsmark.d
@@ -0,0 +1,42 @@
+#source: tlsmark.s
+#source: tlslib.s
+#as: -a64
+#ld: -melf64ppc
+#objdump: -dr
+#target: powerpc64*-*-*
+
+.*: +file format elf64-powerpc
+
+Disassembly of section \.text:
+
+0+100000e8 <_start>:
+ 100000e8: 48 00 00 18 b 10000100 <_start\+0x18>
+ 100000ec: 60 00 00 00 nop
+ 100000f0: 38 63 90 00 addi r3,r3,-28672
+ 100000f4: e8 83 00 00 ld r4,0\(r3\)
+ 100000f8: 3c 6d 00 00 addis r3,r13,0
+ 100000fc: 48 00 00 0c b 10000108 <_start\+0x20>
+ 10000100: 3c 6d 00 00 addis r3,r13,0
+ 10000104: 4b ff ff e8 b 100000ec <_start\+0x4>
+ 10000108: 60 00 00 00 nop
+ 1000010c: 38 63 10 00 addi r3,r3,4096
+ 10000110: e8 83 80 00 ld r4,-32768\(r3\)
+ 10000114: 3c 6d 00 00 addis r3,r13,0
+ 10000118: 48 00 00 0c b 10000124 <_start\+0x3c>
+ 1000011c: 3c 6d 00 00 addis r3,r13,0
+ 10000120: 48 00 00 14 b 10000134 <_start\+0x4c>
+ 10000124: 60 00 00 00 nop
+ 10000128: 38 63 90 04 addi r3,r3,-28668
+ 1000012c: e8 a3 00 00 ld r5,0\(r3\)
+ 10000130: 4b ff ff ec b 1000011c <_start\+0x34>
+ 10000134: 60 00 00 00 nop
+ 10000138: 38 63 10 00 addi r3,r3,4096
+ 1000013c: e8 a3 80 04 ld r5,-32764\(r3\)
+ 10000140: 38 62 80 28 addi r3,r2,-32728
+ 10000144: 3f a0 10 01 lis r29,4097
+ 10000148: 3b bd 01 68 addi r29,r29,360
+ 1000014c: 48 00 00 09 bl 10000154 <\.__tls_get_addr>
+ 10000150: 60 00 00 00 nop
+
+0+10000154 <\.__tls_get_addr>:
+ 10000154: 4e 80 00 20 blr
diff --git a/ld/testsuite/ld-powerpc/tlsmark.s b/ld/testsuite/ld-powerpc/tlsmark.s
new file mode 100644
index 0000000..dc42327
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsmark.s
@@ -0,0 +1,55 @@
+ .section ".tdata","awT",@progbits
+x: .int 1
+y: .int 2
+
+ .section ".toc","aw",@progbits
+ .p2align 3
+.LC0:
+ .quad y@dtpmod
+ .quad y@dtprel
+.LC1:
+ .quad y@dtpmod
+ .quad 0
+
+ .text
+ .global _start
+_start:
+ b .L2
+
+.L1:
+ bl __tls_get_addr(x@tlsgd)
+ nop
+ ld 4,0(3)
+ addi 3,2,x@got@tlsld
+ b .L3
+.L2:
+ addi 3,2,x@got@tlsgd
+ b .L1
+.L3:
+ bl __tls_get_addr(x@tlsld)
+ nop
+ ld 4,x@dtprel(3)
+
+ addi 3,2,.LC0@toc
+ b .L5
+.L4:
+ addi 3,2,.LC1@toc
+ b .L6
+.L5:
+ bl .__tls_get_addr(.LC0@tlsgd)
+ nop
+ ld 5,0(3)
+ b .L4
+.L6:
+ bl .__tls_get_addr(.LC1@tlsld)
+ nop
+ ld 5,y@dtprel(3)
+
+
+ .section ".text.no","ax",@progbits
+ .p2align 2
+ addi 3,2,gd@got@tlsgd
+ lis 29,__tls_get_addr@ha
+ addi 29,29,__tls_get_addr@l
+ bl __tls_get_addr
+ nop
diff --git a/ld/testsuite/ld-powerpc/tlsmark32.d b/ld/testsuite/ld-powerpc/tlsmark32.d
new file mode 100644
index 0000000..74b74e3
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsmark32.d
@@ -0,0 +1,29 @@
+#source: tlsmark32.s
+#source: tlslib32.s
+#as: -a32
+#ld: -melf32ppc
+#objdump: -dr
+#target: powerpc*-*-*
+
+.*: file format elf32-powerpc
+
+Disassembly of section \.text:
+
+0+1800094 <_start>:
+ 1800094: 48 00 00 14 b 18000a8 <_start\+0x14>
+ 1800098: 38 63 90 00 addi r3,r3,-28672
+ 180009c: 80 83 00 00 lwz r4,0\(r3\)
+ 18000a0: 3c 62 00 00 addis r3,r2,0
+ 18000a4: 48 00 00 0c b 18000b0 <_start\+0x1c>
+ 18000a8: 3c 62 00 00 addis r3,r2,0
+ 18000ac: 4b ff ff ec b 1800098 <_start\+0x4>
+ 18000b0: 38 63 10 00 addi r3,r3,4096
+ 18000b4: 80 83 80 00 lwz r4,-32768\(r3\)
+ 18000b8: 38 7f ff f4 addi r3,r31,-12
+ 18000bc: 3f a0 01 80 lis r29,384
+ 18000c0: 3b bd 00 c8 addi r29,r29,200
+ 18000c4: 48 00 00 05 bl 18000c8 <__tls_get_addr>
+
+0+18000c8 <__tls_get_addr>:
+ 18000c8: 4e 80 00 20 blr
+#pass \ No newline at end of file
diff --git a/ld/testsuite/ld-powerpc/tlsmark32.s b/ld/testsuite/ld-powerpc/tlsmark32.s
new file mode 100644
index 0000000..2fa48ae
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsmark32.s
@@ -0,0 +1,27 @@
+ .section ".tdata","awT",@progbits
+x: .int 1
+
+ .text
+ .global _start
+_start:
+ b .L2
+
+.L1:
+ bl __tls_get_addr(x@tlsgd)
+ lwz 4,0(3)
+ addi 3,31,x@got@tlsld
+ b .L3
+.L2:
+ addi 3,31,x@got@tlsgd
+ b .L1
+.L3:
+ bl __tls_get_addr(x@tlsld)
+ lwz 4,x@dtprel(3)
+
+
+ .section ".text.no","ax",@progbits
+ .p2align 2
+ addi 3,31,gd@got@tlsgd
+ lis 29,__tls_get_addr@ha
+ addi 29,29,__tls_get_addr@l
+ bl __tls_get_addr