efi/libstub: Disable some warnings for x86{,_64}
PATCH 1/1 efi/libstub: Disable some warnings for x86{,_64}
When building the kernel with Clang, some disabled warnings appear because this Makefile overrides KBUILD_CFLAGS for x86{,_64}. Add them to this list so that the build is clean again.
-Wpointer-sign was disabled for the whole kernel before the beginning of git history.
-Waddress-of-packed-member was disabled for the whole kernel in commit bfb38988c51e ("kbuild: clang: Disable 'address-of-packed-member' warning") and for x86/boot/compressed in commit 20c6c1890455 ("x86/boot:
Disable the address-of-packed-member compiler warning").
-Wgnu was disabled for the whole kernel in commit 61163efae020 ("kbuild:
LLVMLinux: Add Kbuild support for building kernel with Clang") and for x86/boot/compressed in commit 6c3b56b19730 ("x86/boot: Disable Clang warnings about GNU extensions").
---
Nick expressed concern that this Makefile is overwriting KBUILD_CFLAGS and suggested potentially rewriting the x86 portion of this Makefile to behave like the arm/arm64 one where problematic flags are filtered out. While that comes to fruition, it would be nice for this folder to behave like the rest of the kernel when it comes to this warnings so that the build is cleaner, thus this patch.
drivers/firmware/efi/libstub/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/firmware/efi/libstub/Makefile +4 -1
@@ -9,7 +9,10 @@ cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ -fPIC -fno-strict-aliasing -mno-red-zone \ - -mno-mmx -mno-sse -fshort-wchar + -mno-mmx -mno-sse -fshort-wchar \ + -Wno-pointer-sign \ + $(call cc-disable-warning, address-of-packed-member) \ + $(call cc-disable-warning, gnu) # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly # disable the stackleak plugin
Signature · 1 line
2.19.1
Quoted 37 lines · Nathan Chancellor
When building the kernel with Clang, some disabled warnings appear because this
MakefileoverridesKBUILD_CFLAGSfor x86{,_64}. Add them to this list so that the build is clean again.-Wpointer-sign was disabled for the whole kernel before the beginning of git history.
-Waddress-of-packed-member was disabled for the whole kernel in commit
bfb38988c51e("kbuild: clang: Disable 'address-of-packed-member' warning") and for x86/boot/compressed in commit20c6c1890455("x86/boot:
Disable the address-of-packed-member compiler warning").-Wgnu was disabled for the whole kernel in commit
61163efae020("kbuild:
LLVMLinux: AddKbuildsupport for building kernel with Clang") and for x86/boot/compressed in commit6c3b56b19730("x86/boot: Disable Clang warnings about GNU extensions").Signed-off-by Nathan Chancellor <[email protected]>---
Nick expressed concern that this
Makefileis overwritingKBUILD_CFLAGSand suggested potentially rewriting the x86 portion of thisMakefileto behave like the arm/arm64 one where problematic flags are filtered out. While that comes to fruition, it would be nice for this folder to behave like the rest of the kernel when it comes to this warnings so that the build is cleaner, thus this patch.drivers/firmware/efi/libstub/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/firmware/efi/libstub/Makefile +0
-0
drivers/firmware/efi/libstub/Makefile cflags-$(CONFIG_X86_32) := -march=i386 · line 13
Quoted 6 lines
drivers/firmware/efi/libstub/Makefile +2
-1@@ -9,7 +9,10 @@ cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ -fPIC -fno-strict-aliasing -mno-red-zone \ - -mno-mmx -mno-sse -fshort-wchar + -mno-mmx -mno-sse -fshort-wchar \ + -Wno-pointer-sign \
Hi Nathan, thanks for this patch.
Should this be:
$(call cc-disable-warning, pointer-sign)
as well?
Quoted 8 lines
drivers/firmware/efi/libstub/Makefile +2
-1+ $(call cc-disable-warning, address-of-packed-member) \ + $(call cc-disable-warning, gnu) # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly # disable the stackleak plugin --2.19.1
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 48 lines · Nick Desaulniers
Quoted 37 lines · Nathan Chancellor
When building the kernel with Clang, some disabled warnings appear because this
MakefileoverridesKBUILD_CFLAGSfor x86{,_64}. Add them to this list so that the build is clean again.-Wpointer-sign was disabled for the whole kernel before the beginning of git history.
-Waddress-of-packed-member was disabled for the whole kernel in commit
bfb38988c51e("kbuild: clang: Disable 'address-of-packed-member' warning") and for x86/boot/compressed in commit20c6c1890455("x86/boot:
Disable the address-of-packed-member compiler warning").-Wgnu was disabled for the whole kernel in commit
61163efae020("kbuild:
LLVMLinux: AddKbuildsupport for building kernel with Clang") and for x86/boot/compressed in commit6c3b56b19730("x86/boot: Disable Clang warnings about GNU extensions").Signed-off-by Nathan Chancellor <[email protected]>---
Nick expressed concern that this
Makefileis overwritingKBUILD_CFLAGSand suggested potentially rewriting the x86 portion of thisMakefileto behave like the arm/arm64 one where problematic flags are filtered out. While that comes to fruition, it would be nice for this folder to behave like the rest of the kernel when it comes to this warnings so that the build is cleaner, thus this patch.drivers/firmware/efi/libstub/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/firmware/efi/libstub/Makefile +0
-0drivers/firmware/efi/libstub/Makefile cflags-$(CONFIG_X86_32) := -march=i386 · line 13
Quoted 6 lines
drivers/firmware/efi/libstub/Makefile +2
-1@@ -9,7 +9,10 @@ cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ -fPIC -fno-strict-aliasing -mno-red-zone \ - -mno-mmx -mno-sse -fshort-wchar + -mno-mmx -mno-sse -fshort-wchar \ + -Wno-pointer-sign \Hi Nathan, thanks for this patch.
Quoted 4 lines
Should this be:
$(call cc-disable-warning, pointer-sign)
as well?
According to commit 1d6bf3a9a546 ("kbuild: add -Wno-pointer-sign flag unconditionally") in -next, all supported compilers recognize the flag so I don't think it's necessary.
Quoted 13 lines
Quoted 8 lines
drivers/firmware/efi/libstub/Makefile +2
-1+ $(call cc-disable-warning, address-of-packed-member) \ + $(call cc-disable-warning, gnu) # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly # disable the stackleak plugin --2.19.1
Signature · 2 lines
Thanks, ~Nick Desaulniers
Thanks for the review!
Nathan
Nick Desaulniers
Tested-byQuoted 50 lines · Nathan Chancellor
Quoted 48 lines · Nick Desaulniers
Quoted 37 lines · Nathan Chancellor
When building the kernel with Clang, some disabled warnings appear because this
MakefileoverridesKBUILD_CFLAGSfor x86{,_64}. Add them to this list so that the build is clean again.-Wpointer-sign was disabled for the whole kernel before the beginning of git history.
-Waddress-of-packed-member was disabled for the whole kernel in commit
bfb38988c51e("kbuild: clang: Disable 'address-of-packed-member' warning") and for x86/boot/compressed in commit20c6c1890455("x86/boot:
Disable the address-of-packed-member compiler warning").-Wgnu was disabled for the whole kernel in commit
61163efae020("kbuild:
LLVMLinux: AddKbuildsupport for building kernel with Clang") and for x86/boot/compressed in commit6c3b56b19730("x86/boot: Disable Clang warnings about GNU extensions").Signed-off-by Nathan Chancellor <[email protected]>---
Nick expressed concern that this
Makefileis overwritingKBUILD_CFLAGSand suggested potentially rewriting the x86 portion of thisMakefileto behave like the arm/arm64 one where problematic flags are filtered out. While that comes to fruition, it would be nice for this folder to behave like the rest of the kernel when it comes to this warnings so that the build is cleaner, thus this patch.drivers/firmware/efi/libstub/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/firmware/efi/libstub/Makefile +0
-0drivers/firmware/efi/libstub/Makefile cflags-$(CONFIG_X86_32) := -march=i386 · line 13
Quoted 6 lines
drivers/firmware/efi/libstub/Makefile +2
-1@@ -9,7 +9,10 @@ cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ -fPIC -fno-strict-aliasing -mno-red-zone \ - -mno-mmx -mno-sse -fshort-wchar + -mno-mmx -mno-sse -fshort-wchar \ + -Wno-pointer-sign \Hi Nathan, thanks for this patch.
Quoted 8 lines
Quoted 4 lines
Should this be:
$(call cc-disable-warning, pointer-sign)
as well?According to commit
1d6bf3a9a546("kbuild: add -Wno-pointer-sign flag unconditionally") in -next, all supported compilers recognize the flag so I don't think it's necessary.
No problem.
Quoted 17 lines
Quoted 11 lines
Quoted 9 lines
drivers/firmware/efi/libstub/Makefile +2
-1+ $(call cc-disable-warning, address-of-packed-member) \ + $(call cc-disable-warning, gnu) # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly # disable the stackleak plugin --2.19.1
Quoted 3 lines
--
Thanks,
~Nick DesaulniersThanks for the review!
Nathan
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 50 lines · Nathan Chancellor
When building the kernel with Clang, some disabled warnings appear because this
MakefileoverridesKBUILD_CFLAGSfor x86{,_64}. Add them to this list so that the build is clean again.-Wpointer-sign was disabled for the whole kernel before the beginning of git history.
-Waddress-of-packed-member was disabled for the whole kernel in commit
bfb38988c51e("kbuild: clang: Disable 'address-of-packed-member' warning") and for x86/boot/compressed in commit20c6c1890455("x86/boot:
Disable the address-of-packed-member compiler warning").-Wgnu was disabled for the whole kernel in commit
61163efae020("kbuild:
LLVMLinux: AddKbuildsupport for building kernel with Clang") and for x86/boot/compressed in commit6c3b56b19730("x86/boot: Disable Clang warnings about GNU extensions").Signed-off-by Nathan Chancellor <[email protected]>---
Nick expressed concern that this
Makefileis overwritingKBUILD_CFLAGSand suggested potentially rewriting the x86 portion of thisMakefileto behave like the arm/arm64 one where problematic flags are filtered out. While that comes to fruition, it would be nice for this folder to behave like the rest of the kernel when it comes to this warnings so that the build is cleaner, thus this patch.drivers/firmware/efi/libstub/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/firmware/efi/libstub/Makefile +4
-1@@ -9,7 +9,10 @@ cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ -fPIC -fno-strict-aliasing -mno-red-zone \ - -mno-mmx -mno-sse -fshort-wchar + -mno-mmx -mno-sse -fshort-wchar \ + -Wno-pointer-sign \ + $(call cc-disable-warning, address-of-packed-member) \ + $(call cc-disable-warning, gnu) # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly # disable the stackleak pluginSignature · 1 line
2.19.1
+ Sedat for review/testing.
Quoted 47 lines · Nathan Chancellor
Quoted 45 lines · Nathan Chancellor
When building the kernel with Clang, some disabled warnings appear because this
MakefileoverridesKBUILD_CFLAGSfor x86{,_64}. Add them to this list so that the build is clean again.-Wpointer-sign was disabled for the whole kernel before the beginning of git history.
-Waddress-of-packed-member was disabled for the whole kernel in commit
bfb38988c51e("kbuild: clang: Disable 'address-of-packed-member' warning") and for x86/boot/compressed in commit20c6c1890455("x86/boot:
Disable the address-of-packed-member compiler warning").-Wgnu was disabled for the whole kernel in commit
61163efae020("kbuild:
LLVMLinux: AddKbuildsupport for building kernel with Clang") and for x86/boot/compressed in commit6c3b56b19730("x86/boot: Disable Clang warnings about GNU extensions").Signed-off-by Nathan Chancellor <[email protected]>---
Nick expressed concern that this
Makefileis overwritingKBUILD_CFLAGSand suggested potentially rewriting the x86 portion of thisMakefileto behave like the arm/arm64 one where problematic flags are filtered out. While that comes to fruition, it would be nice for this folder to behave like the rest of the kernel when it comes to this warnings so that the build is cleaner, thus this patch.drivers/firmware/efi/libstub/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/firmware/efi/libstub/Makefile +4
-1@@ -9,7 +9,10 @@ cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ -fPIC -fno-strict-aliasing -mno-red-zone \ - -mno-mmx -mno-sse -fshort-wchar + -mno-mmx -mno-sse -fshort-wchar \ + -Wno-pointer-sign \ + $(call cc-disable-warning, address-of-packed-member) \ + $(call cc-disable-warning, gnu)
Quoted 7 lines
Quoted 5 lines
drivers/firmware/efi/libstub/Makefile +0
-1# arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly # disable the stackleak plugin --2.19.1
+ Sedat for review/testing.
Thanks Nathan.
[ See duplicate "arch/x86/include/asm/processor.h: Warning -Waddress-of-packed-member "
<https://github.com/ClangBuiltLinux/linux/issues/234> ]
Regards,
- Sedat -
Quoted 57 lines · Sedat Dilek
Quoted 47 lines · Nathan Chancellor
Quoted 45 lines · Nathan Chancellor
When building the kernel with Clang, some disabled warnings appear because this
MakefileoverridesKBUILD_CFLAGSfor x86{,_64}. Add them to this list so that the build is clean again.-Wpointer-sign was disabled for the whole kernel before the beginning of git history.
-Waddress-of-packed-member was disabled for the whole kernel in commit
bfb38988c51e("kbuild: clang: Disable 'address-of-packed-member' warning") and for x86/boot/compressed in commit20c6c1890455("x86/boot:
Disable the address-of-packed-member compiler warning").-Wgnu was disabled for the whole kernel in commit
61163efae020("kbuild:
LLVMLinux: AddKbuildsupport for building kernel with Clang") and for x86/boot/compressed in commit6c3b56b19730("x86/boot: Disable Clang warnings about GNU extensions").Signed-off-by Nathan Chancellor <[email protected]>---
Nick expressed concern that this
Makefileis overwritingKBUILD_CFLAGSand suggested potentially rewriting the x86 portion of thisMakefileto behave like the arm/arm64 one where problematic flags are filtered out. While that comes to fruition, it would be nice for this folder to behave like the rest of the kernel when it comes to this warnings so that the build is cleaner, thus this patch.drivers/firmware/efi/libstub/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/firmware/efi/libstub/Makefile +4
-1@@ -9,7 +9,10 @@ cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ -fPIC -fno-strict-aliasing -mno-red-zone \ - -mno-mmx -mno-sse -fshort-wchar + -mno-mmx -mno-sse -fshort-wchar \ + -Wno-pointer-sign \ + $(call cc-disable-warning, address-of-packed-member) \ + $(call cc-disable-warning, gnu)Quoted 7 lines
Quoted 5 lines
drivers/firmware/efi/libstub/Makefile +0
-1# arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly # disable the stackleak plugin --2.19.1
+ Sedat for review/testing.
Quoted 9 lines
Thanks Nathan.
Reviewed-by Sedat Dilek <[email protected]>Tested-by Sedat Dilek <[email protected]>[ Reported-by: Sedat Dilek <[email protected]> ][ See duplicate "
arch/x86/include/asm/processor.h: Warning -Waddress-of-packed-member "
<https://github.com/ClangBuiltLinux/linux/issues/234> ]
Queued in efi/next
Thanks
Quoted 69 lines · Ard Biesheuvel
Quoted 57 lines · Sedat Dilek
Quoted 47 lines · Nathan Chancellor
Quoted 45 lines · Nathan Chancellor
When building the kernel with Clang, some disabled warnings appear because this
MakefileoverridesKBUILD_CFLAGSfor x86{,_64}. Add them to this list so that the build is clean again.-Wpointer-sign was disabled for the whole kernel before the beginning of git history.
-Waddress-of-packed-member was disabled for the whole kernel in commit
bfb38988c51e("kbuild: clang: Disable 'address-of-packed-member' warning") and for x86/boot/compressed in commit20c6c1890455("x86/boot:
Disable the address-of-packed-member compiler warning").-Wgnu was disabled for the whole kernel in commit
61163efae020("kbuild:
LLVMLinux: AddKbuildsupport for building kernel with Clang") and for x86/boot/compressed in commit6c3b56b19730("x86/boot: Disable Clang warnings about GNU extensions").Signed-off-by Nathan Chancellor <[email protected]>---
Nick expressed concern that this
Makefileis overwritingKBUILD_CFLAGSand suggested potentially rewriting the x86 portion of thisMakefileto behave like the arm/arm64 one where problematic flags are filtered out. While that comes to fruition, it would be nice for this folder to behave like the rest of the kernel when it comes to this warnings so that the build is cleaner, thus this patch.drivers/firmware/efi/libstub/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/firmware/efi/libstub/Makefile +4
-1@@ -9,7 +9,10 @@ cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ -fPIC -fno-strict-aliasing -mno-red-zone \ - -mno-mmx -mno-sse -fshort-wchar + -mno-mmx -mno-sse -fshort-wchar \ + -Wno-pointer-sign \ + $(call cc-disable-warning, address-of-packed-member) \ + $(call cc-disable-warning, gnu)Quoted 7 lines
Quoted 5 lines
drivers/firmware/efi/libstub/Makefile +0
-1# arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly # disable the stackleak plugin --2.19.1
+ Sedat for review/testing.
Quoted 9 lines
Thanks Nathan.
Reviewed-by Sedat Dilek <[email protected]>Tested-by Sedat Dilek <[email protected]>[ Reported-by: Sedat Dilek <[email protected]> ][ See duplicate "
arch/x86/include/asm/processor.h: Warning -Waddress-of-packed-member "
<https://github.com/ClangBuiltLinux/linux/issues/234> ]
Quoted 2 lines
Queued in efi/next
Thanks Ard.
This means efi-for-4.21 / efi-for-5.0?
- Sedat -
Quoted 70 lines · Sedat Dilek
Quoted 69 lines · Ard Biesheuvel
Quoted 66 lines · Sedat Dilek
Quoted 47 lines · Nathan Chancellor
Quoted 45 lines · Nathan Chancellor
When building the kernel with Clang, some disabled warnings appear because this
MakefileoverridesKBUILD_CFLAGSfor x86{,_64}. Add them to this list so that the build is clean again.-Wpointer-sign was disabled for the whole kernel before the beginning of git history.
-Waddress-of-packed-member was disabled for the whole kernel in commit
bfb38988c51e("kbuild: clang: Disable 'address-of-packed-member' warning") and for x86/boot/compressed in commit20c6c1890455("x86/boot:
Disable the address-of-packed-member compiler warning").-Wgnu was disabled for the whole kernel in commit
61163efae020("kbuild:
LLVMLinux: AddKbuildsupport for building kernel with Clang") and for x86/boot/compressed in commit6c3b56b19730("x86/boot: Disable Clang warnings about GNU extensions").Signed-off-by Nathan Chancellor <[email protected]>---
Nick expressed concern that this
Makefileis overwritingKBUILD_CFLAGSand suggested potentially rewriting the x86 portion of thisMakefileto behave like the arm/arm64 one where problematic flags are filtered out. While that comes to fruition, it would be nice for this folder to behave like the rest of the kernel when it comes to this warnings so that the build is cleaner, thus this patch.drivers/firmware/efi/libstub/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/firmware/efi/libstub/Makefile +4
-1@@ -9,7 +9,10 @@ cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ -fPIC -fno-strict-aliasing -mno-red-zone \ - -mno-mmx -mno-sse -fshort-wchar + -mno-mmx -mno-sse -fshort-wchar \ + -Wno-pointer-sign \ + $(call cc-disable-warning, address-of-packed-member) \ + $(call cc-disable-warning, gnu)Quoted 7 lines
Quoted 5 lines
drivers/firmware/efi/libstub/Makefile +0
-1# arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly # disable the stackleak plugin --2.19.1
+ Sedat for review/testing.
Thanks Nathan.
Reviewed-by Sedat Dilek <[email protected]>Tested-by Sedat Dilek <[email protected]>[ Reported-by: Sedat Dilek <[email protected]> ][ See duplicate "
arch/x86/include/asm/processor.h: Warning -Waddress-of-packed-member "
<https://github.com/ClangBuiltLinux/linux/issues/234> ]
Quoted 6 lines
Quoted 2 lines
Queued in efi/next
Thanks Ard.
This means efi-for-4.21 / efi-for-5.0?
Yes
Quoted 8 lines · Ard Biesheuvel
Quoted 4 lines · Sedat Dilek
Thanks Ard.
This means efi-for-4.21 / efi-for-5.0?Yes
Thanks for picking up this patch, Ard. Is there any way to get it into 4.20?
Signature · 2 lines
Thanks, ~Nick Desaulniers