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 }}
Repository navigation
Make clang integrated-as optional in Linux kernel #577
Right now -no-integrated-as is passed to clang unconditionally during kernel compilation. I would like to make it optional and add a Kconfig switch to toggle it. I will try to work on it in my spare time.
Clang can either use LLVM’s integrated assembler or an external system-specific tool (for instance, > the GNU Assembler on GNU OSes) to produce machine code from assembly. By default, Clang uses > LLVM’s integrated assembler on all targets where it is supported. If you wish to use the system
assembler instead, use the -fno-integrated-as option."
[2] says:
-fintegrated-as, -fno-integrated-as, -integrated-as
Enable the integrated assembler
bool "Use LLVM’s integrated assembler with Clang" ?
llvm-as is used for building LLVM assembly. Platform specific assembly can be built with clang (it would either use LLVM's integrated assembler or call external as depending on whether or not -no-integrated-as was set).
@tpimh I agree, I realized that last night and never commented lol.
Tentative patch, let me know if you all want the patch improved in any way.
From 50e90e9d6b9f2ae26656e7eb532ae545567c386a Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Thu, 27 Jun 2019 08:58:50 -0700
Subject: [PATCH] kbuild: Add ability to test Clang's integrated assembler
There are some people interested in experimenting with Clang's
integrated assembler. To make it easy to do so without source
modification, allow the user to specify AS=clang as part of the
make command to avoid adding '-no-integrated-as' to the {A,C}FLAGS.
Link: https://github.com/ClangBuiltLinux/linux/issues/577
Suggested-by: Dmitry Golovin <dima@golovin.in>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Makefile b/Makefile
index aa233492e04a..4954f1e911be 100644
--- a/Makefile+++ b/Makefile@@ -527,7 +527,9 @@ endif
ifneq ($(GCC_TOOLCHAIN),)
CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
endif
+ifeq ($(shell $(AS) --version 2>&1 | head -n 1 | grep clang),)
CLANG_FLAGS += -no-integrated-as
+endif
CLANG_FLAGS += -Werror=unknown-warning-option
KBUILD_CFLAGS += $(CLANG_FLAGS)
KBUILD_AFLAGS += $(CLANG_FLAGS)
--
2.22.0
Activity
[-]Make clang integrated as optional in Linux kernel[/-][+]Make clang integrated-as optional in Linux kernel[/+]tpimh commentedon Jun 26, 2019
Initial version of what it should look like
dileks commentedon Jun 26, 2019
[1] says:
[2] says:
bool "Use LLVM’s integrated assembler with Clang" ?
[1] https://clang.llvm.org/docs/Toolchain.html#assembler
[2] https://clang.llvm.org/docs/ClangCommandLineReference.html#target-dependent-compilation-options
nickdesaulniers commentedon Jun 26, 2019
A config option would make
allyesconfigbuilds start failing. Maybe a custom command like variable to Make likeASandCCand friends currently are?Maybe
-no-integrated-asshould not be added IFASwas set at the command line? I think that should be the way to go.nathanchance commentedon Jun 26, 2019
or
works for all four of these combos:
I would think the latter is preferred but I have no strong opinion. This type of change is easily upstreamable I think, I can send it along.
nickdesaulniers commentedon Jun 26, 2019
The first doesn't invoke a subshell. ;)
What about if I use
AS=clang-8orAS=clang-9?nathanchance commentedon Jun 26, 2019
Fair point :)
Also works because
findstringjust checks ifclangis somewhere in$(AS)not that$(AS)isclang.tpimh commentedon Jun 27, 2019
Second option looks better to me because it will also work with a clang-based comiler with a different executable name (e.g. ELLCC).
dileks commentedon Jun 27, 2019
Hmmm, interesting for me the possibility to set
AS=clang.When do people use
llvm-as?Can we use it for CBL?
2nd options looks more familiar to me (similiar setting like for LD etc.)
tpimh commentedon Jun 27, 2019
llvm-asis used for building LLVM assembly. Platform specific assembly can be built withclang(it would either use LLVM's integrated assembler or call externalasdepending on whether or not-no-integrated-aswas set).nathanchance commentedon Jun 27, 2019
@tpimh I agree, I realized that last night and never commented lol.
Tentative patch, let me know if you all want the patch improved in any way.
From 50e90e9d6b9f2ae26656e7eb532ae545567c386a Mon Sep 17 00:00:00 2001 From: Nathan Chancellor <natechancellor@gmail.com> Date: Thu, 27 Jun 2019 08:58:50 -0700 Subject: [PATCH] kbuild: Add ability to test Clang's integrated assembler There are some people interested in experimenting with Clang's integrated assembler. To make it easy to do so without source modification, allow the user to specify AS=clang as part of the make command to avoid adding '-no-integrated-as' to the {A,C}FLAGS. Link: https://github.com/ClangBuiltLinux/linux/issues/577 Suggested-by: Dmitry Golovin <dima@golovin.in> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index aa233492e04a..4954f1e911be 100644 --- a/Makefile +++ b/Makefile @@ -527,7 +527,9 @@ endif ifneq ($(GCC_TOOLCHAIN),) CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) endif +ifeq ($(shell $(AS) --version 2>&1 | head -n 1 | grep clang),) CLANG_FLAGS += -no-integrated-as +endif CLANG_FLAGS += -Werror=unknown-warning-option KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_AFLAGS += $(CLANG_FLAGS) -- 2.22.0221 remaining items
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler
kbuild: Add ability to test Clang's integrated assembler