aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-08-05 06:22:22 +0000
committerAlan Modra <amodra@gmail.com>2011-08-05 06:22:22 +0000
commitd969d15f50138890a02f8cc8d4266dee448ceff0 (patch)
treedaf60bac6d98d2513114488c547167894e6ba52f /bfd
parent43e1669b2d187f4b2e4ecdf98a5aac8e9fb10bfd (diff)
downloadgdb-d969d15f50138890a02f8cc8d4266dee448ceff0.zip
gdb-d969d15f50138890a02f8cc8d4266dee448ceff0.tar.gz
gdb-d969d15f50138890a02f8cc8d4266dee448ceff0.tar.bz2
bfd/
* elf64-ppc.c (maybe_strip_output): New function. (ppc64_elf_size_stubs): Use it to strip .branch_lt and .eh_frame. ld/testsuite/ * ld-powerpc/tlsexe.r: Update for stripped .branch_lt. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlstocso.r: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf64-ppc.c27
2 files changed, 28 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 82defd9..3280ac9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2011-08-05 Alan Modra <amodra@gmail.com>
+ * elf64-ppc.c (maybe_strip_output): New function.
+ (ppc64_elf_size_stubs): Use it to strip .branch_lt and .eh_frame.
+
+2011-08-05 Alan Modra <amodra@gmail.com>
+
PR ld/12762
* elflink.c (_bfd_elf_section_already_linked): Return matched
status. Remove COFF comdat section handling.
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index d13447e..e942a7a 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -10871,6 +10871,26 @@ static const unsigned char glink_eh_frame_cie[] =
DW_CFA_def_cfa, 1, 0 /* def_cfa: r1 offset 0. */
};
+/* Stripping output sections is normally done before dynamic section
+ symbols have been allocated. This function is called later, and
+ handles cases like htab->brlt which is mapped to its own output
+ section. */
+
+static void
+maybe_strip_output (struct bfd_link_info *info, asection *isec)
+{
+ if (isec->size == 0
+ && isec->output_section->size == 0
+ && !bfd_section_removed_from_list (info->output_bfd,
+ isec->output_section)
+ && elf_section_data (isec->output_section)->dynindx == 0)
+ {
+ isec->output_section->flags |= SEC_EXCLUDE;
+ bfd_section_list_remove (info->output_bfd, isec->output_section);
+ info->output_bfd->section_count--;
+ }
+}
+
/* Determine and set the size of the stub section for a final link.
The basic idea here is to examine all the relocations looking for
@@ -11251,10 +11271,9 @@ ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size,
(*htab->layout_sections_again) ();
}
- /* It would be nice to strip htab->brlt from the output if the
- section is empty, but it's too late. If we strip sections here,
- the dynamic symbol table is corrupted since the section symbol
- for the stripped section isn't written. */
+ maybe_strip_output (info, htab->brlt);
+ if (htab->glink_eh_frame != NULL)
+ maybe_strip_output (info, htab->glink_eh_frame);
return TRUE;
}