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.
This commit is contained in:
parent
8249a5a9e2
commit
8877b5e517
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
9
ld/testsuite/ld-elf/rel.c
Normal file
9
ld/testsuite/ld-elf/rel.c
Normal 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;
|
||||
}
|
7
ld/testsuite/ld-elf/relmain.c
Normal file
7
ld/testsuite/ld-elf/relmain.c
Normal file
@ -0,0 +1,7 @@
|
||||
extern int eight (void);
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return eight () - 8;
|
||||
}
|
0
ld/testsuite/ld-elf/relmain.out
Normal file
0
ld/testsuite/ld-elf/relmain.out
Normal 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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user