Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: remove cc-option test of -ffreestanding

Some Makefiles already pass -ffreestanding unconditionally.
For example, arch/arm64/lib/Makefile, arch/x86/purgatory/Makefile.

No problem report so far about hard-coding this option. So, we can
assume all supported compilers know -ffreestanding.

I confirmed GCC 4.8 and Clang manuals document this option.

Get rid of cc-option from -ffreestanding.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>

+4 -4
+1 -1
arch/s390/Makefile
··· 27 27 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY 28 28 KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float 29 29 KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables 30 - KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-option,-ffreestanding) 30 + KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding 31 31 KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member) 32 32 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) 33 33 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
+1 -1
arch/x86/Makefile
··· 36 36 -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ 37 37 -mno-mmx -mno-sse 38 38 39 - REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -ffreestanding) 39 + REALMODE_CFLAGS += -ffreestanding 40 40 REALMODE_CFLAGS += -fno-stack-protector 41 41 REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -Wno-address-of-packed-member) 42 42 REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), $(cc_stack_align4))
+1 -1
arch/x86/boot/compressed/Makefile
··· 35 35 cflags-$(CONFIG_X86_64) := -mcmodel=small 36 36 KBUILD_CFLAGS += $(cflags-y) 37 37 KBUILD_CFLAGS += -mno-mmx -mno-sse 38 - KBUILD_CFLAGS += $(call cc-option,-ffreestanding) 38 + KBUILD_CFLAGS += -ffreestanding 39 39 KBUILD_CFLAGS += -fno-stack-protector 40 40 KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) 41 41 KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
+1 -1
drivers/firmware/efi/libstub/Makefile
··· 29 29 KBUILD_CFLAGS := $(cflags-y) -Os -DDISABLE_BRANCH_PROFILING \ 30 30 -include $(srctree)/drivers/firmware/efi/libstub/hidden.h \ 31 31 -D__NO_FORTIFY \ 32 - $(call cc-option,-ffreestanding) \ 32 + -ffreestanding \ 33 33 -fno-stack-protector \ 34 34 $(call cc-option,-fno-addrsig) \ 35 35 -D__DISABLE_EXPORTS