New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Status: Building with Clang's integrated assembler aka LLVM_IAS=1 #1049
Comments
FYI: |
Short intermezzo:
|
I try with:
|
I tried with: diff --git a/Makefile b/Makefile
index 812f4f1ee764..4d946b996e29 100644
--- a/Makefile
+++ b/Makefile
@@ -803,10 +803,12 @@ DEBUG_CFLAGS += -gsplit-dwarf
else
DEBUG_CFLAGS += -g
endif
-KBUILD_AFLAGS += -Wa,-gdwarf-2
-endif
ifdef CONFIG_DEBUG_INFO_DWARF4
DEBUG_CFLAGS += -gdwarf-4
+KBUILD_AFLAGS += -Wa,-gdwarf-4
+else
+KBUILD_AFLAGS += -Wa,-gdwarf-2
+endif
endif
ifdef CONFIG_DEBUG_INFO_REDUCED In my build-log I see:
|
I jumped to latest Linus Git and installed
Instructions:
From my make-log.txt:
|
Tried with adding
The same BROKEN output like above. |
With which version of llvm-toolchain did you had success with |
I will see how far I get with: diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -2,6 +2,8 @@
#
# x86 crypto algorithms
+KBUILD_CPPFLAGS += -no-integrated-as
+
OBJECT_FILES_NON_STANDARD := y |
I am building full DWARF4 now and my diff looks like this: diff --git a/Makefile b/Makefile
index 812f4f1ee764..f37f393cdcf0 100644
--- a/Makefile
+++ b/Makefile
@@ -561,6 +561,10 @@ endif
CLANG_FLAGS += -Werror=unknown-warning-option
KBUILD_CFLAGS += $(CLANG_FLAGS)
KBUILD_AFLAGS += $(CLANG_FLAGS)
+ifdef CONFIG_DEBUG_INFO_DWARF4
+KBUILD_CFLAGS += -gdwarf-4
+KBUILD_AFLAGS += -Wa,-gdwarf-4
+endif
export CLANG_FLAGS
endif
@@ -803,10 +807,12 @@ DEBUG_CFLAGS += -gsplit-dwarf
else
DEBUG_CFLAGS += -g
endif
-KBUILD_AFLAGS += -Wa,-gdwarf-2
-endif
ifdef CONFIG_DEBUG_INFO_DWARF4
DEBUG_CFLAGS += -gdwarf-4
+KBUILD_AFLAGS += -Wa,-gdwarf-4
+else
+KBUILD_AFLAGS += -Wa,-gdwarf-2
+endif
endif
ifdef CONFIG_DEBUG_INFO_REDUCED
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index a31de0c6ccde..a28810a6a489 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -2,6 +2,8 @@
#
# x86 crypto algorithms
+KBUILD_CPPFLAGS += -no-integrated-as
+
OBJECT_FILES_NON_STANDARD := y
obj-$(CONFIG_CRYPTO_GLUE_HELPER_X86) += glue_helper.o |
Cool, I was able to build with
I needed a 2nd hunk to previous diff: diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 5246db42de45..af6cbb746cef 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -3,6 +3,8 @@
# Makefile for x86 specific library files.
#
+KBUILD_CPPFLAGS += -no-integrated-as
+
# Produces uninteresting flaky coverage.
KCOV_INSTRUMENT_delay.o := n En plus, I pulled from I will see if I add Sidenote: Without my wrapper-scripts to compiler (uses |
Thanks for the report. I've filed #1050 for the bug (requires additional config beyond defconfig). For
If you're getting cache misses (new compiler, or not using a deterministic build timestamp) then ccache should be slower than no ccache. The hope is following builds that don't change too much become hotter and build faster. Also #1043 should be a blocker here as we disabled LLVM_IAS in ClangBuiltLinux/continuous-integration#276 due to it. Closing for now, we can still follow up here or in #1050 |
Unsetting above diff makes this visible
|
How can I see this is real DWARF4? |
My latest diff: diff --git a/Makefile b/Makefile
index 812f4f1ee764..68ae67cdde29 100644
--- a/Makefile
+++ b/Makefile
@@ -561,6 +561,10 @@ endif
CLANG_FLAGS += -Werror=unknown-warning-option
KBUILD_CFLAGS += $(CLANG_FLAGS)
KBUILD_AFLAGS += $(CLANG_FLAGS)
+ifdef LLVM_IAS
+KBUILD_CFLAGS += -gdwarf-4
+KBUILD_AFLAGS += -Wa,-gdwarf-4
+endif
export CLANG_FLAGS
endif
@@ -803,10 +807,15 @@ DEBUG_CFLAGS += -gsplit-dwarf
else
DEBUG_CFLAGS += -g
endif
+ifndef LLVM_IAS
KBUILD_AFLAGS += -Wa,-gdwarf-2
endif
+endif
ifdef CONFIG_DEBUG_INFO_DWARF4
DEBUG_CFLAGS += -gdwarf-4
+ifdef LLVM_IAS
+KBUILD_AFLAGS += -Wa,-gdwarf-4
+endif
endif
ifdef CONFIG_DEBUG_INFO_REDUCED
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index a31de0c6ccde..bd5be603fdf3 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -2,6 +2,10 @@
#
# x86 crypto algorithms
+ifdef LLVM_IAS
+KBUILD_CPPFLAGS += -no-integrated-as
+endif
+
OBJECT_FILES_NON_STANDARD := y
obj-$(CONFIG_CRYPTO_GLUE_HELPER_X86) += glue_helper.o
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 5246db42de45..619107bec0d9 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -3,6 +3,10 @@
# Makefile for x86 specific library files.
#
+ifdef LLVM_IAS
+KBUILD_CPPFLAGS += -no-integrated-as
+endif
+
# Produces uninteresting flaky coverage.
KCOV_INSTRUMENT_delay.o := n |
|
Thanks. I see with
|
@masahir0y commented in the thread [1]: "x86/crypto: Set -no-integrated-as for specific object-file when building with LLVM_IAS=1"
Here you have another example I use to dig into diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 619107bec0d9..2c07cc651d52 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -3,10 +3,6 @@
# Makefile for x86 specific library files.
#
-ifdef LLVM_IAS
-KBUILD_CPPFLAGS += -no-integrated-as
-endif
-
# Produces uninteresting flaky coverage.
KCOV_INSTRUMENT_delay.o := n
@@ -39,6 +35,9 @@ obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o
lib-y := delay.o misc.o cmdline.o cpu.o
lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o
lib-y += memcpy_$(BITS).o
+ifdef LLVM_IAS
+AFLAGS_memcpy_$(BITS).o += -no-integrated-as
+endif
lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o insn-eval.o
lib-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
@@ -62,6 +61,9 @@ else
lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
lib-y += clear_page_64.o copy_page_64.o
lib-y += memmove_64.o memset_64.o
+ ifndef LLVM_IAS
+ AFLAGS_memset_64.o += -no-integrated-as
+ endif
lib-y += copy_user_64.o
lib-y += cmpxchg16b_emu.o
endif [1] https://lore.kernel.org/r/CAK7LNAQuiuj5UifVBYEN7Xkp5GH0RNiWc5F3VyA1BAjGAUhqhw@mail.gmail.com/ |
Can you comment on my Does IMHO the settings in the first block can go away? What about the second block?
|
3.10 Options for Debugging Your Program [1] says:
[1] https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html |
With the patches to fix syntax in arch/x86/crypto/aes{ni-intel_asm,_ctrby8_avx-x86_64}.S, the patch to switch the use of movzxw->movzwq, and individually adding |
[ REPORT 2020-06-14 by dileks ] [ DISCLAIMER ] I collect here my experiences and want to share them with you. THIS IS STILL EXPERIMENTAL - USE AT YOUR OWN RISK! My work is in collaboration with ClangBuiltLinux folks. [ MY PERSONAL DISCLAIMER ] To say with the words of the author of curl and DOH (keynote @ FOSDEM 2019): Second, even experimental work has to boot on bare metal - my bare metal. It has to build in my environment using latest "stable" Linux-Kernel and "stable" llvm-toolchain.
[ STATUS ] This is the status from 14-Jun-2020. [ LLVM_IAS PATCHSET ]
NOTE: Contacted Linux/objtool maintainers: Peter Zijlstra is inspecting my .o files [ KNOWN ISSUES @dileks ] [ MINIMAL PATCHSET ] XXX: TODO: Sort out relevant patches only NOTE: I started to label patches with "llvm-ias:" and/or add "when building with LLVM_IAS=1" which is IMHO too long. [ SELFMADE TOOLCHAIN VS. APT.LLVM.ORG ] NOTE: Same version! XXX: TODO: Uninstall/Disable selfmade toolchain and use the Debian packages only - strategy? [ KERN.LOG - c-index-test ] When building a selfmade toolchain I see with c-index-test: traps: clang[...] trap invalid opcode ip:[...] sp:[...] error:0 in clang-10[...+...] XXX: REPRODUCIBLE [ ZSTD-INITRAMFS ] When creating a new initramfs with zstd-support under a LLVM_IAS+llvm-objdump kernel I see: Message from syslogd@iniza at Jun 14 10:21:43 ... REPRODUCER: XXX: REPRODUCIBLE XXX: TODO: post syslog_20200614.txt (Call Trace: <ENTRY_TRAMPOLINE>) [ crypto/algapi.c - crypto_wait_for_test ] WARNING: CPU: 2 PID: 255 at crypto/algapi.c:404 crypto_wait_for_test NOTE: I have some crypto-algo kconfigs enabled as modules. Tried to fix with cherry-picked upstream commits:
XXX: REPRODUCIBLE (seen on each boot; upstream-5.8 patches did not help) XXX: TODO: Contact Linux/crypto maintainers [ KDE/PLASMA ] See several crashes "signald" shown in a infobox (see above zstd/initramfs etc.) XXX: REPRODUCIBLE [ CBL ISSUE-TRACKER ] LINK: #1049 [ THANKS ] Thanks for using llvm-toolchain to build the Linux-kernel and your time and patience to answer my question. My special thank-you to (in no preferential order): Of course not to forget the people behind cbl/continuous-ci and all contributors to llvm/clang/lld/llvm-tools... [ YOUR FEEDBACK ] You are welcome. |
This patchset is from my
NOTE: This patchset does not respect any credits yet - take it as-is - status: WIP. Feedback is welcome. @E5ten [1] https://git.kernel.org/linus/51da9dfb7f20911ae4e79e9b412a9c2d4c373d4b 0001-kbuild-llvm-ias-Silence-dwarf-2-warning_patch.txt |
Add my latest Linux-kernel config. |
Maybe this is shorter (commit-subject):
UPDATE: Add patchset v5 0001-kbuild-Silence-dwarf-2-warning-when-LLVM_IAS-1_patch.txt |
According to @masahir0y this should be:
Why did you need this? UPDATE: @E5ten you are right - it is an .o file not .S file (CFLAGS_initramfs.o line is correct). |
Linux? |
5.7.2 |
I switched over to latest known tc-build says:
[1] https://github.com/ClangBuiltLinux/tc-build/blob/master/build-llvm.py#L20 |
With llvm Git 8a5aea7b5042 memcpy_64/memset_64 is OK.
|
Ah I see
|
I build with
|
Looks good with above patchset.
The only warning I see in dmesg:
Check Linux Git:
Loaded kernel-modules:
The problems when re-running |
For Linux
|
Just want to point out when you build with
NOTE: See UPDATE: 2020-06-18: Add Makefile excerpt and CONFIG_DEBUG_INFO_DWARF4=y |
Linux |
Progress on #1008 (comment)
|
Patch submitted for #1008 [1] #1008 (comment) |
Patch submitted for #1050 [1] #1050 (comment) |
I have re-tested with This needs the Furthermore, when I upgrade my Conclusion: P.S.: With dropping my DWARF-4 assembler option patch I lose the information in the .o files (.S file as a base) when checking with llvm-dwarfdump. |
This (last) Monday with the official release of Inspired by @paulmenzel report in #1076 I switched over my We have accepted two patches from @jcai19 (see #1008) and @dileks (see #1050) in crypto-2.6.git:
The last patch to be upstreamed and be full compliant with This means we are (will be) able to set and use on
Just as a sidenote: Note: [1] #1076 |
The workaround for So a complete build with |
To build
NOTE to 1. and 2.: NOTE to 2.: NOTE to 3. and 4.: NOTE to 5.: NOTE to 6.: Required for some kernel-modules like out-of-tree Update 16-Aug-2020: Update 19-Aug-2020: Update 05-Aug-2020: Update 03-Aug-2020: Update 01-Aug-2020: Update 23-Jul-2020: Update 22-Jul-2020: |
Update:
Required patches/patchsets:
Optional
Perf stat:
Attachments: My kernel-config and dmesg-output config-5.9.0-rc1-3-amd64-llvm11-ias.txt |
please file individual bug reports for specific failures specific to either a missing feature or particular translation unit. |
Currently, I use What is the status with As you better know I left this issue open that people have an orientation. |
None. LLVM_IAS=1 is experimental/WIP for now.
Either the label "integrated-as" or maybe a github "milestone" might be more appropriate? |
@nickdesaulniers @nathanchance @tpimh
Hi,
what combination of recent Linux-kernel and recent llvm-toolchain is safe to build with enabled Clang's (I)ntegrated (AS)sembler aka set make-option
LLVM_IAS=1
?kernel-doc
llvm.rst
[1] says:I am here on Debian/testing AMD64 with
Linux v5.7.2
andllvm-toolchain-10
(release/10.x Git branch):I have cherry-picked commit 51da9df from upstream:
Is this enough to have good chances for a successful build?
Thanks in advance.
Regards,
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild/llvm.rst#n62
The text was updated successfully, but these errors were encountered: