summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@nildram.co.uk>2009-03-14 09:15:34 +0000
committerRichard Sandiford <rsandifo@nildram.co.uk>2009-03-14 09:15:34 +0000
commit3ea66a83f25c40a8bd1d4afa36a9219a1757cd35 (patch)
treee44f45aaae86610b7b5652d1e68d4576ec055676
parentcf8286e5176be0ed1e2df2b7c728bf5ecb9d668d (diff)
downloadbinutils-redhat-3ea66a83f25c40a8bd1d4afa36a9219a1757cd35.tar.gz
bfd/
* xcofflink.c (xcoff_mark, xcoff_link_input_bfd): Don't copy R_POS and R_NEG relocations against absolute symbols to the .loader section. ld/testsuite/ * ld-powerpc/aix-abs-reloc-1.ex, ld-powerpc/aix-abs-reloc-1.im, ld-powerpc/aix-abs-reloc-1.od, ld-powerpc/aix-abs-reloc-1.s: New test. * ld-powerpc/aix52.exp: Run it.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/xcofflink.c10
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/ld-powerpc/aix-abs-reloc-1.ex1
-rw-r--r--ld/testsuite/ld-powerpc/aix-abs-reloc-1.im1
-rw-r--r--ld/testsuite/ld-powerpc/aix-abs-reloc-1.od7
-rw-r--r--ld/testsuite/ld-powerpc/aix-abs-reloc-1.s4
-rw-r--r--ld/testsuite/ld-powerpc/aix52.exp6
8 files changed, 41 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 51544cc6c9..9182ef27e3 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+ * xcofflink.c (xcoff_mark, xcoff_link_input_bfd): Don't copy
+ R_POS and R_NEG relocations against absolute symbols to the
+ .loader section.
+
+2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+
* coff64-rs6000.c (xcoff64_write_object_contents): Set the cputype
to 2 for bfd_mach_ppc_620.
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 21d9a2d944..0a38ac343c 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -2335,6 +2335,11 @@ xcoff_mark (struct bfd_link_info *info, asection *sec)
case R_NEG:
case R_RL:
case R_RLA:
+ if (h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && bfd_is_abs_section (h->root.u.def.section))
+ break;
++xcoff_hash_table (info)->ldrel_count;
if (h != NULL)
h->flags |= XCOFF_LDREL;
@@ -4460,6 +4465,11 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *finfo,
case R_NEG:
case R_RL:
case R_RLA:
+ if (h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && bfd_is_abs_section (h->root.u.def.section))
+ break;
/* This reloc needs to be copied into the .loader
section. */
ldrel.l_vaddr = irel->r_vaddr;
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index a8baba1694..b02892bf63 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+ * ld-powerpc/aix-abs-reloc-1.ex, ld-powerpc/aix-abs-reloc-1.im,
+ ld-powerpc/aix-abs-reloc-1.od, ld-powerpc/aix-abs-reloc-1.s: New test.
+ * ld-powerpc/aix52.exp: Run it.
+
+2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+
* ld-powerpc/aix-core-sec-1.s, ld-powerpc/aix-core-sec-1.ex,
ld-powerpc/aix-core-sec-1.hd, ld-powerpc/aix-core-sec-2.s,
ld-powerpc/aix-core-sec-2.ex, ld-powerpc/aix-core-sec-2.hd,
diff --git a/ld/testsuite/ld-powerpc/aix-abs-reloc-1.ex b/ld/testsuite/ld-powerpc/aix-abs-reloc-1.ex
new file mode 100644
index 0000000000..257cc5642c
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-abs-reloc-1.ex
@@ -0,0 +1 @@
+foo
diff --git a/ld/testsuite/ld-powerpc/aix-abs-reloc-1.im b/ld/testsuite/ld-powerpc/aix-abs-reloc-1.im
new file mode 100644
index 0000000000..66f78a490d
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-abs-reloc-1.im
@@ -0,0 +1 @@
+bar 0xdeadbeef
diff --git a/ld/testsuite/ld-powerpc/aix-abs-reloc-1.od b/ld/testsuite/ld-powerpc/aix-abs-reloc-1.od
new file mode 100644
index 0000000000..db65b4b132
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-abs-reloc-1.od
@@ -0,0 +1,7 @@
+
+.*
+
+DYNAMIC RELOCATION RECORDS \(none\)
+
+Contents of section \.data:
+ 10000000 deadbeef .*
diff --git a/ld/testsuite/ld-powerpc/aix-abs-reloc-1.s b/ld/testsuite/ld-powerpc/aix-abs-reloc-1.s
new file mode 100644
index 0000000000..5eb39808ac
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-abs-reloc-1.s
@@ -0,0 +1,4 @@
+ .globl foo
+ .csect foo[RW]
+foo:
+ .long bar
diff --git a/ld/testsuite/ld-powerpc/aix52.exp b/ld/testsuite/ld-powerpc/aix52.exp
index 09725573ca..1263796b72 100644
--- a/ld/testsuite/ld-powerpc/aix52.exp
+++ b/ld/testsuite/ld-powerpc/aix52.exp
@@ -65,6 +65,12 @@ proc run_aix_test { size name ldopts asopts sources tools output } {
}
set aix52tests {
+ {"Relocations against absolute symbols 1"
+ "-shared -bI:aix-abs-reloc-1.im -bE:aix-abs-reloc-1.ex"
+ {} {aix-abs-reloc-1.s}
+ {{objdump -sRj.data aix-abs-reloc-1.od}}
+ "aix-abs-reloc-1.so"}
+
{"Core sections test 1" "-shared -bE:aix-core-sec-1.ex"
"" {aix-core-sec-1.s}
{{objdump -h aix-core-sec-1.hd}}