diff options
author | Ionen Wolkens <ionen@gentoo.org> | 2021-06-11 12:57:43 -0400 |
---|---|---|
committer | Ionen Wolkens <ionen@gentoo.org> | 2021-06-11 13:48:05 -0400 |
commit | 9cca413557e341beaa8f9289915e175e6d51d752 (patch) | |
tree | 9b8de3311123621146b47962704f39abe0dff366 /x11-drivers/nvidia-drivers | |
parent | Revert "dev-python/black: Remove old" (diff) | |
download | gentoo-9cca413557e341beaa8f9289915e175e6d51d752.tar.gz gentoo-9cca413557e341beaa8f9289915e175e6d51d752.tar.bz2 gentoo-9cca413557e341beaa8f9289915e175e6d51d752.zip |
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>
Diffstat (limited to 'x11-drivers/nvidia-drivers')
-rw-r--r-- | x11-drivers/nvidia-drivers/nvidia-drivers-465.31.ebuild | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-465.31.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-465.31.ebuild index d327e03ff8f1..4807a3e0f301 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-465.31.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-465.31.ebuild @@ -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}" |