This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: mapping of stripped section syms
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Fri, 23 Mar 2012 20:04:25 +1030
- Subject: Re: mapping of stripped section syms
- References: <20120323092627.GK5097@bubble.grove.modra.org>
On Fri, Mar 23, 2012 at 07:56:27PM +1030, Alan Modra wrote:
> I'll also be committing another patch that disables stripping of
> output sections when -q is in effect
bfd/
* elf.c (assign_file_positions_for_non_load_sections): Don't warn
on empty alloc sections.
ld/
* ldemul.c (before_allocation_default): When emitrelocations,
don't strip sections..
* ldlang.c (lang_add_section): ..and don't set up map_head, map_tail.
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.549
diff -u -p -r1.549 elf.c
--- bfd/elf.c 7 Feb 2012 07:04:03 -0000 1.549
+++ bfd/elf.c 23 Mar 2012 04:32:04 -0000
@@ -4820,12 +4820,13 @@ assign_file_positions_for_non_load_secti
BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
else if ((hdr->sh_flags & SHF_ALLOC) != 0)
{
- (*_bfd_error_handler)
- (_("%B: warning: allocated section `%s' not in segment"),
- abfd,
- (hdr->bfd_section == NULL
- ? "*unknown*"
- : hdr->bfd_section->name));
+ if (hdr->sh_size != 0)
+ (*_bfd_error_handler)
+ (_("%B: warning: allocated section `%s' not in segment"),
+ abfd,
+ (hdr->bfd_section == NULL
+ ? "*unknown*"
+ : hdr->bfd_section->name));
/* We don't need to page align empty sections. */
if ((abfd->flags & D_PAGED) != 0 && hdr->sh_size != 0)
off += vma_page_aligned_bias (hdr->sh_addr, off,
Index: ld/ldemul.c
===================================================================
RCS file: /cvs/src/src/ld/ldemul.c,v
retrieving revision 1.38
diff -u -p -r1.38 ldemul.c
--- ld/ldemul.c 17 Feb 2012 14:09:56 -0000 1.38
+++ ld/ldemul.c 23 Mar 2012 04:32:39 -0000
@@ -237,7 +237,7 @@ after_allocation_default (void)
void
before_allocation_default (void)
{
- if (!link_info.relocatable)
+ if (!link_info.relocatable && !link_info.emitrelocations)
strip_excluded_output_sections ();
}
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.386
diff -u -p -r1.386 ldlang.c
--- ld/ldlang.c 8 Mar 2012 05:29:32 -0000 1.386
+++ ld/ldlang.c 23 Mar 2012 04:32:41 -0000
@@ -2380,6 +2380,7 @@ lang_add_section (lang_statement_list_ty
section->output_section = output->bfd_section;
if (!link_info.relocatable
+ && !link_info.emitrelocations
&& !stripped_excluded_sections)
{
asection *s = output->bfd_section->map_tail.s;
--
Alan Modra
Australia Development Lab, IBM