Re: HEADS-UP: Linker issues building amd64 kernels with config & make

From: Julian H. Stacey <jhs_at_berklix.com>
Date: Tue, 15 May 2018 00:05:45 +0200
Ed Maste wrote:
> As of r333461 the amd64 kernel makes use of ifuncs, and requires
> support in the linker. A safety belt added in r333470 enforces this,
> and will produce an explicit error if the linker does not support
> ifuncs.
> 
> lld is the default bootstrap linker for amd64 and has ifunc support.
> The typical 'make buildworld' (or kernel-toolchain) followed by 'make
> buildkernel' process will use lld and successfully link a working
> kernel.
> 
> The old-style kernel build (using 'config' followed by a 'make' in the
> kernel directory) uses the host linker (/usr/bin/ld). This still
> defaults to GNU ld 2.17.50, which does not support ifuncs. This can be
> worked around in one of two ways:
> 
> 1. Install lld as the system linker (/usr/bin/ld), by adding
> WITH_LLD_IS_LD to /etc/src.conf and building and install world.
> WITH_LLD_IS_LD will become the default on amd64 in the near future -
> I'm just waiting on updates to the lang/ghc port and another exp-run.
> 
> 2. Override LD when you build the kernel:
> $ LD=ld.lld make
> 
> These tool chain components will undergo additional changes for the next while.

I guess this explains :
Date: Sun, 13 May 2018 20:26:38 +0200
Subject: cd /sys/amd64/compile/GENERIC;make cleandepend; make cleandepend
	.svn_revision 333575
	linking kernel.full
	iflib.o:(.rodata+0x178): undefined reference to `noop_attach'
	iflib.o:(.rodata+0x188): undefined reference to `iflib_pseudo_detach'

PS Bloat factor > 20: 2M static V 40M dynamic, 
(normaly dynamics are smaller, not larger).
	cd /usr/bin; ls -l *ld*
	-r-xr-xr-x  2 root  wheel   1935992 May 13 12:48 ld*
	-r-xr-xr-x  1 root  wheel  40449288 May 13 12:54 ld.lld*
	file ld ld.lld
	ld:     ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD),
		 statically linked,
		 for FreeBSD 12.0 (1200063), FreeBSD-style, stripped
	ld.lld: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD),
		 dynamically linked, interpreter /libexec/ld-elf.so.1,
		 for FreeBSD 12.0 (1200063), FreeBSD-style, stripped

Cheers,
Julian
-- 
Julian Stacey, Computer Consultant, Systems Engineer, BSD Linux Unix, Munich
 Brexit Referendum stole 3,700,000 votes, inc. 700,000 from British in EU.
 UK Govt. lied it's "democratic" in Article 50 letter to EU paragraph 3.
 		Petition for votes: http://berklix.eu/queen/
Received on Mon May 14 2018 - 20:06:13 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:16 UTC