[SeaBIOS] [PATCH v2] Use readelf -WSrs instead of objdump -thr so that llvm-readelf can be used as a replacement

2020-04-01 Thread Fangrui Song
objdump -h relies heavily on BFD internals and the BFD flags are difficult to emulate in llvm-objdump. llvm-objdump -h has a different output (https://reviews.llvm.org/D57146) Switch to readelf, which is generally better than objdump when dumping ELF section/symbol information. Signed-off-by: F

[SeaBIOS] [PATCH 3/4] romlayout32flag.lds: Use `. +=` instead of `. =`

2020-04-01 Thread Fangrui Song
This improves the portability of the linker script and allows lld to link rom.o Dot assignment inside an output section has an inconsistent behavior which makes lld difficult to implement. See https://bugs.llvm.org/show_bug.cgi?id=43083 Dropping `. =` turns out to be beneficial to older GNU ld as

[SeaBIOS] [PATCH 1/4] Make rom16.o linkable with lld

2020-04-01 Thread Fangrui Song
(1) In romlayout.S, .fixedaddr.\addr sections do have not the SHF_ALLOC flag. It does not make sense to reference a SHF_ALLOC section from a non-SHF_ALLOC section via R_386_PC16. GNU ld allows it but lld will warn. Add the SHF_ALLOC flag. (2) lld requires output section descriptions to be sorted

[SeaBIOS] [PATCH 0/4] Make seabios linkable with lld

2020-04-01 Thread Fangrui Song
This patch series make seabios linkable with lld. This is beneficial for FreeBSD ports as well https://svnweb.freebsd.org/ports/head/misc/seabios/Makefile as they can drop an LLD_UNSAFE As a maintainer of lld ELF, I have triaged numerous pieces of software. seabios is the only one making use of

[SeaBIOS] [PATCH 2/4] Makefile: Change ET_EXEC to ET_REL so that lld can link bios.bin.elf

2020-04-01 Thread Fangrui Song
Accepting ET_EXEC as an input file is an extremely rare GNU ld feature that lld does not intend to support, because this is error-prone. See Linux kernel commit 90ceddcb495008ac8ba7a3dce297841efcd7d584 for another use of the dd trick. -- Changes v1 -> v2 * Add status=none to the dd command line.

[SeaBIOS] [PATCH 4/4] test-build.sh: Delete unneeded LD capability test

2020-04-01 Thread Fangrui Song
The previous commit changed romlayout32flag.lds to use `. += ` instead of `. =`. We no longer need the LD capability test checking https://sourceware.org/bugzilla/show_bug.cgi?id=12726 Signed-off-by: Fangrui Song --- scripts/test-build.sh | 42 +- 1 file c