summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain/elfcopy
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2015-12-11 20:28:27 +0000
committeremaste <emaste@FreeBSD.org>2015-12-11 20:28:27 +0000
commit8d8726ea868dc8e8e2dbaf693c2933d8aecd6e40 (patch)
tree0a74d93c155b930ca554757f4e220766fdcea7bc /contrib/elftoolchain/elfcopy
parent98fd4878e04a40df20d37039ee02a0fbd5e6e474 (diff)
downloadFreeBSD-src-8d8726ea868dc8e8e2dbaf693c2933d8aecd6e40.zip
FreeBSD-src-8d8726ea868dc8e8e2dbaf693c2933d8aecd6e40.tar.gz
Update to ELF Tool Chain r3272
Highlights (not already in the FreeBSD tree): - addr2line: Speed up and support searching inlined functions - addr2line: Support -i, -a, -p options - readelf: Add some ARM relocation types - readelf, libelf: Avoid reading beyond end of buffer/file Relnotes: Yes Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'contrib/elftoolchain/elfcopy')
-rw-r--r--contrib/elftoolchain/elfcopy/binary.c2
-rw-r--r--contrib/elftoolchain/elfcopy/elfcopy.19
-rw-r--r--contrib/elftoolchain/elfcopy/main.c6
-rw-r--r--contrib/elftoolchain/elfcopy/sections.c16
-rw-r--r--contrib/elftoolchain/elfcopy/segments.c4
5 files changed, 24 insertions, 13 deletions
diff --git a/contrib/elftoolchain/elfcopy/binary.c b/contrib/elftoolchain/elfcopy/binary.c
index bc5f9fd..7c834a9 100644
--- a/contrib/elftoolchain/elfcopy/binary.c
+++ b/contrib/elftoolchain/elfcopy/binary.c
@@ -35,7 +35,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: binary.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: binary.c 3270 2015-12-11 18:48:56Z emaste $");
/*
* Convert ELF object to `binary'. Sections with SHF_ALLOC flag set
diff --git a/contrib/elftoolchain/elfcopy/elfcopy.1 b/contrib/elftoolchain/elfcopy/elfcopy.1
index 4889570..83cda5d 100644
--- a/contrib/elftoolchain/elfcopy/elfcopy.1
+++ b/contrib/elftoolchain/elfcopy/elfcopy.1
@@ -21,9 +21,9 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: elfcopy.1 3195 2015-05-12 17:22:19Z emaste $
+.\" $Id: elfcopy.1 3266 2015-12-07 15:38:26Z emaste $
.\"
-.Dd March 27, 2015
+.Dd December 7, 2015
.Os
.Dt ELFCOPY 1
.Sh NAME
@@ -47,6 +47,7 @@
.Op Fl p | Fl -preserve-dates
.Op Fl w | Fl -wildcard
.Op Fl x | Fl -discard-all
+.Op Fl -add-gnu-debuglink Ns = Ns Ar filename
.Op Fl -add-section Ar sectionname Ns = Ns Ar filename
.Oo
.Fl -adjust-section-vma Ar section Ns {+|-|=} Ns Ar val |
@@ -165,6 +166,10 @@ Mark the end of a character class.
.El
.It Fl x | Fl -discard-all
Do not copy non-global symbols to the output.
+.It Fl -add-gnu-debuglink Ns = Ns Ar filename
+Create a .gnu_debuglink section in the output file that references the
+debug data in
+.Ar filename .
.It Fl -add-section Ar sectionname Ns = Ns Ar filename
Add a new section to the output file with name
.Ar sectionname .
diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c
index cbd48d3..e2685b4 100644
--- a/contrib/elftoolchain/elfcopy/main.c
+++ b/contrib/elftoolchain/elfcopy/main.c
@@ -39,7 +39,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: main.c 3216 2015-05-23 21:16:36Z kaiwang27 $");
+ELFTC_VCSID("$Id: main.c 3268 2015-12-07 20:30:55Z emaste $");
enum options
{
@@ -1375,11 +1375,13 @@ Usage: %s [options] infile [outfile]\n\
-w | --wildcard Use shell-style patterns to name symbols.\n\
-x | --discard-all Do not copy non-globals to the output.\n\
-I FORMAT | --input-target=FORMAT\n\
- (Accepted but ignored).\n\
+ Specify object format for the input file.\n\
-K SYM | --keep-symbol=SYM Copy symbol SYM to the output.\n\
-L SYM | --localize-symbol=SYM\n\
Make symbol SYM local to the output file.\n\
-N SYM | --strip-symbol=SYM Do not copy symbol SYM to the output.\n\
+ -O FORMAT | --output-target=FORMAT\n\
+ Specify object format for the output file.\n\
-R NAME | --remove-section=NAME\n\
Remove the named section.\n\
-S | --strip-all Remove all symbol and relocation information\n\
diff --git a/contrib/elftoolchain/elfcopy/sections.c b/contrib/elftoolchain/elfcopy/sections.c
index 02516ef..a17c9ab 100644
--- a/contrib/elftoolchain/elfcopy/sections.c
+++ b/contrib/elftoolchain/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);
diff --git a/contrib/elftoolchain/elfcopy/segments.c b/contrib/elftoolchain/elfcopy/segments.c
index 1e271a6..837cea5 100644
--- a/contrib/elftoolchain/elfcopy/segments.c
+++ b/contrib/elftoolchain/elfcopy/segments.c
@@ -34,7 +34,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: segments.c 3196 2015-05-12 17:33:48Z emaste $");
+ELFTC_VCSID("$Id: segments.c 3269 2015-12-11 18:38:43Z kaiwang27 $");
static void insert_to_inseg_list(struct segment *seg, struct section *sec);
@@ -77,8 +77,6 @@ add_to_inseg_list(struct elfcopy *ecp, struct section *s)
if (s->off + s->sz > seg->off + seg->fsz &&
s->type != SHT_NOBITS)
continue;
- if (s->off + s->sz > seg->off + seg->msz)
- continue;
if (s->vma + s->sz > seg->addr + seg->msz)
continue;
OpenPOWER on IntegriCloud