-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Unable to compile on ARM64 with clang #13260
Comments
The problem is that, while GCC is perfectly happy with explicit register allocations when it's been told not to do certain kinds of instructions with compile flags, clang is not, and passing
|
Thanks for the quick response. That is what was suggested on IRC. I did a 'make clean' and placed the line (direct copy and paste) "CFLAGS_REMOVE_zfs_fletcher_aarch64_neon.o += -mgeneral-regs-only" below the 4th line of the fs/zfs/Makefile and recompiled. It didnt seem to make any difference |
It's true, I did suggest it there too. That said, for builtin, it's possible it wants a path like fs/zfs/... - I don't know how the way it calculates paths interacts when you do it as builtin. As far as as a module, it should work, removing the flag did work for me, and adding that line in the Makefile did make the flag, and that error set go away (though it promptly produced the same class of problem with the NEON raidz instructions, but the same dance over there worked too). |
Thanks! It compiles as a module with after taking care of the two raidz neon instructions. Any change adding those two would also allow it to compile builtin? |
Update: So compiling completes but the system does not boot off its ZFS root. Either when compiled as a module or built in |
Coming back to this, I'm not sure where to add the 3 lines anymore, seems the code structure has changed? I tried adding: CFLAGS_REMOVE_zfs_fletcher_aarch64_neon.o += -mgeneral-regs-only to the three Makefile.in's that exist in master: ./include/Makefile.in But build errors out the same as without the fix. Can you tell me what Im doing wrong, note: I am building as a module this time, not built in. output from dkms build:
|
Haven't tested this, but you probably want lines like |
Just a drive by comment: if permitted, the compiler may use NEON registers for spilling or for inline memsets and memcpys, e.g., to initialize stack variables. If this occurs outside of kernel_neon_begin()/end(), the kernel code will be clobbering user space data, because (unlike on 32-bit ARM), we don't disable access to the FP/SIMD registers when entering the kernel, and while we preserve them eagerly (as the task may be scheduled out and migrate to another CPU), the restore is only done lazily, but only when/after kernel_neon_begin()/end() have been used. |
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Signed-off-by: szubersk <[email protected]>
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Signed-off-by: szubersk <[email protected]>
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Signed-off-by: szubersk <[email protected]> (cherry picked from commit 8dbeb67)
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Signed-off-by: szubersk <[email protected]> (cherry picked from commit 8dbeb67)
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Signed-off-by: szubersk <[email protected]>
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Signed-off-by: szubersk <[email protected]>
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Signed-off-by: szubersk <[email protected]>
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Signed-off-by: szubersk <[email protected]>
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: szubersk <[email protected]> Closes openzfs#13260 Closes openzfs#14150
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: szubersk <[email protected]> Closes openzfs#13260 Closes openzfs#14150
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Porting notes: - Moved the stanzas removing -mgeneral-regs-only to Makefile.in since they wouldn't readily work in Kbuild.in and that did. Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: szubersk <[email protected]> Closes openzfs#13260 Closes openzfs#14150
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Porting notes: - Moved the stanzas removing -mgeneral-regs-only to Makefile.in since they wouldn't readily work in Kbuild.in and that did. Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: szubersk <[email protected]> Closes openzfs#13260 Closes openzfs#14150 Closes openzfs#14624 Ported-by: Rich Ercolani <[email protected] Signed-off-by: Rich Ercolani <[email protected]>
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Porting notes: - Moved the stanzas removing -mgeneral-regs-only to Makefile.in since they wouldn't readily work in Kbuild.in and that did. Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: szubersk <[email protected]> Closes openzfs#13260 Closes openzfs#14150 Closes openzfs#14624 Ported-by: Rich Ercolani <[email protected] Signed-off-by: Rich Ercolani <[email protected]>
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix #13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Porting notes: - Moved the stanzas removing -mgeneral-regs-only to Makefile.in since they wouldn't readily work in Kbuild.in and that did. Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: szubersk <[email protected]> Closes #13260 Closes #14150 Closes #14624 Ported-by: Rich Ercolani <[email protected] Signed-off-by: Rich Ercolani <[email protected]>
- Clang 15 doesn't support `-fno-ipa-sra` anymore. Do a separate check for `-fno-ipa-sra` support by $KERNEL_CC. - Don't enable `-mgeneral-regs-only` for certain module files. Fix openzfs#13260 - Scope `GCC diagnostic ignored` statements to GCC only. Clang doesn't need them to compile the code. Porting notes: - Moved the stanzas removing -mgeneral-regs-only to Makefile.in since they wouldn't readily work in Kbuild.in and that did. Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: szubersk <[email protected]> Closes openzfs#13260 Closes openzfs#14150 Closes openzfs#14624 Ported-by: Rich Ercolani <[email protected] Signed-off-by: Rich Ercolani <[email protected]>
System information
Describe the problem you're observing
While building under GCC works fine, I am unable to with clang+lto or -lto
Describe how to reproduce the problem
Compile linux kernel with ZFS +clang or compile ZFS as a dkms module for a kernel compiled with clang
Include any warning/errors/backtraces from the system logs
LTO [M] drivers/bluetooth/btrsi.lto.oLTO [M] drivers/target/target_core_user.lto.o
GEN .version
CHK include/generated/compile.h
GEN .tmp_initcalls.lds
GEN .tmp_symversions.lds
LTO vmlinux.o
ld.lld: error: couldn't allocate output register for constraint '{v0}' at line 2150099659
ld.lld: error: couldn't allocate output register for constraint '{v7}' at line 2150100117
ld.lld: error: couldn't allocate input reg for constraint '{v1}' at line 2150100832
ld.lld: error: couldn't allocate output register for constraint '{v0}' at line 2150101251
ld.lld: error: couldn't allocate output register for constraint '{v7}' at line 2150101709
ld.lld: error: couldn't allocate input reg for constraint '{v1}' at line 2150102484
ld.lld: error: couldn't allocate output register for constraint '{v0}' at line 2157696494
ld.lld: error: couldn't allocate input reg for constraint '{v0}' at line 2157700699
ld.lld: error: couldn't allocate output register for constraint '{v0}' at line 2157704887
ld.lld: error: couldn't allocate input reg for constraint '{v0}' at line 2157709206
ld.lld: error: couldn't allocate output register for constraint '{v0}' at line 2157714137
ld.lld: error: couldn't allocate output register for constraint '{v0}' at line 2157718730
ld.lld: error: couldn't allocate input reg for constraint '{v0}' at line 2157724053
ld.lld: error: couldn't allocate output register for constraint '{v0}' at line 2157728241
ld.lld: error: couldn't allocate output register for constraint '{v0}' at line 2157732948
ld.lld: error: couldn't allocate input reg for constraint '{v0}' at line 2157738385
ld.lld: error: couldn't allocate output register for constraint '{v16}' at line 2157781218
ld.lld: error: couldn't allocate output register for constraint '{v0}' at line 2157782350
ld.lld: error: couldn't allocate output register for constraint '{v4}' at line 2157786517
ld.lld: error: couldn't allocate output register for constraint '{v4}' at line 2157789877
ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
make: *** [Makefile:1156: vmlinux] Error 1
==> ERROR: A failure occurred in build().
Aborting...
More detail is obtained when not using LTO, here is output without LTO and using with "make v=1" :
CC fs/proc/inode.o
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:151:2: error: couldn't allocate output register for constraint '{v0}'
NEON_INIT_LOOP();
^
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:75:6: note: expanded from macro 'NEON_INIT_LOOP'
asm("eor %[ZERO].16b,%[ZERO].16b,%[ZERO].16b\n"
^
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:154:3: error: couldn't allocate output register for constraint '{v7}'
NEON_MAIN_LOOP(NEON_DONT_REVERSE);
^
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:93:6: note: expanded from macro 'NEON_MAIN_LOOP'
asm("ld1 { %[SRC].4s }, %[IP]\n"
^
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:157:2: error: couldn't allocate input reg for constraint '{v1}'
NEON_FINI_LOOP();
^
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:112:6: note: expanded from macro 'NEON_FINI_LOOP'
asm("st1 { %[ACC0].4s },%[DST0]\n"
^
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:190:2: error: couldn't allocate output register for constraint '{v0}'
NEON_INIT_LOOP();
^
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:75:6: note: expanded from macro 'NEON_INIT_LOOP'
asm("eor %[ZERO].16b,%[ZERO].16b,%[ZERO].16b\n"
^
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:193:3: error: couldn't allocate output register for constraint '{v7}'
NEON_MAIN_LOOP(NEON_DO_REVERSE);
^
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:93:6: note: expanded from macro 'NEON_MAIN_LOOP'
asm("ld1 { %[SRC].4s }, %[IP]\n"
^
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:196:2: error: couldn't allocate input reg for constraint '{v1}'
NEON_FINI_LOOP();
^
fs/zfs/zcommon/zfs_fletcher_aarch64_neon.c:112:6: note: expanded from macro 'NEON_FINI_LOOP'
asm("st1 { %[ACC0].4s },%[DST0]\n"
^
6 errors generated.
make[3]: *** [scripts/Makefile.build:288: fs/zfs/zcommon/zfs_fletcher_aarch64_neon.o] Error 1
make[2]: *** [scripts/Makefile.build:550: fs/zfs/zcommon] Error 2
make[1]: *** [scripts/Makefile.build:550: fs/zfs] Error 2
make[1]: *** Waiting for unfinished jobs....
The text was updated successfully, but these errors were encountered: