summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/elftoolchain/elfcopy/elfcopy.h1
-rw-r--r--contrib/elftoolchain/elfcopy/sections.c1
-rw-r--r--contrib/elftoolchain/elfcopy/segments.c2
-rw-r--r--contrib/elftoolchain/readelf/readelf.c19
4 files changed, 19 insertions, 4 deletions
diff --git a/contrib/elftoolchain/elfcopy/elfcopy.h b/contrib/elftoolchain/elfcopy/elfcopy.h
index 5593a9a..c152588 100644
--- a/contrib/elftoolchain/elfcopy/elfcopy.h
+++ b/contrib/elftoolchain/elfcopy/elfcopy.h
@@ -127,6 +127,7 @@ struct section {
uint64_t cap; /* section capacity */
uint64_t align; /* section alignment */
uint64_t type; /* section type */
+ uint64_t flags; /* section flags */
uint64_t vma; /* section virtual addr */
uint64_t lma; /* section load addr */
uint64_t pad_sz;/* section padding size */
diff --git a/contrib/elftoolchain/elfcopy/sections.c b/contrib/elftoolchain/elfcopy/sections.c
index 298fce4..b292d18 100644
--- a/contrib/elftoolchain/elfcopy/sections.c
+++ b/contrib/elftoolchain/elfcopy/sections.c
@@ -411,6 +411,7 @@ create_scn(struct elfcopy *ecp)
s->sz = ish.sh_size;
s->align = ish.sh_addralign;
s->type = ish.sh_type;
+ s->flags = ish.sh_flags;
s->vma = ish.sh_addr;
/*
diff --git a/contrib/elftoolchain/elfcopy/segments.c b/contrib/elftoolchain/elfcopy/segments.c
index 9a26bba..27d5e7a 100644
--- a/contrib/elftoolchain/elfcopy/segments.c
+++ b/contrib/elftoolchain/elfcopy/segments.c
@@ -79,6 +79,8 @@ add_to_inseg_list(struct elfcopy *ecp, struct section *s)
continue;
if (s->vma + s->sz > seg->vaddr + seg->msz)
continue;
+ if (seg->type == PT_TLS && ((s->flags & SHF_TLS) == 0))
+ continue;
insert_to_inseg_list(seg, s);
if (seg->type == PT_LOAD)
diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c
index b4d0790..bed7919 100644
--- a/contrib/elftoolchain/readelf/readelf.c
+++ b/contrib/elftoolchain/readelf/readelf.c
@@ -2377,11 +2377,22 @@ dump_phdr(struct readelf *re)
}
printf(" %2.2d ", i);
/* skip NULL section. */
- for (j = 1; (size_t)j < re->shnum; j++)
- if (re->sl[j].addr >= phdr.p_vaddr &&
- re->sl[j].addr + re->sl[j].sz <=
+ for (j = 1; (size_t)j < re->shnum; j++) {
+ if (re->sl[j].off < phdr.p_offset)
+ continue;
+ if (re->sl[j].off + re->sl[j].sz >
+ phdr.p_offset + phdr.p_filesz &&
+ re->sl[j].type != SHT_NOBITS)
+ continue;
+ if (re->sl[j].addr < phdr.p_vaddr ||
+ re->sl[j].addr + re->sl[j].sz >
phdr.p_vaddr + phdr.p_memsz)
- printf("%s ", re->sl[j].name);
+ continue;
+ if (phdr.p_type == PT_TLS &&
+ (re->sl[j].flags & SHF_TLS) == 0)
+ continue;
+ printf("%s ", re->sl[j].name);
+ }
printf("\n");
}
#undef PH_HDR
OpenPOWER on IntegriCloud