2015-03-04 21:41:31 +11:00
|
|
|
|
|
|
|
|
|
2021-04-13 08:34:13 -07:00
|
|
|
|
kbuild: Make $(LLVM) more flexible
The LLVM make variable allows a developer to quickly switch between the
GNU and LLVM tools. However, it does not handle versioned binaries, such
as the ones shipped by Debian, as LLVM=1 just defines the tool variables
with the unversioned binaries.
There was some discussion during the review of the patch that introduces
LLVM=1 around versioned binaries, ultimately coming to the conclusion
that developers can just add the folder that contains the unversioned
binaries to their PATH, as Debian's versioned suffixed binaries are
really just symlinks to the unversioned binaries in /usr/lib/llvm-#/bin:
$ realpath /usr/bin/clang-14
/usr/lib/llvm-14/bin/clang
$ PATH=/usr/lib/llvm-14/bin:$PATH make ... LLVM=1
However, that can be cumbersome to developers who are constantly testing
series with different toolchains and versions. It is simple enough to
support these versioned binaries directly in the Kbuild system by
allowing the developer to specify the version suffix with LLVM=, which
is shorter than the above suggestion:
$ make ... LLVM=-14
It does not change the meaning of LLVM=1 (which will continue to use
unversioned binaries) and it does not add too much additional complexity
to the existing $(LLVM) code, while allowing developers to quickly test
their series with different versions of the whole LLVM suite of tools.
Some developers may build LLVM from source but not add the binaries to
their PATH, as they may not want to use that toolchain systemwide.
Support those developers by allowing them to supply the directory that
the LLVM tools are available in, as it is no more complex to support
than the version suffix change above.
$ make ... LLVM=/path/to/llvm/
Update and reorder the documentation to reflect these new additions.
At the same time, notate that LLVM=0 is not the same as just omitting it
altogether, which has confused people in the past.
Link: https://lore.kernel.org/r/20200317215515.226917-1-ndesaulniers@google.com/
Link: https://lore.kernel.org/r/20220224151322.072632223@infradead.org/
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-03-04 10:08:14 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selftests: default to host arch for LLVM builds
Align the behavior for gcc and clang builds by interpreting unset
`ARCH` and `CROSS_COMPILE` variables in `LLVM` builds as a sign that the
user wants to build for the host architecture.
This patch preserves the properties that setting the `ARCH` variable to an
unknown value will trigger an error that complains about insufficient
information, and that a set `CROSS_COMPILE` variable will override the
target triple that is determined based on presence/absence of `ARCH`.
When compiling with clang, i.e., `LLVM` is set, an unset `ARCH` variable in
combination with an unset `CROSS_COMPILE` variable, i.e., compiling for
the host architecture, leads to compilation failures since `lib.mk` can
not determine the clang target triple. In this case, the following error
message is displayed for each subsystem that does not set `ARCH` in its
own Makefile before including `lib.mk` (lines wrapped at 75 chrs):
make[1]: Entering directory '/mnt/build/linux/tools/testing/selftests/
sysctl'
../lib.mk:33: *** Specify CROSS_COMPILE or add '--target=' option to
lib.mk. Stop.
make[1]: Leaving directory '/mnt/build/linux/tools/testing/selftests/
sysctl'
In the same scenario a gcc build would default to the host architecture,
i.e., it would use plain `gcc`.
Fixes: 795285ef2425 ("selftests: Fix clang cross compilation")
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Valentin Obst <kernel@valentinobst.de>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-03-29 11:49:43 +01:00
|
|
|
|
|
|
|
|
|
2022-06-14 13:10:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-09 16:22:31 +02:00
|
|
|
|
2022-06-14 13:10:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-09 16:22:31 +02:00
|
|
|
|
selftests: default to host arch for LLVM builds
Align the behavior for gcc and clang builds by interpreting unset
`ARCH` and `CROSS_COMPILE` variables in `LLVM` builds as a sign that the
user wants to build for the host architecture.
This patch preserves the properties that setting the `ARCH` variable to an
unknown value will trigger an error that complains about insufficient
information, and that a set `CROSS_COMPILE` variable will override the
target triple that is determined based on presence/absence of `ARCH`.
When compiling with clang, i.e., `LLVM` is set, an unset `ARCH` variable in
combination with an unset `CROSS_COMPILE` variable, i.e., compiling for
the host architecture, leads to compilation failures since `lib.mk` can
not determine the clang target triple. In this case, the following error
message is displayed for each subsystem that does not set `ARCH` in its
own Makefile before including `lib.mk` (lines wrapped at 75 chrs):
make[1]: Entering directory '/mnt/build/linux/tools/testing/selftests/
sysctl'
../lib.mk:33: *** Specify CROSS_COMPILE or add '--target=' option to
lib.mk. Stop.
make[1]: Leaving directory '/mnt/build/linux/tools/testing/selftests/
sysctl'
In the same scenario a gcc build would default to the host architecture,
i.e., it would use plain `gcc`.
Fixes: 795285ef2425 ("selftests: Fix clang cross compilation")
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Valentin Obst <kernel@valentinobst.de>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-03-29 11:49:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-14 13:10:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-01-11 22:33:07 +00:00
|
|
|
|
2022-06-14 13:10:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-31 11:37:51 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selftests: default to host arch for LLVM builds
Align the behavior for gcc and clang builds by interpreting unset
`ARCH` and `CROSS_COMPILE` variables in `LLVM` builds as a sign that the
user wants to build for the host architecture.
This patch preserves the properties that setting the `ARCH` variable to an
unknown value will trigger an error that complains about insufficient
information, and that a set `CROSS_COMPILE` variable will override the
target triple that is determined based on presence/absence of `ARCH`.
When compiling with clang, i.e., `LLVM` is set, an unset `ARCH` variable in
combination with an unset `CROSS_COMPILE` variable, i.e., compiling for
the host architecture, leads to compilation failures since `lib.mk` can
not determine the clang target triple. In this case, the following error
message is displayed for each subsystem that does not set `ARCH` in its
own Makefile before including `lib.mk` (lines wrapped at 75 chrs):
make[1]: Entering directory '/mnt/build/linux/tools/testing/selftests/
sysctl'
../lib.mk:33: *** Specify CROSS_COMPILE or add '--target=' option to
lib.mk. Stop.
make[1]: Leaving directory '/mnt/build/linux/tools/testing/selftests/
sysctl'
In the same scenario a gcc build would default to the host architecture,
i.e., it would use plain `gcc`.
Fixes: 795285ef2425 ("selftests: Fix clang cross compilation")
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Valentin Obst <kernel@valentinobst.de>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-03-29 11:49:43 +01:00
|
|
|
|
2021-04-13 08:34:13 -07:00
|
|
|
|
2015-03-04 21:41:31 +11:00
|
|
|
|
2022-06-14 13:10:45 +01:00
|
|
|
|
2015-03-04 21:41:31 +11:00
|
|
|
|
2017-03-01 15:15:07 -07:00
|
|
|
|
2019-05-10 19:38:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-15 15:51:42 -06:00
|
|
|
|
2017-03-01 15:15:07 -07:00
|
|
|
|
2019-04-24 16:12:30 -07:00
|
|
|
|
2022-08-19 12:19:28 -07:00
|
|
|
|
2017-03-01 15:15:07 -07:00
|
|
|
|
2024-04-11 12:05:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-12-08 18:01:44 -08:00
|
|
|
|
2024-05-16 20:51:07 -06:00
|
|
|
|
2022-09-09 12:34:02 +02:00
|
|
|
|
|
|
|
|
|
2024-03-27 20:34:17 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-11 13:06:33 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-09 19:56:26 +11:00
|
|
|
|
2017-09-06 18:36:22 -06:00
|
|
|
|
2017-02-09 19:56:26 +11:00
|
|
|
|
|
|
|
|
|
2024-01-12 14:43:50 -03:00
|
|
|
|
|
|
|
|
|
2018-09-04 12:47:21 +02:00
|
|
|
|
2015-03-11 15:05:59 +11:00
|
|
|
|
2020-05-27 10:16:57 +03:00
|
|
|
|
2019-04-24 16:12:35 -07:00
|
|
|
|
2019-04-24 16:12:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-11 15:05:59 +11:00
|
|
|
|
|
|
|
|
|
2024-01-26 18:21:18 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-11 15:05:59 +11:00
|
|
|
|
2019-07-06 12:07:12 +09:00
|
|
|
|
2024-01-12 14:43:50 -03:00
|
|
|
|
|
|
|
|
|
2017-09-11 19:03:11 -06:00
|
|
|
|
2024-01-26 18:21:18 -05:00
|
|
|
|
2020-05-27 10:16:57 +03:00
|
|
|
|
2021-03-03 01:44:20 +01:00
|
|
|
|
|
|
|
|
|
2020-05-27 10:16:57 +03:00
|
|
|
|
|
|
|
|
|
2017-09-11 19:03:11 -06:00
|
|
|
|
|
|
|
|
|
2020-05-27 10:16:57 +03:00
|
|
|
|
2017-09-11 19:03:11 -06:00
|
|
|
|
2015-03-11 15:05:59 +11:00
|
|
|
|
2024-01-12 14:43:50 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-06 09:40:52 +01:00
|
|
|
|
|
|
|
|
|
2023-08-22 15:58:37 +02:00
|
|
|
|
2020-02-06 09:40:52 +01:00
|
|
|
|
|
|
|
|
|
2024-01-12 14:43:50 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-11 15:06:00 +11:00
|
|
|
|
2020-02-06 09:40:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-12 14:43:50 -03:00
|
|
|
|
2021-05-26 20:17:54 -07:00
|
|
|
|
2015-03-11 15:06:00 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-26 18:21:18 -05:00
|
|
|
|
2015-03-11 15:06:00 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-24 16:12:31 -07:00
|
|
|
|
2018-05-01 12:15:34 -06:00
|
|
|
|
2016-11-29 19:55:52 +08:00
|
|
|
|
2020-09-28 13:26:48 -07:00
|
|
|
|
|
|
|
|
|
2015-03-11 15:06:00 +11:00
|
|
|
|
2017-09-06 18:36:22 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-21 16:07:51 -06:00
|
|
|
|
2016-11-29 19:55:51 +08:00
|
|
|
|
2017-04-21 16:07:51 -06:00
|
|
|
|
|
|
|
|
|
2024-01-12 14:43:50 -03:00
|
|
|
|
2017-04-21 16:07:51 -06:00
|
|
|
|
2016-11-29 19:55:47 +08:00
|
|
|
|
2024-06-25 22:34:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-16 16:14:09 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-09 12:39:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-06 18:36:22 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-07-06 12:07:12 +09:00
|
|
|
|
2017-09-06 18:36:22 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-02 08:44:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-05 17:25:29 +01:00
|
|
|
|
2020-03-25 17:16:49 -06:00
|
|
|
|
2024-04-11 12:05:34 -07:00
|
|
|
|
|
|
|
|
|
2016-11-29 19:55:52 +08:00
|
|
|
|
|
|
|
|
|
2017-02-09 19:56:28 +11:00
|
|
|
|
2016-11-29 19:55:52 +08:00
|
|
|
|
|
|
|
|
|
2017-02-09 19:56:28 +11:00
|
|
|
|
2018-06-02 08:44:03 -04:00
|
|
|
|
2016-11-29 19:55:49 +08:00
|
|
|
|
2025-09-18 11:56:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-26 12:44:47 +01:00
|
|
|
|
2025-09-18 11:56:36 +02:00
|
|
|
|
2025-02-26 12:44:47 +01:00
|
|
|
|
|
|
|
|
|