summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain/elfcopy
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2014-12-24 03:13:16 +0000
committeremaste <emaste@FreeBSD.org>2014-12-24 03:13:16 +0000
commit46be049bf4ca89859159bdcdffee1da04d3ae080 (patch)
treedf1b4f84b1be7baca0dd531aa4550b3547c3ebe3 /contrib/elftoolchain/elfcopy
parentccd50ca7afbe05afbea396c377284c586dfe4fc4 (diff)
parenta9e16dd96e36e12a102a2991b06851e6e0ce6bea (diff)
downloadFreeBSD-src-46be049bf4ca89859159bdcdffee1da04d3ae080.zip
FreeBSD-src-46be049bf4ca89859159bdcdffee1da04d3ae080.tar.gz
Update elftoolchain to upstream rev 3130
This brings a number of fixes to elfcopy/strip and DWARF4 improvements. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'contrib/elftoolchain/elfcopy')
-rw-r--r--contrib/elftoolchain/elfcopy/archive.c5
-rw-r--r--contrib/elftoolchain/elfcopy/main.c2
-rw-r--r--contrib/elftoolchain/elfcopy/sections.c10
-rw-r--r--contrib/elftoolchain/elfcopy/segments.c10
-rw-r--r--contrib/elftoolchain/elfcopy/symbols.c5
5 files changed, 18 insertions, 14 deletions
diff --git a/contrib/elftoolchain/elfcopy/archive.c b/contrib/elftoolchain/elfcopy/archive.c
index 3fd2e85..4735f02 100644
--- a/contrib/elftoolchain/elfcopy/archive.c
+++ b/contrib/elftoolchain/elfcopy/archive.c
@@ -40,7 +40,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: archive.c 2370 2011-12-29 12:48:12Z jkoshy $");
+ELFTC_VCSID("$Id: archive.c 3102 2014-10-29 21:09:01Z jkoshy $");
#define _ARMAG_LEN 8 /* length of ar magic string */
#define _ARHDR_LEN 60 /* length of ar header */
@@ -350,7 +350,6 @@ ac_detect_ar(int ifd)
r = -1;
if ((a = archive_read_new()) == NULL)
return (0);
- archive_read_support_filter_none(a);
archive_read_support_format_ar(a);
if (archive_read_open_fd(a, ifd, 10240) == ARCHIVE_OK)
r = archive_read_next_header(a, &entry);
@@ -386,7 +385,6 @@ ac_read_objs(struct elfcopy *ecp, int ifd)
err(EXIT_FAILURE, "lseek failed");
if ((a = archive_read_new()) == NULL)
errx(EXIT_FAILURE, "%s", archive_error_string(a));
- archive_read_support_filter_none(a);
archive_read_support_format_ar(a);
AC(archive_read_open_fd(a, ifd, 10240));
for(;;) {
@@ -449,7 +447,6 @@ ac_write_objs(struct elfcopy *ecp, int ofd)
if ((a = archive_write_new()) == NULL)
errx(EXIT_FAILURE, "%s", archive_error_string(a));
archive_write_set_format_ar_svr4(a);
- archive_write_add_filter_none(a);
AC(archive_write_open_fd(a, ofd));
/* Write the archive symbol table, even if it's empty. */
diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c
index 240ca56..0ba4e68 100644
--- a/contrib/elftoolchain/elfcopy/main.c
+++ b/contrib/elftoolchain/elfcopy/main.c
@@ -40,7 +40,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: main.c 2970 2013-12-01 15:22:12Z kaiwang27 $");
+ELFTC_VCSID("$Id: main.c 3111 2014-12-20 08:33:01Z kaiwang27 $");
enum options
{
diff --git a/contrib/elftoolchain/elfcopy/sections.c b/contrib/elftoolchain/elfcopy/sections.c
index 1ad7252..c503666 100644
--- a/contrib/elftoolchain/elfcopy/sections.c
+++ b/contrib/elftoolchain/elfcopy/sections.c
@@ -35,7 +35,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: sections.c 2358 2011-12-19 18:22:32Z kaiwang27 $");
+ELFTC_VCSID("$Id: sections.c 3126 2014-12-21 08:03:31Z kaiwang27 $");
static void add_gnu_debuglink(struct elfcopy *ecp);
static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc);
@@ -372,6 +372,14 @@ create_scn(struct elfcopy *ecp)
is_remove_reloc_sec(ecp, ish.sh_info))
continue;
+ /*
+ * Section groups should be removed if symbol table will
+ * be removed. (section group's signature stored in symbol
+ * table)
+ */
+ if (ish.sh_type == SHT_GROUP && ecp->strip == STRIP_ALL)
+ continue;
+
/* Get section flags set by user. */
sec_flags = get_section_flags(ecp, name);
diff --git a/contrib/elftoolchain/elfcopy/segments.c b/contrib/elftoolchain/elfcopy/segments.c
index d358e5c..fe0bc00 100644
--- a/contrib/elftoolchain/elfcopy/segments.c
+++ b/contrib/elftoolchain/elfcopy/segments.c
@@ -35,7 +35,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: segments.c 2542 2012-08-12 16:14:15Z kaiwang27 $");
+ELFTC_VCSID("$Id: segments.c 3113 2014-12-20 08:33:29Z kaiwang27 $");
static void insert_to_inseg_list(struct segment *seg, struct section *sec);
@@ -73,13 +73,15 @@ add_to_inseg_list(struct elfcopy *ecp, struct section *s)
*/
loadable = 0;
STAILQ_FOREACH(seg, &ecp->v_seg, seg_list) {
- if (s->off < seg->off)
+ if (s->off < seg->off || (s->vma < seg->addr && !s->pseudo))
continue;
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;
insert_to_inseg_list(seg, s);
if (seg->type == PT_LOAD)
@@ -97,7 +99,7 @@ adjust_addr(struct elfcopy *ecp)
struct section *s, *s0;
struct segment *seg;
struct sec_action *sac;
- uint64_t dl, lma, old_vma, start, end;
+ uint64_t dl, lma, start, end;
int found, i;
/*
@@ -114,8 +116,6 @@ adjust_addr(struct elfcopy *ecp)
s->lma += ecp->change_addr;
if (!s->pseudo) {
- old_vma = s->vma;
-
/* Apply global VMA adjustment. */
if (ecp->change_addr != 0)
s->vma += ecp->change_addr;
diff --git a/contrib/elftoolchain/elfcopy/symbols.c b/contrib/elftoolchain/elfcopy/symbols.c
index f2a7227..573a18f 100644
--- a/contrib/elftoolchain/elfcopy/symbols.c
+++ b/contrib/elftoolchain/elfcopy/symbols.c
@@ -34,7 +34,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: symbols.c 2971 2013-12-01 15:22:21Z kaiwang27 $");
+ELFTC_VCSID("$Id: symbols.c 3019 2014-04-17 14:53:40Z jkoshy $");
/* Symbol table buffer structure. */
struct symbuf {
@@ -300,7 +300,7 @@ generate_symbols(struct elfcopy *ecp)
GElf_Sym sym;
Elf_Data* id;
Elf_Scn *is;
- size_t ishstrndx, namelen, ndx, nsyms, sc, symndx;
+ size_t ishstrndx, namelen, ndx, sc, symndx;
int ec, elferr, i;
if (elf_getshstrndx(ecp->ein, &ishstrndx) == 0)
@@ -320,7 +320,6 @@ generate_symbols(struct elfcopy *ecp)
st_buf->lcap = 64;
st_buf->lsz = 1; /* '\0' at start. */
st_buf->gsz = 0;
- nsyms = 0;
ecp->symtab->sz = 0;
ecp->strtab->sz = 0;
OpenPOWER on IntegriCloud