1 |
commit: 9cca413557e341beaa8f9289915e175e6d51d752 |
2 |
Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jun 11 16:57:43 2021 +0000 |
4 |
Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jun 11 17:48:05 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9cca4135 |
7 |
|
8 |
x11-drivers/nvidia-drivers: add basic clang+thinlto kernel support |
9 |
|
10 |
Only adding this experimental support to >=465.31, still very little |
11 |
testing has been done but should be better than always failing. |
12 |
|
13 |
To use this there's no need to do anything beside having a kernel |
14 |
built with clang+(thin)lto (normally through LLVM=1 LLVM_IAS=1). |
15 |
Note to not set "LD" as it'll currently fail with USE=tools for |
16 |
other reasons. |
17 |
|
18 |
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org> |
19 |
|
20 |
.../nvidia-drivers/nvidia-drivers-465.31.ebuild | 22 +++++++++++++++++++--- |
21 |
1 file changed, 19 insertions(+), 3 deletions(-) |
22 |
|
23 |
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-465.31.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-465.31.ebuild |
24 |
index d327e03ff8f..4807a3e0f30 100644 |
25 |
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-465.31.ebuild |
26 |
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-465.31.ebuild |
27 |
@@ -101,8 +101,6 @@ pkg_setup() { |
28 |
Cannot be directly selected in the kernel's menuconfig, so enable |
29 |
options such as CONFIG_DRM_FBDEV_EMULATION instead." |
30 |
|
31 |
- BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' |
32 |
- BUILD_TARGETS="modules" # defaults' clean sometimes deletes modules |
33 |
MODULE_NAMES=" |
34 |
nvidia(video:kernel) |
35 |
nvidia-drm(video:kernel) |
36 |
@@ -112,7 +110,25 @@ pkg_setup() { |
37 |
|
38 |
linux-mod_pkg_setup |
39 |
|
40 |
- if [[ ${MERGE_TYPE} != binary ]] && kernel_is -gt ${NV_KERNEL_MAX/./ }; then |
41 |
+ [[ ${MERGE_TYPE} == binary ]] && return |
42 |
+ |
43 |
+ BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' |
44 |
+ BUILD_TARGETS="modules" # defaults' clean sometimes deletes modules |
45 |
+ |
46 |
+ if linux_chkconfig_present CC_IS_CLANG; then |
47 |
+ ewarn "Warning: building ${PN} with a clang-built kernel is experimental." |
48 |
+ |
49 |
+ BUILD_PARAMS+=' CC=${CHOST}-clang' |
50 |
+ if linux_chkconfig_present LD_IS_LLD; then |
51 |
+ BUILD_PARAMS+=' LD=ld.lld' |
52 |
+ if linux_chkconfig_present LTO_CLANG_THIN; then |
53 |
+ # kernel enables cache by default leading to sandbox violations |
54 |
+ BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir=' |
55 |
+ fi |
56 |
+ fi |
57 |
+ fi |
58 |
+ |
59 |
+ if kernel_is -gt ${NV_KERNEL_MAX/./ }; then |
60 |
ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of nvidia-drivers" |
61 |
ewarn "or was not tested with it. It is recommended to use one of:" |
62 |
ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}" |