This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[RFC] partial fix to PR binutils/14663
- From: dje at google dot com
- To: binutils at sourceware dot org
- Date: Wed, 03 Oct 2012 12:05:33 -0700
- Subject: [RFC] partial fix to PR binutils/14663
Hi.
This patch is a PARTIAL fix to PR binutils/14663.
http://sourceware.org/bugzilla/show_bug.cgi?id=14663
The remaining bit is silencing this warning:
BFD: tmpdir/striprog: warning: Empty loadable segment detected, is this intentional ?
I'm not sure how best to go about that, without spending more time
than I have at the moment.
It's kinda odd to be fixing a bug like this so it's possible or even
likely I'm missing something here.
Filed fyi.
2012-10-03 Doug Evans <dje@google.com>
PR binutils/14663
* objcopy.c (is_strip_section_1): If STRIP_NONDEBUG, remove
non-debug sections.
Index: objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.157
diff -u -p -r1.157 objcopy.c
--- objcopy.c 8 May 2012 17:49:36 -0000 1.157
+++ objcopy.c 3 Oct 2012 18:59:23 -0000
@@ -985,9 +985,24 @@ is_strip_section_1 (bfd *abfd ATTRIBUTE_
if (strip_symbols == STRIP_NONDEBUG)
return FALSE;
}
+ else
+ {
+ /* DWO sections are implicitly SEC_DEBUGGING sections. */
+ if (strip_symbols == STRIP_NONDWO)
+ return !is_dwo_section (abfd, sec);
- if (strip_symbols == STRIP_NONDWO)
- return !is_dwo_section (abfd, sec);
+ if (strip_symbols == STRIP_NONDEBUG)
+ {
+ /* If ELF, keep note sections.
+ SEC could be an *ABS* section with no associated bfd,
+ so we use sec->owner and not abfd here. */
+ if (sec->owner != NULL
+ && sec->owner->xvec->flavour == bfd_target_elf_flavour
+ && elf_section_type (sec) == SHT_NOTE)
+ return FALSE;
+ return TRUE;
+ }
+ }
return FALSE;
}