Building FreeBSD with LTO

Hello,
I'm trying to build FreeBSD with Link Time Optimization enabled. Here's what I have at the moment:

Code:
$ cat /etc/make.conf

CPUTYPE?=ivybridge
CFLAGS+=-O2 -fomit-frame-pointer -momit-leaf-frame-pointer -flto
COPTFLAGS+=-O2 -fomit-frame-pointer -momit-leaf-frame-pointer -flto
AR=/usr/bin/llvm-ar
ARFLAGS=cr
NM=/usr/bin/llvm-nm
RANLIB=/usr/bin/llvm-ranlib
RANLIBFLAGS=

Code:
$ ll /usr/bin/ld
lrwxr-xr-x  1 root  wheel  uarch 6 14 янв.  12:53 /usr/bin/ld -> ld.lld

During the linking of kernel I get following error:

Code:
linking kernel
ld: error: ld-temp.o:(function dmu_get_recursive_snaps_nvl): relocation R_X86_64_32 out of range: 18446744071575402064 is not in [0, 4294967295]
ld: error: ld-temp.o:(function dmu_get_recursive_snaps_nvl): relocation R_X86_64_32 out of range: 18446744071565769200 is not in [0, 4294967295]
ld: error: ld-temp.o:(function init_TSC): relocation R_X86_64_32 out of range: 18446744071573270148 is not in [0, 4294967295]
ld: error: ld-temp.o:(function dmu_get_recursive_snaps_nvl): relocation R_X86_64_32 out of range: 18446744071575402064 is not in [0, 4294967295]
ld: error: ld-temp.o:(function dsl_check_snap_cb): relocation R_X86_64_32 out of range: 18446744071573558911 is not in [0, 4294967295]
ld: error: ld-temp.o:(function dsl_check_snap_cb): relocation R_X86_64_32 out of range: 18446744071575402064 is not in [0, 4294967295]
ld: error: ld-temp.o:(function init_TSC): relocation R_X86_64_32 out of range: 18446744071573308189 is not in [0, 4294967295]
...
ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
*** [kernel] Error code 1

If I build the kernel with -fPIC option and LDFLAGS+=--pie -z notext , kernel does compile, but is not bootable. AFAIK it shouldn't be built like that.
Someone knows how to solve the issue?

Regards,
K.
 
I feel the right place to put that would be /etc/src-env.conf, and this kind of subject usually evolve better in the mail lists. ;)
 
Back
Top