summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2009-03-14 09:18:22 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2009-03-14 09:18:22 +0000
commit47dfb2ca058b165e333767f15a62c603830284dd (patch)
treea63bf6d8dcb639614b5a97e3471810ff6257b705 /ld
parent4cc02a022b59a6f9c6041c7ac993157db0fdd1dc (diff)
downloadbinutils-47dfb2ca058b165e333767f15a62c603830284dd.tar.gz
binutils-47dfb2ca058b165e333767f15a62c603830284dd.tar.bz2
binutils-47dfb2ca058b165e333767f15a62c603830284dd.zip
bfd/
* xcofflink.c: (xcoff_mark_symbol): Mark the TOC section when creating a descriptor. (xcoff_sweep): Don't mark toc_section unless it's needed. (bfd_xcoff_size_dynamic_sections): Skip the toc_section when marking every bfd. (xcoff_link_input_bfd): Skip all TOC anchors. (xcoff_toc_section_p, xcoff_find_tc0): New functions. (_bfd_xcoff_bfd_final_link): Don't set the output bfd's TOC anchor to -1; call xcoff_find_tc0 instead. ld/testsuite/ * ld-powerpc/aix-toc-1.ex, ld-powerpc/aix-toc-1a.s, ld-powerpc/aix-toc-1b.s, ld-powerpc/aix-toc-1-32.dd, ld-powerpc/aix-toc-1-64.dd: New tests. * ld-powerpc/aix52.exp: Run them.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-powerpc/aix-toc-1-32.dd12
-rw-r--r--ld/testsuite/ld-powerpc/aix-toc-1-64.dd12
-rw-r--r--ld/testsuite/ld-powerpc/aix-toc-1.ex2
-rw-r--r--ld/testsuite/ld-powerpc/aix-toc-1a.s23
-rw-r--r--ld/testsuite/ld-powerpc/aix-toc-1b.s23
-rw-r--r--ld/testsuite/ld-powerpc/aix52.exp5
7 files changed, 84 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index bc20d02ce43..cb7c24ea565 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+ * ld-powerpc/aix-toc-1.ex, ld-powerpc/aix-toc-1a.s,
+ ld-powerpc/aix-toc-1b.s, ld-powerpc/aix-toc-1-32.dd,
+ ld-powerpc/aix-toc-1-64.dd: New tests.
+ * ld-powerpc/aix52.exp: Run them.
+
+2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+
* ld-powerpc/aix-glink-1.ex, ld-powerpc/aix-glink-1.s,
ld-powerpc/aix-glink-1-32.dd, ld-powerpc/aix-glink-1-64.dd,
ld-powerpc/aix-glink-1-32.d, ld-powerpc/aix-glink-1-64.d: New tests.
diff --git a/ld/testsuite/ld-powerpc/aix-toc-1-32.dd b/ld/testsuite/ld-powerpc/aix-toc-1-32.dd
new file mode 100644
index 00000000000..e129d34a380
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-toc-1-32.dd
@@ -0,0 +1,12 @@
+
+.*
+
+
+Disassembly of section \.text:
+
+10000000 <\.f1>:
+10000000: 80 22 80 08 l r1,-32760\(r2\)
+ 10000002: R_TOC sym0.*
+#...
+1000fff4: 80 22 7f fc l r1,32764\(r2\)
+ 1000fff6: R_TOC asym8190.*
diff --git a/ld/testsuite/ld-powerpc/aix-toc-1-64.dd b/ld/testsuite/ld-powerpc/aix-toc-1-64.dd
new file mode 100644
index 00000000000..c169ff60a65
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-toc-1-64.dd
@@ -0,0 +1,12 @@
+
+.*
+
+
+Disassembly of section \.text:
+
+0000000010000000 <.f1>:
+ 10000000: e8 22 80 10 ld r1,-32752\(r2\)
+ 10000002: R_TOC sym0.*
+#...
+ 10007ff4: e8 22 7f f8 ld r1,32760\(r2\)
+ 10007ff6: R_TOC asym4094.*
diff --git a/ld/testsuite/ld-powerpc/aix-toc-1.ex b/ld/testsuite/ld-powerpc/aix-toc-1.ex
new file mode 100644
index 00000000000..13a294326b8
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-toc-1.ex
@@ -0,0 +1,2 @@
+f1
+f2
diff --git a/ld/testsuite/ld-powerpc/aix-toc-1a.s b/ld/testsuite/ld-powerpc/aix-toc-1a.s
new file mode 100644
index 00000000000..e67d5d3181c
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-toc-1a.s
@@ -0,0 +1,23 @@
+ .macro loadtoc
+ .toc
+ .tc sym\@[TC], \@
+
+ .csect .f1[PR]
+ .if size == 32
+ lwz 1,sym\@[TC](2)
+ .else
+ ld 1,sym\@[TC](2)
+ .endif
+ .endm
+
+ .globl .f1
+ .csect .f1[PR]
+.f1:
+ .rept 0x7ffc * 8 / size
+ loadtoc
+ .endr
+
+ .globl f1
+ .csect f1[DS]
+f1:
+ .long .f1[PR],TOC[TC0],0
diff --git a/ld/testsuite/ld-powerpc/aix-toc-1b.s b/ld/testsuite/ld-powerpc/aix-toc-1b.s
new file mode 100644
index 00000000000..d4cee8a2385
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-toc-1b.s
@@ -0,0 +1,23 @@
+ .macro loadtoc
+ .toc
+ .tc asym\@[TC], \@ | 0x10000
+
+ .csect .f2[PR]
+ .if size == 32
+ lwz 1,asym\@[TC](2)
+ .else
+ ld 1,asym\@[TC](2)
+ .endif
+ .endm
+
+ .globl .f2
+ .csect .f2[PR]
+.f2:
+ .rept 0x7ffc * 8 / size
+ loadtoc
+ .endr
+
+ .globl f2
+ .csect f2[DS]
+f2:
+ .long .f2[PR],TOC[TC0],0
diff --git a/ld/testsuite/ld-powerpc/aix52.exp b/ld/testsuite/ld-powerpc/aix52.exp
index 41a204564c4..247b2d1ae4a 100644
--- a/ld/testsuite/ld-powerpc/aix52.exp
+++ b/ld/testsuite/ld-powerpc/aix52.exp
@@ -97,6 +97,11 @@ set aix52tests {
"" {aix-glink-1.s}
{{objdump {-D -j.text -j.data} aix-glink-1-SIZE.dd}}
"aix-glink-1.so"}
+
+ {"TOC test 1" "-shared -bE:aix-toc-1.ex"
+ "" {aix-toc-1a.s aix-toc-1b.s}
+ {{objdump -dr aix-toc-1-SIZE.dd}}
+ "aix-toc-1.so"}
}
foreach test $aix52tests {