Page MenuHomeFreeBSD

D23571.id67939.diff
No OneTemporary

D23571.id67939.diff

Index: contrib/elftoolchain/elfcopy/sections.c
===================================================================
--- contrib/elftoolchain/elfcopy/sections.c
+++ contrib/elftoolchain/elfcopy/sections.c
@@ -340,7 +340,9 @@
GElf_Shdr ish;
size_t indx;
uint64_t oldndx, newndx;
- int elferr, sec_flags, reorder;
+ int elferr, sec_flags, shstrtab_exist, reorder;
+
+ shstrtab_exist = 0;
/*
* Insert a pseudo section that contains the ELF header
@@ -438,12 +440,15 @@
oldndx = newndx = SHN_UNDEF;
if (strcmp(name, ".symtab") != 0 &&
strcmp(name, ".strtab") != 0) {
+ /* Add sections before .shstrtab OR before last section
+ * if .shstrtab hasn't been added yet */
if (!strcmp(name, ".shstrtab")) {
/*
* Add sections specified by --add-section and
* gnu debuglink. we want these sections have
* smaller index than .shstrtab section.
*/
+ shstrtab_exist = 1;
if (ecp->debuglink != NULL)
add_gnu_debuglink(ecp);
if (ecp->flags & SEC_ADD)
@@ -505,6 +510,13 @@
insert_to_sec_list(ecp, s, 0);
}
+
+ if (!shstrtab_exist) {
+ if (ecp->debuglink != NULL)
+ add_gnu_debuglink(ecp);
+ if (ecp->flags & SEC_ADD)
+ insert_sections(ecp);
+ }
elferr = elf_errno();
if (elferr != 0)
errx(EXIT_FAILURE, "elf_nextscn failed: %s",

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 1, 3:02 PM (5 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28394516
Default Alt Text
D23571.id67939.diff (1 KB)

Event Timeline