* 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.
This commit is contained in:
Alan Modra 2013-03-20 03:44:56 +00:00
parent 8249a5a9e2
commit 8877b5e517
7 changed files with 37 additions and 0 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -1,3 +1,8 @@
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

View File

@ -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;
}

View File

@ -0,0 +1,7 @@
extern int eight (void);
int
main (void)
{
return eight () - 8;
}

View File

View File

@ -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.