https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216316

--- Comment #10 from Michael Brown <mc...@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.
_______________________________________________
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"

Reply via email to