[Bug 216316] objcopy (elfcopy) in 11 appears to have a regression compared to the version in 10
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sun Jan 31 14:54:11 UTC 2021
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216316
--- Comment #10 from Michael Brown <mcb30 at ipxe.org> ---
(In reply to Ed Maste from comment #8)
>From looking at elfcopy/binary.c and its create_binary() function: it appears
that elfcopy will use sh_offset to calculate the position within the final
binary file (rather than the LMA or even the VMA). Since sh_offset is
meaningless once the ELF headers have been stripped away, this behaviour is
provably incorrect for anything other than extracting a single section via "-j
<section>".
Building elfcopy from source confirms this behaviour from the current code.
So, we have three possible behaviours:
1. binutils objcopy
Uses the section LMA to determine the offset within the output file. As above,
I would say that this behaviour is correct.
2. FreeBSD objcopy as present in binary distributions
Uses the section VMA to determine the offset within the output file. As above,
I would say that this behaviour is wrong.
3. FreeBSD objcopy as built from source
Uses the section sh_offset to determine the offset within the output file.
This behaviour is very definitely wrong.
I am puzzled why I get different behaviour from the FreeBSD binary and source
distributions, particularly since the use of sh_offset appears to have been
present since 2010.
Michael
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-toolchain
mailing list