mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
x11-drivers/nvidia-drivers: add basic clang+thinlto kernel support
Only adding this experimental support to >=465.31, still very little testing has been done but should be better than always failing. To use this there's no need to do anything beside having a kernel built with clang+(thin)lto (normally through LLVM=1 LLVM_IAS=1). Note to not set "LD" as it'll currently fail with USE=tools for other reasons. Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
This commit is contained in:
@@ -101,8 +101,6 @@ pkg_setup() {
|
||||
Cannot be directly selected in the kernel's menuconfig, so enable
|
||||
options such as CONFIG_DRM_FBDEV_EMULATION instead."
|
||||
|
||||
BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"'
|
||||
BUILD_TARGETS="modules" # defaults' clean sometimes deletes modules
|
||||
MODULE_NAMES="
|
||||
nvidia(video:kernel)
|
||||
nvidia-drm(video:kernel)
|
||||
@@ -112,7 +110,25 @@ pkg_setup() {
|
||||
|
||||
linux-mod_pkg_setup
|
||||
|
||||
if [[ ${MERGE_TYPE} != binary ]] && kernel_is -gt ${NV_KERNEL_MAX/./ }; then
|
||||
[[ ${MERGE_TYPE} == binary ]] && return
|
||||
|
||||
BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"'
|
||||
BUILD_TARGETS="modules" # defaults' clean sometimes deletes modules
|
||||
|
||||
if linux_chkconfig_present CC_IS_CLANG; then
|
||||
ewarn "Warning: building ${PN} with a clang-built kernel is experimental."
|
||||
|
||||
BUILD_PARAMS+=' CC=${CHOST}-clang'
|
||||
if linux_chkconfig_present LD_IS_LLD; then
|
||||
BUILD_PARAMS+=' LD=ld.lld'
|
||||
if linux_chkconfig_present LTO_CLANG_THIN; then
|
||||
# kernel enables cache by default leading to sandbox violations
|
||||
BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir='
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if kernel_is -gt ${NV_KERNEL_MAX/./ }; then
|
||||
ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of nvidia-drivers"
|
||||
ewarn "or was not tested with it. It is recommended to use one of:"
|
||||
ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}"
|
||||
|
||||
Reference in New Issue
Block a user