Page MenuHomeFreeBSD

Fixed bug where elfcopy --add-section needs to be called twice for section to be created
ClosedPublic

Authored by tig_freebsdfoundation.org on Feb 7 2020, 3:56 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 6:47 AM
Unknown Object (File)
Mon, Nov 11, 4:33 AM
Unknown Object (File)
Oct 13 2024, 5:00 AM
Unknown Object (File)
Oct 3 2024, 12:05 PM
Unknown Object (File)
Sep 28 2024, 12:12 PM
Unknown Object (File)
Sep 18 2024, 6:07 PM
Unknown Object (File)
Sep 4 2024, 9:05 PM
Unknown Object (File)
Aug 31 2024, 7:00 AM
Subscribers

Details

Summary

The create_scn() (create section) function wants to place the new section before .shstrtab section but this section is added to the elf later in the main code. Thus it fails the first time and succeed the second time. I added a check so that if .shstrtab is not present the code still calls the insert_section function.
Bugzilla: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241437

Test Plan

image.png (885×650 px, 82 KB)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Thank you for the investigation and patch. I commented on a few minor items, I will update them before committing to svn (i.e., no need to reupload).

contrib/elftoolchain/elfcopy/sections.c
343 ↗(On Diff #67939)

I'd probably call the new variable sections_added, and we can use C99 bool.

443–444 ↗(On Diff #67939)

style(9) wants the /* on its own line, i.e.

/*
 * Like this
 */
This revision is now accepted and ready to land.Feb 12 2020, 8:21 PM