From 8877b5e517baa355c68568e7c5e3ed01d277254a Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 20 Mar 2013 03:44:56 +0000 Subject: [PATCH] bfd/ * elflink.c (_bfd_elf_make_dynamic_reloc_section): Override sh_type according to is_rela. ld/testsuite/ * ld-elf/rel.c, ld-elf/relmain.c, ld-elf/relmain.out: New test. * ld-elf/shared.exp: Build and run it. --- bfd/ChangeLog | 5 +++++ bfd/elflink.c | 5 +++++ ld/testsuite/ChangeLog | 5 +++++ ld/testsuite/ld-elf/rel.c | 9 +++++++++ ld/testsuite/ld-elf/relmain.c | 7 +++++++ ld/testsuite/ld-elf/relmain.out | 0 ld/testsuite/ld-elf/shared.exp | 6 ++++++ 7 files changed, 37 insertions(+) create mode 100644 ld/testsuite/ld-elf/rel.c create mode 100644 ld/testsuite/ld-elf/relmain.c create mode 100644 ld/testsuite/ld-elf/relmain.out diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b710f3c5c2f..d30bd2e7015 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2013-03-20 Alan Modra + + * elflink.c (_bfd_elf_make_dynamic_reloc_section): Override + sh_type according to is_rela. + 2013-03-18 Alan Modra PR ld/12549 diff --git a/bfd/elflink.c b/bfd/elflink.c index 8055d26ed75..6ccf625882f 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 9d2fe1b9729..3dfdfa29c20 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-03-20 Alan Modra + + * 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 Will Newton