Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143811500
D23571.id67939.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23571.id67939.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D23571: Fixed bug where elfcopy --add-section needs to be called twice for section to be created
Attached
Detach File
Event Timeline
Log In to Comment