summaryrefslogtreecommitdiffstats
path: root/elfcopy/sections.c
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2015-12-11 20:13:36 +0000
committeremaste <emaste@FreeBSD.org>2015-12-11 20:13:36 +0000
commit08c7091d4a30fde09fdda23d2016d8d11624cb15 (patch)
treefa4048de2a3b89d666f609663721fe14dee0627a /elfcopy/sections.c
parentf776db09f98d97717b9d579ba1d88ed8c5e3a040 (diff)
downloadFreeBSD-src-08c7091d4a30fde09fdda23d2016d8d11624cb15.zip
FreeBSD-src-08c7091d4a30fde09fdda23d2016d8d11624cb15.tar.gz
Import ELF Tool Chain snapshot revision r3272
From http://svn.code.sf.net/p/elftoolchain/code/
Diffstat (limited to 'elfcopy/sections.c')
-rw-r--r--elfcopy/sections.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/elfcopy/sections.c b/elfcopy/sections.c
index f1ec6c0..0c18171 100644
--- a/elfcopy/sections.c
+++ b/elfcopy/sections.c
@@ -34,7 +34,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: sections.c 3225 2015-06-06 02:35:23Z kaiwang27 $");
+ELFTC_VCSID("$Id: sections.c 3272 2015-12-11 20:00:54Z kaiwang27 $");
static void add_gnu_debuglink(struct elfcopy *ecp);
static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc);
@@ -457,11 +457,17 @@ create_scn(struct elfcopy *ecp)
/*
* If strip action is STRIP_NONDEBUG(only keep debug),
- * change sections flags of loadable sections to SHF_NOBITS,
- * and the content of those sections will be ignored.
+ * change sections type of loadable sections and section
+ * groups to SHT_NOBITS, and the content of those sections
+ * will be discarded. However, SHT_NOTE sections should
+ * be kept.
*/
- if (ecp->strip == STRIP_NONDEBUG && (ish.sh_flags & SHF_ALLOC))
- s->type = SHT_NOBITS;
+ if (ecp->strip == STRIP_NONDEBUG) {
+ if (((ish.sh_flags & SHF_ALLOC) ||
+ (ish.sh_flags & SHF_GROUP)) &&
+ ish.sh_type != SHT_NOTE)
+ s->type = SHT_NOBITS;
+ }
check_section_rename(ecp, s);
OpenPOWER on IntegriCloud