to keep powerpc64 .branch_lt

Alan Modra amodra@gmail.com
Tue Nov 6 03:46:00 GMT 2012


In order to compare newer linker output to that from an older linker,
I found myself wanting to keep an empty .branch_lt section.  Which
should have been achievable by writing a tiny linker script with a
KEEP.  It wasn't.

	* elf64-ppc.c (maybe_strip_output): Heed SEC_KEEP.

Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.394
diff -u -p -r1.394 elf64-ppc.c
--- bfd/elf64-ppc.c	5 Nov 2012 05:17:34 -0000	1.394
+++ bfd/elf64-ppc.c	6 Nov 2012 01:52:14 -0000
@@ -11300,6 +11303,7 @@ maybe_strip_output (struct bfd_link_info
 {
   if (isec->size == 0
       && isec->output_section->size == 0
+      && !(isec->output_section->flags & SEC_KEEP)
       && !bfd_section_removed_from_list (info->output_bfd,
 					 isec->output_section)
       && elf_section_data (isec->output_section)->dynindx == 0)

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list