From 6452a567da6f4098a453410c6f21f63ad87af265 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 12 Apr 2011 23:23:02 +0000 Subject: [PATCH] * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Do not exclude empty .got sections. --- bfd/ChangeLog | 5 +++++ bfd/elf64-alpha.c | 3 ++- ld/testsuite/ChangeLog | 5 +++++ ld/testsuite/ld-alpha/alpha.exp | 11 ++++++++--- ld/testsuite/ld-alpha/emptygot.nm | 5 +++++ ld/testsuite/ld-alpha/emptygot.s | 7 +++++++ 6 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 ld/testsuite/ld-alpha/emptygot.nm create mode 100644 ld/testsuite/ld-alpha/emptygot.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4d0f3e0daa3..ce76b34e81a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2011-04-12 Richard Henderson + + * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Do not + exclude empty .got sections. + 2011-04-11 H.J. Lu * elf32-i386.c (elf_i386_reloc_type_lookup): Fix the out of bound diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 2b15a81c082..33b27ac6d3c 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -2927,7 +2927,8 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, linker does that before adjust_dynamic_symbol is called, and it is that function which decides whether anything needs to go into these sections. */ - s->flags |= SEC_EXCLUDE; + if (!CONST_STRNEQ (name, ".got")) + s->flags |= SEC_EXCLUDE; } else if ((s->flags & SEC_HAS_CONTENTS) != 0) { diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index a9687a9a69a..2c16bda0a8a 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-04-12 Richard Henderson + + * ld-alpha/emptygot.s, ld-alpha/emptygot.nm: New test. + * ld-alpha/alpha.exp: Run it. + 2011-04-11 Mark Wielaard PR 10549 diff --git a/ld/testsuite/ld-alpha/alpha.exp b/ld/testsuite/ld-alpha/alpha.exp index dce2f450513..ed95d88ff7a 100644 --- a/ld/testsuite/ld-alpha/alpha.exp +++ b/ld/testsuite/ld-alpha/alpha.exp @@ -41,19 +41,24 @@ set alphatests { "" {align.s tlspic1.s tlspic2.s} {{readelf -WSsrl tlspic.rd} {objdump -drj.text tlspic.dd} {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}} - "libtlspic.so"} + "libtlspic.so"} {"Helper shared library" "-shared -melf64alpha" "" {tlslib.s} {} "libtlslib.so"} {"TLS -fpic and -fno-pic exec" "-melf64alpha tmpdir/libtlslib.so" "" {align.s tlsbinpic.s tlsbin.s} {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd} {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} - "tlsbin"} + "tlsbin"} {"TLS -fpic and -fno-pic exec -relax" "-relax -melf64alpha tmpdir/libtlslib.so" "" {align.s tlsbinpic.s tlsbin.s} {{readelf -WSsrl tlsbinr.rd} {objdump -drj.text tlsbinr.dd} {objdump -sj.got tlsbinr.sd}} - "tlsbinr"} + "tlsbinr"} + {"empty got" + "-melf64alpha" "" + {emptygot.s} + {{nm "-n" emptygot.nm}} + "emptygot"} } # Not implemented yet diff --git a/ld/testsuite/ld-alpha/emptygot.nm b/ld/testsuite/ld-alpha/emptygot.nm new file mode 100644 index 00000000000..db3a03d89df --- /dev/null +++ b/ld/testsuite/ld-alpha/emptygot.nm @@ -0,0 +1,5 @@ +00000001200000b0 T _start +00000001200100b8 A __bss_start +00000001200100b8 A _edata +00000001200100b8 s foo +00000001200100c0 A _end diff --git a/ld/testsuite/ld-alpha/emptygot.s b/ld/testsuite/ld-alpha/emptygot.s new file mode 100644 index 00000000000..ca6887c06a8 --- /dev/null +++ b/ld/testsuite/ld-alpha/emptygot.s @@ -0,0 +1,7 @@ + .text + .globl _start +_start: + lda $0, foo($29) !gprel + + .section .sbss +foo: .quad 0 -- 2.30.2