Clang supports -ftrivial-auto-var-init=zero, but required a special option to enable it -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang The special option is not required as of Clang 16. We no longer support building with older Clang versions, so remove it.
Details
Details
- Reviewers
- None
- Group Reviewers
build
Diff Detail
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
| sys/conf/kern.mk | ||
|---|---|---|
| 207–208 | Looks like ELFv2 has been default since clang 14 or so, since 2020-ish if my git history grepping is right. | |
Comment Actions
With CROSS_TOOLCHAIN=llvm15 the build fails in libunwind
In file included from /root/freebsd/contrib/llvm-project/libunwind/src/libunwind.cpp:14:
In file included from /root/freebsd/contrib/llvm-project/libunwind/src/config.h:19:
In file included from /usr/obj/root/freebsd/amd64.amd64/tmp/usr/include/c++/v1/stdlib.h:109:
In file included from /usr/obj/root/freebsd/amd64.amd64/tmp/usr/include/c++/v1/__math/abs.h:14:
In file included from /usr/obj/root/freebsd/amd64.amd64/tmp/usr/include/c++/v1/__type_traits/is_integral.h:14:
/usr/obj/root/freebsd/amd64.amd64/tmp/usr/include/c++/v1/__type_traits/remove_cv.h:22:32: error: unknown type name '__remove_cv'; did you mean 'remove_cv'?
using type _LIBCPP_NODEBUG = __remove_cv(_Tp);
^and with llvm16 in kernel:
o-address-of-packed-member -Wno-format-zero-length -Wno-parentheses -Wno-cast-qu al -Wno-unused -mno-aes -mno-avx -D_SYS_ERRNO_H_ -D_SYS_PARAM_H_ -DLOCORE -std =gnu17 -include /root/freebsd/sys/cddl/compat/opensolaris/sys/debug_compat.h -c /root/freebsd/sys/cddl/dev/dtrace/amd64/dtrace_asm.S -o dtrace_asm.o /root/freebsd/sys/cddl/dev/dtrace/amd64/dtrace_asm.S:63:2: error: invalid instru ction mnemonic 'erets' erets ^~~~~
Comment Actions
FWIW this was prompted by llm-postcr complaining about possible compiler version incompatibility in cb1627e40d5c0c21f2f7d13e848cf6495390e777 which added -mindirect-branch-cs-prefix. Because the kernel does not build with Clang < 16 anyway I did not bother adding a version or COMPILER_FEATURES test.
.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Mretpoline} != "" && \
${MK_KERNEL_RETPOLINE} != "no"
CFLAGS+= -mretpoline-external-thunk -mindirect-branch-cs-prefix
.endif