LLD ELF2 is at the point where it's worthwhile for me to resume
investigating LLD as the FreeBSD base system linker
(llvm.org/pr23214). At this point I don't think there's value in
tracking these in PRs but do want to capture what I've found.
* PT_INTERP and ABI notes must be in the first page
ELF2 currently rounds up to a page and stores the data for PT_INTERP
and the NT_FREEBSD_ABI_TAG and NT_FREEBSD_NOINIT_TAG ELF notes there.
These have to be in the first page on FreeBSD.
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flg Align
INTERP 0x00000000000010cc 0x00000000000110cc 0x00000000000110cc
0x0000000000000015 0x0000000000000015 R 0x1
[Requesting program interpreter: /libexec/ld-elf.so.1]
* Undefined sym in shared library provided by regular object
This is the FreeBSD __progname issue fixed in r218259 for the original
ELF linker.
* Options used in the FreeBSD base system
These are options that need to be ignored or implemented (excluding
those already ignored by ELF2)
--enable-new-dtags
--fatal-warnings and --no-fatal-warnings
--warn-shared-textrel
--output-filetype
--version-script
-Bsymbolic
-r
-znodelete
--no-warn-mismatch
--warn-common
-T
* Linker script support
The FreeBSD base system linker scripts use (at least) the following set:
ALIGN ENTRY GROUP KEEP OUTPUT_ARCH OUTPUT_FORMAT SEARCH_DIR SECTIONS PROVIDE
Joerg Sonnenberger via llvm-dev
2015-Oct-06 20:27 UTC
[llvm-dev] FreeBSD notes for ELF2 LLD
On Tue, Oct 06, 2015 at 09:39:44AM -0400, Ed Maste via llvm-dev wrote:> * PT_INTERP and ABI notes must be in the first pageThis is a common requirement for many kernels and where it isn't, it adds at least a non-significant penalty to not do so.> * Undefined sym in shared library provided by regular object > > This is the FreeBSD __progname issue fixed in r218259 for the original > ELF linker.Just for others, the problem here is that if the main binary defines a symbol foo and any shared library it is linked against has a reference to foo, it must be exported. Joerg