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
-mno-save-restore spams a RISCV Linux kernel build #44198
Comments
Please can you tell me exactly which LLVM version (including git revision, if you're on master) you are using? HEAD, as of today (f2af4f8) does not include any code to translate Have you applied some patches of your own? |
No, both the LLVM toolchain and Linux kernel are completely vanilla. $ clang --version | head -n1 $ git describe --contains $ make -j$(nproc) -s ARCH=riscv CC=clang CROSS_COMPILE=riscv64-linux-gnu- O=out.riscv distclean defconfig init/main.o The full command from that translation unit, if it is relevant: clang -Wp,-MD,init/.main.o.d -nostdinc -isystem /home/nathan/cbl/git/tc-build/install/lib/clang/11.0.0/include -I../arch/riscv/include -I./arch/riscv/include/generated -I../include -I./include -I../arch/riscv/include/uapi -I./arch/riscv/include/generated/uapi -I../include/uapi -I./include/generated/uapi -include ../include/linux/kconfig.h -include ../include/linux/compiler_types.h -D__KERNEL__ -Qunused-arguments -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 --target=riscv64-linux-gnu --prefix=/home/nathan/cbl/git/tc-build/install/bin/ --gcc-toolchain=/home/nathan/cbl/git/tc-build/install -no-integrated-as -Werror=unknown-warning-option -mabi=lp64 -march=rv64imac -mno-save-restore -DCONFIG_PAGE_OFFSET=0xffffffe000000000 -mcmodel=medany -fno-delete-null-pointer-checks -Wno-address-of-packed-member -O2 -Wframe-larger-than=2048 -fno-stack-protector -Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare -mno-global-merge -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -fno-strict-overflow -fno-merge-all-constants -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -fmacro-prefix-map=../= -Wno-initializer-overrides -Wno-format -Wno-sign-compare -Wno-format-zero-length -fno-function-sections -fno-data-sections -I ../init -I ./init -DKBUILD_MODFILE='"init/main"' -DKBUILD_BASENAME='"main"' -DKBUILD_MODNAME='"main"' -c -o init/main.o ../init/main.c |
I cannot find "-save-restore" in any of the clang or llvm source code as of commit I think maybe this warning is coming from some cached The "save-restore" feature has only been parts of patches until today, I believe, so I don't think any mainline clang version has been generating code with the save-restore feature yet. That said, |
Yes, these warnings are gone with my version of clang at bc316c2, I'll close this, thank you! |
Extended Description
When building the Linux kernel for RISCV, there is a bunch of warning spam around -mno-save-restore, which is explicitly specified in arch/riscv/Makefile.
$ make -j$(nproc) -s ARCH=riscv CC=clang-11 CROSS_COMPILE=riscv64-linux-gnu- O=out.riscv distclean defconfig all
...
'-save-restore' is not a recognized feature for this target (ignoring feature)
'-save-restore' is not a recognized feature for this target (ignoring feature)
'-save-restore' is not a recognized feature for this target (ignoring feature)
'-save-restore' is not a recognized feature for this target (ignoring feature)
...
I assume this warning is coming from the backend since -msave-restore warns from clang.
$ echo | clang-11 --target=riscv64-linux-gnu -msave-restore -c -x c -o /dev/null -
clang: warning: the clang compiler does not support '-msave-restore'
'+save-restore' is not a recognized feature for this target (ignoring feature)
$ echo | clang-11 --target=riscv64-linux-gnu -mno-save-restore -c -x c -o /dev/null -
'-save-restore' is not a recognized feature for this target (ignoring feature)
This warning happens on every translation unit so it is very noisy. We could silence it by just not passing -mno-save-restore when building with clang but that seems fragile in case -msave-restore ever became default. We’ll do whatever you feel is best though.
The text was updated successfully, but these errors were encountered: