aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.c5
-rw-r--r--ld/testsuite/ChangeLog5
-rw-r--r--ld/testsuite/ld-elf/rel.c9
-rw-r--r--ld/testsuite/ld-elf/relmain.c7
-rw-r--r--ld/testsuite/ld-elf/relmain.out0
-rw-r--r--ld/testsuite/ld-elf/shared.exp6
7 files changed, 37 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b710f3c..d30bd2e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-20 Alan Modra <amodra@gmail.com>
+
+ * elflink.c (_bfd_elf_make_dynamic_reloc_section): Override
+ sh_type according to is_rela.
+
2013-03-18 Alan Modra <amodra@gmail.com>
PR ld/12549
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 8055d26..6ccf625 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -13025,6 +13025,11 @@ _bfd_elf_make_dynamic_reloc_section (asection * sec,
reloc_sec = bfd_make_section_anyway_with_flags (dynobj, name, flags);
if (reloc_sec != NULL)
{
+ /* _bfd_elf_get_sec_type_attr chooses a section type by
+ name. Override as it may be wrong, eg. for a user
+ section named "auto" we'll get ".relauto" which is
+ seen to be a .rela section. */
+ elf_section_type (reloc_sec) = is_rela ? SHT_RELA : SHT_REL;
if (! bfd_set_section_alignment (dynobj, reloc_sec, alignment))
reloc_sec = NULL;
}
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 9d2fe1b..3dfdfa2 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,4 +1,9 @@
2013-03-20 Alan Modra <amodra@gmail.com>
+
+ * ld-elf/rel.c, ld-elf/relmain.c, ld-elf/relmain.out: New test.
+ * ld-elf/shared.exp: Build and run it.
+
+2013-03-20 Alan Modra <amodra@gmail.com>
Will Newton <will.newton@linaro.org
* ld-elfvers/vers.exp: Add -Wl,--no-as-needed to all tests
diff --git a/ld/testsuite/ld-elf/rel.c b/ld/testsuite/ld-elf/rel.c
new file mode 100644
index 0000000..fd94f71
--- /dev/null
+++ b/ld/testsuite/ld-elf/rel.c
@@ -0,0 +1,9 @@
+static int seven = 7;
+static int *__attribute__((section("auto"))) auto_10 = &seven;
+
+int
+eight (void)
+{
+ extern int *__start_auto[], *__stop_auto[];
+ return *auto_10 + __stop_auto - __start_auto;
+}
diff --git a/ld/testsuite/ld-elf/relmain.c b/ld/testsuite/ld-elf/relmain.c
new file mode 100644
index 0000000..f72dd54
--- /dev/null
+++ b/ld/testsuite/ld-elf/relmain.c
@@ -0,0 +1,7 @@
+extern int eight (void);
+
+int
+main (void)
+{
+ return eight () - 8;
+}
diff --git a/ld/testsuite/ld-elf/relmain.out b/ld/testsuite/ld-elf/relmain.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ld/testsuite/ld-elf/relmain.out
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 2feb730..8a7590a 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -203,6 +203,9 @@ set build_tests {
{"Build needed1b.so with --no-copy-dt-needed-entries"
"-shared tmpdir/libneeded1pic.o -Wl,--no-copy-dt-needed-entries -Ltmpdir -lneeded1a" ""
{dummy.c} {} "needed1d.so"}
+ {"Build librel.so"
+ "-shared" "-fPIC"
+ {rel.c} {} "librel.so"}
}
run_cc_link_tests $build_tests
@@ -347,6 +350,9 @@ set run_tests {
{"Link with --copy-dt-needed-entries"
"tmpdir/libneeded1c.o --copy-dt-needed-entries -rpath=tmpdir -Ltmpdir -lneeded1a" ""
{dummy.c} "needed1b" "needed1.out"}
+ {"Run relmain"
+ "--no-as-needed -rpath=tmpdir -Ltmpdir -lrel" ""
+ {relmain.c} "relmain" "relmain.out"}
}
# NetBSD ELF systems do not currently support the .*_array sections.