Discussion:
Can't build kernel anymore: amd64 kernel requires linker ifunc support
Emeric POUPON
2018-05-16 07:37:20 UTC
Permalink
Hello,

Maybe I missed something, but I recently updated /usr/src (HEAD) and I can't build the kernel anymore, I get this:

# make -j4 buildkernel
--- buildkernel ---
make[1]: "/usr/src/Makefile.inc1" line 166: SYSTEM_COMPILER: Determined that CC=cc matches the source tree. Not bootstrapping a cross-compiler.
--- buildkernel ---

--------------------------------------------------------------
Kernel build for GENERIC started on Wed May 16 09:35:03 CEST 2018
--------------------------------------------------------------
===> GENERIC
mkdir -p /usr/obj/usr/src/amd64.amd64/sys
--------------------------------------------------------------
stage 1: configuring the kernel
--------------------------------------------------------------
cd /usr/src/sys/amd64/conf; PATH=/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin:/usr/obj/usr/src/amd64.amd64/tmp/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin config -d /usr/obj/usr/src/amd64.amd64/sys/GENERIC -I '/usr/src/sys/amd64/conf' '/usr/src/sys/amd64/conf/GENERIC'
Kernel build directory is /usr/obj/usr/src/amd64.amd64/sys/GENERIC
Don't forget to do ``make cleandepend && make depend''
--------------------------------------------------------------
stage 2.1: cleaning up the object tree
--------------------------------------------------------------
cd /usr/obj/usr/src/amd64.amd64/sys/GENERIC; COMPILER_VERSION=60000 COMPILER_FEATURES=" c++11 retpoline" COMPILER_TYPE=clang COMPILER_FREEBSD_VERSION=1200014 MACHINE_ARCH=amd64 MACHINE=amd64 CPUTYPE= CC="cc -target x86_64-unknown-freebsd12.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin" CXX="c++ -target x86_64-unknown-freebsd12.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin" CPP="cpp -target x86_64-unknown-freebsd12.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin" AS="as" AR="ar" LD="ld" LLVM_LINK="" NM=nm OBJCOPY="objcopy" RANLIB=ranlib STRINGS= SIZE="size" INSTALL="sh /usr/src/tools/install.sh" PATH=/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin:/usr/obj/usr/src/amd64.amd64/tmp/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin make -j 4 -
J 15,16 -m /usr/src/share/mk KERNEL=kernel cleandir
make[2]: "/usr/src/sys/conf/kern.pre.mk" line 125: amd64 kernel requires linker ifunc support
*** [buildkernel] Error code 1

make[1]: stopped in /usr/src
1 error



How can I proceed?

Regards,
Oliver Pinter
2018-05-16 07:47:48 UTC
Permalink
Post by Emeric POUPON
Hello,
Maybe I missed something, but I recently updated /usr/src (HEAD) and I
# make -j4 buildkernel
--- buildkernel ---
make[1]: "/usr/src/Makefile.inc1" line 166: SYSTEM_COMPILER: Determined
that CC=cc matches the source tree. Not bootstrapping a cross-compiler.
--- buildkernel ---
--------------------------------------------------------------
Kernel build for GENERIC started on Wed May 16 09:35:03 CEST 2018
--------------------------------------------------------------
===> GENERIC
mkdir -p /usr/obj/usr/src/amd64.amd64/sys
--------------------------------------------------------------
stage 1: configuring the kernel
--------------------------------------------------------------
cd /usr/src/sys/amd64/conf; PATH=/usr/obj/usr/src/amd64.
amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/
tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/
legacy/bin:/usr/obj/usr/src/amd64.amd64/tmp/usr/sbin:/usr/
obj/usr/src/amd64.amd64/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin
config -d /usr/obj/usr/src/amd64.amd64/sys/GENERIC -I
'/usr/src/sys/amd64/conf' '/usr/src/sys/amd64/conf/GENERIC'
Kernel build directory is /usr/obj/usr/src/amd64.amd64/sys/GENERIC
Don't forget to do ``make cleandepend && make depend''
--------------------------------------------------------------
stage 2.1: cleaning up the object tree
--------------------------------------------------------------
cd /usr/obj/usr/src/amd64.amd64/sys/GENERIC; COMPILER_VERSION=60000
COMPILER_FEATURES=" c++11 retpoline" COMPILER_TYPE=clang
COMPILER_FREEBSD_VERSION=1200014 MACHINE_ARCH=amd64 MACHINE=amd64
CPUTYPE= CC="cc -target x86_64-unknown-freebsd12.0
--sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin"
CXX="c++ -target x86_64-unknown-freebsd12.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp
-B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin" CPP="cpp -target
x86_64-unknown-freebsd12.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp
-B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin" AS="as" AR="ar" LD="ld"
LLVM_LINK="" NM=nm OBJCOPY="objcopy" RANLIB=ranlib STRINGS= SIZE="size"
INSTALL="sh /usr/src/tools/install.sh" PATH=/usr/obj/usr/src/amd64.
amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/
tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/
legacy/bin:/usr/obj/usr/src/amd64.amd64/tmp/usr/sbin:/usr/
obj/usr/src/amd64.amd64/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin make
-j 4 -
J 15,16 -m /usr/src/share/mk KERNEL=kernel cleandir
make[2]: "/usr/src/sys/conf/kern.pre.mk" line 125: amd64 kernel requires
linker ifunc support
*** [buildkernel] Error code 1
make[1]: stopped in /usr/src
1 error
How can I proceed?
Please consult the ${srctop}/UPDATING file or search back on freebsd
current mail list.

Hint: buildworld before kernel
Post by Emeric POUPON
Regards,
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
Emeric POUPON
2018-05-16 09:07:35 UTC
Permalink
Post by Oliver Pinter
Post by Emeric POUPON
make[2]: "/usr/src/sys/conf/kern.pre.mk" line 125: amd64 kernel requires
linker ifunc support
*** [buildkernel] Error code 1
make[1]: stopped in /usr/src
1 error
How can I proceed?
Please consult the ${srctop}/UPDATING file or search back on freebsd
current mail list.
Hint: buildworld before kernel
Thanks for your help.

Actually, I already did all the steps described here: https://www.freebsd.org/doc/handbook/makeworld.html with success.
After step 10, I now get this error.
I tried to put WITHOUT_LLD_BOOTSTRAP=yes in /etc/src.conf + rebuild everything with no luck.

Regards,
Oliver Pinter
2018-05-16 09:20:50 UTC
Permalink
Post by Emeric POUPON
Post by Oliver Pinter
Post by Emeric POUPON
make[2]: "/usr/src/sys/conf/kern.pre.mk" line 125: amd64 kernel
requires
Post by Oliver Pinter
Post by Emeric POUPON
linker ifunc support
*** [buildkernel] Error code 1
make[1]: stopped in /usr/src
1 error
How can I proceed?
Please consult the ${srctop}/UPDATING file or search back on freebsd
current mail list.
Hint: buildworld before kernel
Thanks for your help.
https://www.freebsd.org/doc/handbook/makeworld.html with success.
After step 10, I now get this error.
I tried to put WITHOUT_LLD_BOOTSTRAP=yes in /etc/src.conf + rebuild
everything with no luck.
Please remove this line from your src.conf, lld is required for building
kernel since the ifunc support.
Post by Emeric POUPON
Regards,
Emeric POUPON
2018-05-16 09:42:33 UTC
Permalink
Post by Oliver Pinter
Post by Emeric POUPON
Thanks for your help.
https://www.freebsd.org/doc/handbook/makeworld.html with success.
After step 10, I now get this error.
I tried to put WITHOUT_LLD_BOOTSTRAP=yes in /etc/src.conf + rebuild
everything with no luck.
Please remove this line from your src.conf, lld is required for building
kernel since the ifunc support.
I already did all the steps of the handbook without this line, and I finally had the issue I described.
What I told is that adding this line + make buildworld does not solve the kernel building issue.
Hans Petter Selasky
2018-05-16 09:49:15 UTC
Permalink
Post by Emeric POUPON
Post by Oliver Pinter
Post by Emeric POUPON
Thanks for your help.
https://www.freebsd.org/doc/handbook/makeworld.html with success.
After step 10, I now get this error.
I tried to put WITHOUT_LLD_BOOTSTRAP=yes in /etc/src.conf + rebuild
everything with no luck.
Please remove this line from your src.conf, lld is required for building
kernel since the ifunc support.
I already did all the steps of the handbook without this line, and I finally had the issue I described.
What I told is that adding this line + make buildworld does not solve the kernel building issue.
Try adding:

-m $PWD/share/mk

After make.

Not sure if it helps.

--HPS
Warner Losh
2018-05-16 13:22:42 UTC
Permalink
Post by Hans Petter Selasky
Post by Emeric POUPON
Thanks for your help.
Post by Oliver Pinter
Post by Emeric POUPON
https://www.freebsd.org/doc/handbook/makeworld.html with success.
After step 10, I now get this error.
I tried to put WITHOUT_LLD_BOOTSTRAP=yes in /etc/src.conf + rebuild
everything with no luck.
Please remove this line from your src.conf, lld is required for building
kernel since the ifunc support.
I already did all the steps of the handbook without this line, and I
finally had the issue I described.
What I told is that adding this line + make buildworld does not solve the
kernel building issue.
-m $PWD/share/mk
After make.
Not sure if it helps.
LD=ld.lld make

is the magic here. The kernel needs a new linker to properly link in the
ifunc, and that's not our ancient ld. lld does it, as does the latter-day
binutils.

Warner
Emeric POUPON
2018-05-17 12:11:11 UTC
Permalink
Post by Warner Losh
LD=ld.lld make
is the magic here. The kernel needs a new linker to properly link in the
ifunc, and that's not our ancient ld. lld does it, as does the latter-day
binutils.
Warner
Thanks a lot, that works fine!

Emeric

Rodney W. Grimes
2018-05-16 13:35:57 UTC
Permalink
Post by Warner Losh
Post by Hans Petter Selasky
Post by Emeric POUPON
Thanks for your help.
Post by Oliver Pinter
Post by Emeric POUPON
https://www.freebsd.org/doc/handbook/makeworld.html with success.
After step 10, I now get this error.
I tried to put WITHOUT_LLD_BOOTSTRAP=yes in /etc/src.conf + rebuild
everything with no luck.
Please remove this line from your src.conf, lld is required for building
kernel since the ifunc support.
I already did all the steps of the handbook without this line, and I
finally had the issue I described.
What I told is that adding this line + make buildworld does not solve the
kernel building issue.
-m $PWD/share/mk
After make.
Not sure if it helps.
LD=ld.lld make
is the magic here. The kernel needs a new linker to properly link in the
ifunc, and that's not our ancient ld. lld does it, as does the latter-day
binutils.
Since this now seems to be a mandatory thing to get a kernel built
can it please be set in the Makefile that is needing it?
--
Rod Grimes ***@freebsd.org
Ed Maste
2018-05-16 14:43:08 UTC
Permalink
On 16 May 2018 at 09:35, Rodney W. Grimes
Post by Rodney W. Grimes
Post by Warner Losh
LD=ld.lld make
is the magic here. The kernel needs a new linker to properly link in the
ifunc, and that's not our ancient ld. lld does it, as does the latter-day
binutils.
Since this now seems to be a mandatory thing to get a kernel built
can it please be set in the Makefile that is needing it?
It's already handled by the Makefile that needs it when using the
normal build process - i.e., "make buildworld buildkernel" (or
toolchain or kernel-toolchain followed by buildkernel).

The failure arises when building a kernel the "old" way, using config
and then and make in the kernel directory. This inherently uses the
host's linker (/usr/bin/ld), which is too old to link the kernel. We
can't just add LD=ld.lld to the kernel's Makefile(s), because it would
break external toolchain and other cases where users use a specific
linker. I hope to introduce a KERNEL_LD Make variable that controls
the linker used for the kernel link, but it's more involved than a one
or two line change for the same reason that we can't just set
LD=ld.lld.

ld.lld will start being installed as /usr/bin/ld once these two issues
are resolved:

pr227968 [exp-run] Update lang/ghc to 8.4.2, devel/stack to 1.7.1, and
all the */hs-* ports
pr214864 [exp-run] test build with lld as /usr/bin/ld

The exp-run for the first is complete and I believe we are now just
waiting on the change to be committed. As soon as that happens I will
ask for another exp-run for the second PR, and will commit the change
to install lld by default as soon as it completes (assuming
successfully).
Warner Losh
2018-05-16 13:43:18 UTC
Permalink
On Wed, May 16, 2018 at 7:35 AM, Rodney W. Grimes <
Post by Oliver Pinter
Post by Warner Losh
Post by Hans Petter Selasky
Post by Emeric POUPON
Thanks for your help.
Post by Oliver Pinter
Post by Emeric POUPON
https://www.freebsd.org/doc/handbook/makeworld.html with success.
After step 10, I now get this error.
I tried to put WITHOUT_LLD_BOOTSTRAP=yes in /etc/src.conf + rebuild
everything with no luck.
Please remove this line from your src.conf, lld is required for
building
Post by Warner Losh
Post by Hans Petter Selasky
Post by Emeric POUPON
Post by Oliver Pinter
kernel since the ifunc support.
I already did all the steps of the handbook without this line, and I
finally had the issue I described.
What I told is that adding this line + make buildworld does not solve
the
Post by Warner Losh
Post by Hans Petter Selasky
Post by Emeric POUPON
kernel building issue.
-m $PWD/share/mk
After make.
Not sure if it helps.
LD=ld.lld make
is the magic here. The kernel needs a new linker to properly link in the
ifunc, and that's not our ancient ld. lld does it, as does the latter-day
binutils.
Since this now seems to be a mandatory thing to get a kernel built
can it please be set in the Makefile that is needing it?
No. It's a transient requirement that will be gone shortly when Ed does the
next step of lld integration.

Wanrer
Rodney W. Grimes
2018-05-16 15:11:12 UTC
Permalink
Post by Ed Maste
On 16 May 2018 at 09:35, Rodney W. Grimes
Post by Rodney W. Grimes
Post by Warner Losh
LD=ld.lld make
is the magic here. The kernel needs a new linker to properly link in the
ifunc, and that's not our ancient ld. lld does it, as does the latter-day
binutils.
Since this now seems to be a mandatory thing to get a kernel built
can it please be set in the Makefile that is needing it?
It's already handled by the Makefile that needs it when using the
normal build process - i.e., "make buildworld buildkernel" (or
toolchain or kernel-toolchain followed by buildkernel).
The failure arises when building a kernel the "old" way, using config
and then and make in the kernel directory. This inherently uses the
host's linker (/usr/bin/ld), which is too old to link the kernel. We
can't just add LD=ld.lld to the kernel's Makefile(s), because it would
break external toolchain and other cases where users use a specific
linker. I hope to introduce a KERNEL_LD Make variable that controls
the linker used for the kernel link, but it's more involved than a one
or two line change for the same reason that we can't just set
LD=ld.lld.
ld.lld will start being installed as /usr/bin/ld once these two issues
...

In the meantime what about reverting the ifunc usage until this
can be done?
Post by Ed Maste
pr227968 [exp-run] Update lang/ghc to 8.4.2, devel/stack to 1.7.1, and
all the */hs-* ports
pr214864 [exp-run] test build with lld as /usr/bin/ld
The exp-run for the first is complete and I believe we are now just
waiting on the change to be committed. As soon as that happens I will
ask for another exp-run for the second PR, and will commit the change
to install lld by default as soon as it completes (assuming
successfully).
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
--
Rod Grimes ***@freebsd.org
Warner Losh
2018-05-16 19:46:43 UTC
Permalink
On Wed, May 16, 2018 at 1:34 PM, Oliver Pinter <
Post by Rodney W. Grimes
Post by Ed Maste
On 16 May 2018 at 09:35, Rodney W. Grimes
Post by Rodney W. Grimes
Post by Warner Losh
LD=ld.lld make
is the magic here. The kernel needs a new linker to properly link in the
ifunc, and that's not our ancient ld. lld does it, as does the latter-day
binutils.
Since this now seems to be a mandatory thing to get a kernel built
can it please be set in the Makefile that is needing it?
It's already handled by the Makefile that needs it when using the
normal build process - i.e., "make buildworld buildkernel" (or
toolchain or kernel-toolchain followed by buildkernel).
The failure arises when building a kernel the "old" way, using config
and then and make in the kernel directory. This inherently uses the
host's linker (/usr/bin/ld), which is too old to link the kernel. We
can't just add LD=ld.lld to the kernel's Makefile(s), because it would
break external toolchain and other cases where users use a specific
linker. I hope to introduce a KERNEL_LD Make variable that controls
the linker used for the kernel link, but it's more involved than a one
or two line change for the same reason that we can't just set
LD=ld.lld.
ld.lld will start being installed as /usr/bin/ld once these two issues
...
In the meantime what about reverting the ifunc usage until this
can be done?
Nope. If somebody take trouble over compiling their kernel manually,
then at least
read the documentation, how to compile their system in the new way.
We talking about 12-CURRENT and not about 1X-STABLE branches....
IMHO, this is an acceptable breakage for -current. This is on the 'experts
only' path and there's a note in UPDATING to cope. We don't intend to keep
it that way forever, and the benefit of getting useful testing from a wider
audience in this case, imho, out weights the minor inconvenience for the
small minority of users that go old-school.

Warner
Loading...