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

Merge patch "kbuild: Add '-fms-extensions' to areas with dedicated CFLAGS"

Nathan Chancellor <nathan@kernel.org> says:

Shared branch between Kbuild and other trees for enabling
'-fms-extensions' for 6.19.

* tag 'kbuild-ms-extensions-6.19' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/kbuild/linux:
kbuild: Add '-fms-extensions' to areas with dedicated CFLAGS
Kbuild: enable -fms-extensions
jfs: Rename _inline to avoid conflict with clang's '-fms-extensions'

Link: https://patch.msgid.link/20251101-kbuild-ms-extensions-dedicated-cflags-v1-1-38004aba524b@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>

+29 -15
+3
Makefile
··· 1061 1061 # perform bounds checking. 1062 1062 KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3) 1063 1063 1064 + # Allow including a tagged struct or union anonymously in another struct/union. 1065 + KBUILD_CFLAGS += -fms-extensions 1066 + 1064 1067 # disable invalid "can't wrap" optimizations for signed / pointers 1065 1068 KBUILD_CFLAGS += -fno-strict-overflow 1066 1069
+2 -1
arch/arm64/kernel/vdso32/Makefile
··· 63 63 $(filter -Werror,$(KBUILD_CPPFLAGS)) \ 64 64 -Werror-implicit-function-declaration \ 65 65 -Wno-format-security \ 66 - -std=gnu11 66 + -std=gnu11 -fms-extensions 67 67 VDSO_CFLAGS += -O2 68 68 # Some useful compiler-dependent flags from top-level Makefile 69 69 VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign) ··· 71 71 VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes) 72 72 VDSO_CFLAGS += -Werror=date-time 73 73 VDSO_CFLAGS += $(call cc32-option,-Werror=incompatible-pointer-types) 74 + VDSO_CFLAGS += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag) 74 75 75 76 # Compile as THUMB2 or ARM. Unwinding via frame-pointers in THUMB2 is 76 77 # unreliable.
+1 -1
arch/loongarch/vdso/Makefile
··· 19 19 cflags-vdso := $(ccflags-vdso) \ 20 20 -isystem $(shell $(CC) -print-file-name=include) \ 21 21 $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \ 22 - -std=gnu11 -O2 -g -fno-strict-aliasing -fno-common -fno-builtin \ 22 + -std=gnu11 -fms-extensions -O2 -g -fno-strict-aliasing -fno-common -fno-builtin \ 23 23 -fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \ 24 24 $(call cc-option, -fno-asynchronous-unwind-tables) \ 25 25 $(call cc-option, -fno-stack-protector)
+1 -1
arch/parisc/boot/compressed/Makefile
··· 18 18 ifndef CONFIG_64BIT 19 19 KBUILD_CFLAGS += -mfast-indirect-calls 20 20 endif 21 - KBUILD_CFLAGS += -std=gnu11 21 + KBUILD_CFLAGS += -std=gnu11 -fms-extensions 22 22 23 23 LDFLAGS_vmlinux := -X -e startup --as-needed -T 24 24 $(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE
+2 -1
arch/powerpc/boot/Makefile
··· 70 70 BOOTCPPFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) 71 71 72 72 BOOTCFLAGS := $(BOOTTARGETFLAGS) \ 73 - -std=gnu11 \ 73 + -std=gnu11 -fms-extensions \ 74 74 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 75 75 -fno-strict-aliasing -O2 \ 76 76 -msoft-float -mno-altivec -mno-vsx \ ··· 86 86 87 87 ifdef CONFIG_CC_IS_CLANG 88 88 BOOTCFLAGS += $(CLANG_FLAGS) 89 + BOOTCFLAGS += -Wno-microsoft-anon-tag 89 90 BOOTAFLAGS += $(CLANG_FLAGS) 90 91 endif 91 92
+2 -1
arch/s390/Makefile
··· 22 22 ifndef CONFIG_AS_IS_LLVM 23 23 KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf)) 24 24 endif 25 - KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11 25 + KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11 -fms-extensions 26 26 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY 27 27 KBUILD_CFLAGS_DECOMPRESSOR += -D__DECOMPRESSOR 28 28 KBUILD_CFLAGS_DECOMPRESSOR += -Wno-pointer-sign ··· 35 35 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) 36 36 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,)) 37 37 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-array-bounds) 38 + KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag) 38 39 39 40 UTS_MACHINE := s390x 40 41 STACK_SIZE := $(if $(CONFIG_KASAN),65536,$(if $(CONFIG_KMSAN),65536,16384))
+2 -1
arch/s390/purgatory/Makefile
··· 13 13 $(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE 14 14 $(call if_changed_rule,as_o_S) 15 15 16 - KBUILD_CFLAGS := -std=gnu11 -fno-strict-aliasing -Wall -Wstrict-prototypes 16 + KBUILD_CFLAGS := -std=gnu11 -fms-extensions -fno-strict-aliasing -Wall -Wstrict-prototypes 17 17 KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare 18 18 KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding 19 19 KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common ··· 21 21 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING 22 22 KBUILD_CFLAGS += -D__DISABLE_EXPORTS 23 23 KBUILD_CFLAGS += $(CLANG_FLAGS) 24 + KBUILD_CFLAGS += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag) 24 25 KBUILD_CFLAGS += $(call cc-option,-fno-PIE) 25 26 KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS)) 26 27 KBUILD_AFLAGS += -D__DISABLE_EXPORTS
+3 -1
arch/x86/Makefile
··· 48 48 49 49 # How to compile the 16-bit code. Note we always compile for -march=i386; 50 50 # that way we can complain to the user if the CPU is insufficient. 51 - REALMODE_CFLAGS := -std=gnu11 -m16 -g -Os -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \ 51 + REALMODE_CFLAGS := -std=gnu11 -fms-extensions -m16 -g -Os \ 52 + -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \ 52 53 -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \ 53 54 -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ 54 55 -mno-mmx -mno-sse $(call cc-option,-fcf-protection=none) ··· 61 60 REALMODE_CFLAGS += $(CLANG_FLAGS) 62 61 ifdef CONFIG_CC_IS_CLANG 63 62 REALMODE_CFLAGS += -Wno-gnu 63 + REALMODE_CFLAGS += -Wno-microsoft-anon-tag 64 64 endif 65 65 export REALMODE_CFLAGS 66 66
+5 -2
arch/x86/boot/compressed/Makefile
··· 25 25 # avoid errors with '-march=i386', and future flags may depend on the target to 26 26 # be valid. 27 27 KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS) 28 - KBUILD_CFLAGS += -std=gnu11 28 + KBUILD_CFLAGS += -std=gnu11 -fms-extensions 29 29 KBUILD_CFLAGS += -fno-strict-aliasing -fPIE 30 30 KBUILD_CFLAGS += -Wundef 31 31 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING ··· 36 36 KBUILD_CFLAGS += -ffreestanding -fshort-wchar 37 37 KBUILD_CFLAGS += -fno-stack-protector 38 38 KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) 39 - KBUILD_CFLAGS += $(call cc-disable-warning, gnu) 39 + ifdef CONFIG_CC_IS_CLANG 40 + KBUILD_CFLAGS += -Wno-gnu 41 + KBUILD_CFLAGS += -Wno-microsoft-anon-tag 42 + endif 40 43 KBUILD_CFLAGS += -Wno-pointer-sign 41 44 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables 42 45 KBUILD_CFLAGS += -D__DISABLE_EXPORTS
+2 -2
drivers/firmware/efi/libstub/Makefile
··· 11 11 12 12 cflags-$(CONFIG_X86_32) := -march=i386 13 13 cflags-$(CONFIG_X86_64) := -mcmodel=small 14 - cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -std=gnu11 \ 14 + cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -std=gnu11 -fms-extensions \ 15 15 -fPIC -fno-strict-aliasing -mno-red-zone \ 16 16 -mno-mmx -mno-sse -fshort-wchar \ 17 17 -Wno-pointer-sign \ 18 18 $(call cc-disable-warning, address-of-packed-member) \ 19 - $(call cc-disable-warning, gnu) \ 19 + $(if $(CONFIG_CC_IS_CLANG),-Wno-gnu -Wno-microsoft-anon-tag) \ 20 20 -fno-asynchronous-unwind-tables \ 21 21 $(CLANG_FLAGS) 22 22
+3 -3
fs/jfs/jfs_incore.h
··· 76 76 struct { 77 77 unchar _unused[16]; /* 16: */ 78 78 dxd_t _dxd; /* 16: */ 79 - /* _inline may overflow into _inline_ea when needed */ 79 + /* _inline_sym may overflow into _inline_ea when needed */ 80 80 /* _inline_ea may overlay the last part of 81 81 * file._xtroot if maxentry = XTROOTINITSLOT 82 82 */ 83 83 union { 84 84 struct { 85 85 /* 128: inline symlink */ 86 - unchar _inline[128]; 86 + unchar _inline_sym[128]; 87 87 /* 128: inline extended attr */ 88 88 unchar _inline_ea[128]; 89 89 }; ··· 101 101 #define i_imap u.file._imap 102 102 #define i_dirtable u.dir._table 103 103 #define i_dtroot u.dir._dtroot 104 - #define i_inline u.link._inline 104 + #define i_inline u.link._inline_sym 105 105 #define i_inline_ea u.link._inline_ea 106 106 #define i_inline_all u.link._inline_all 107 107
+3 -1
scripts/Makefile.extrawarn
··· 28 28 KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds 29 29 30 30 ifdef CONFIG_CC_IS_CLANG 31 - # The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable. 31 + # The kernel builds with '-std=gnu11' and '-fms-extensions' so use of GNU and 32 + # Microsoft extensions is acceptable. 32 33 KBUILD_CFLAGS += -Wno-gnu 34 + KBUILD_CFLAGS += -Wno-microsoft-anon-tag 33 35 34 36 # Clang checks for overflow/truncation with '%p', while GCC does not: 35 37 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219