Attempting to boot Memtest86+ 5.01, linked using Gold, causes EXTLINUX to report the error "Invalid argument." Rebuilding Memtest86+ using the BFD linker produces a binary that boots correctly. You can see there is a significant difference in the file size of the produced binary when built using Gold versus BFD ld. $ x86_64-pc-linux-gnu-ld --version | head -n1 GNU gold (Gentoo 2.25.1 p1.1 2.25.1) 1.11 # ebuild /usr/portage/sys-apps/memtest86+/memtest86+-5.01-r1.ebuild clean install &>/dev/null && ls -l /var/tmp/portage/sys-apps/memtest86+-5.01-r1/image/boot/memtest86plus total 344 -rw-r--r-- 1 root root 175260 16-Apr-2016 06:11 memtest lrwxrwxrwx 1 root root 7 16-Apr-2016 06:11 memtest.bin -> memtest -rw-r--r-- 1 root root 172648 16-Apr-2016 06:11 memtest.netbsd # cat > /etc/portage/env/sys-apps/memtest86+ <<EOF post_src_prepare() { default tc-ld-disable-gold } EOF # ebuild /usr/portage/sys-apps/memtest86+/memtest86+-5.01-r1.ebuild clean install &>/dev/null && ls -l /var/tmp/portage/sys-apps/memtest86+-5.01-r1/image/boot/memtest86plus total 364 -rw-r--r-- 1 root root 182704 16-Apr-2016 06:13 memtest lrwxrwxrwx 1 root root 7 16-Apr-2016 06:13 memtest.bin -> memtest -rw-r--r-- 1 root root 1228860 16-Apr-2016 06:13 memtest.netbsd Suggest adding a call to "tc-ld-disable-gold" in the ebuild to force usage of the BFD linker.
ld.gold mislinks both sys-apps/memtest86 and sys-apps/memtest86+: file /boot/memtest86/memtest /boot/memtest86plus/memtest /boot/memtest86plus/memtest.netbsd /boot/memtest86/memtest: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped /boot/memtest86plus/memtest: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped /boot/memtest86plus/memtest.netbsd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped Look at official binaries: file memtest86* memtest86+-5.01.bin: DOS/MBR boot sector memtest86-6.3.0.bin: DOS/MBR boot sector Custom built with gold (which are ELF) won't boot with lilo, while offical binaries which are boot sector work. Custom built with ld.bfd work.
thanks, fixed here: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a43bc15ed29f659a2b70164b032fb686fcdc2869