You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 7, 2021. It is now read-only.
kernel-cflags-finder: Set CONFIG_CC_IS_CLANG=y (#227)
Some of the things in the kernel's Makefile check whether
`${CC} --version` is clang, which is affected by setting CC. Some look at
CONFIG_CC_IS_CLANG, which was set at configuration time when our kernel
was built. We need to override the latter to get clang-compatible flags.
This causes the kernel to no longer set -W / -Wno flags that aren't
valid for clang, so we can get rid of `-Wno-unknown-warning-option`.
One problem with the previous approach is that the kernel's Makefile
does feature detection to see what options are accepted by the current
compiler, and it doesn't accept custom CFLAGS early enough for them to
take effect during feature detection. Because the kernel sets
`-Werror=unknown-warning-option` for clang (by checking the version of
`${CC}`, unfortunately), all attempts at feature detection would fail
with an unrelated error. This causes Makefile to wrongly conclude that
the compiler doesn't support `-mfentry` and use mcount instead even if
the compiled kernel expects fentry - i.e., this commit fixes#174.
We might eventually need to set CONFIG_CLANG_VERSION and perhaps unset
CONFIG_CC_IS_GCC, but this seems to work well enough for now.
0 commit comments