09.07.2020 19:05, Kevin O'Connor wrote:
On Thu, Jul 09, 2020 at 06:49:37PM +0300, Michael Tokarev wrote:
..
What's wrong with changing seabios as done by Fāng-ruì Sòng?
..
https://www.mail-archive.com/seabios@seabios.org/msg12189.html
The proposed approach is to use a combination of printf and dd to binary modify the intermediate object file so as to clear the (now banned) linker flag. I did feel, and continue to feel, this is an ugly hack that is fragile.
Yes it smells ugly. ld doesn't have a way to specify e_type, does it?
Speaking of patching the object file, - it is always the same byte, since elf format specifies its placement, meaning and possible values, all utilities who understand elf know this place (byte #16).
While still being ugly, maybe it's more elegant to use a small python script instead of printf|dd, - a script that'll open file and write single byte at offset 16..
I dunno. To me the thing from ld PoV smells like seabios is using an ugly hack to link the binary..
/mjt