Skip to contentSkip to conversation

fs/pipe: stop duplicating union pipe_index declaration

PATCH Applied Rasmus Villemoes 5 participants 19 messages Oct 23, 2025 – Nov 6, 2025

Subsystems (9)
x86 VFS PowerPC Kbuild +5 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/pipe: stop duplicating union pipe_index declaration

Now that we build with -fms-extensions, union pipe_index can be included as an anonymous member in struct pipe_inode_info, avoiding the duplication.

---
Do we want to do this as well? At the very least it would give some more test coverage if this could be in -next for most of a cycle.

Context for new people:

https://lore.kernel.org/lkml/CAHk-=wjeZwww6Zswn6F_iZTpUihTSNKYppLqj36iQDDhfntuEw@mail.gmail.com/
https://lore.kernel.org/linux-kbuild/[email protected]/

 include/linux/pipe_fs_i.h | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
include/linux/pipe_fs_i.h +1 -14
index 9d42d473d201..80539972e569 100644
@@ -44,12 +44,6 @@ typedef unsigned int pipe_index_t;
 typedef unsigned short pipe_index_t;
 #endif
 
-/*
- * We have to declare this outside 'struct pipe_inode_info',
- * but then we can't use 'union pipe_index' for an anonymous
- * union, so we end up having to duplicate this declaration
- * below. Annoying.
- */
 union pipe_index {
 	unsigned long head_tail;
 	struct {
@@ -87,14 +81,7 @@ struct pipe_inode_info {
 	struct mutex mutex;
 	wait_queue_head_t rd_wait, wr_wait;
 
-	/* This has to match the 'union pipe_index' above */
-	union {
-		unsigned long head_tail;
-		struct {
-			pipe_index_t head;
-			pipe_index_t tail;
-		};
-	};
+	union pipe_index;
 
 	unsigned int max_usage;
 	unsigned int ring_size;

base-commit: 778740ee2d00e5c04d0c8ffd9c3beea89b1ec554

Signature · 1 line
2.51.0
#1 lore raw
Quoted 8 lines · Rasmus Villemoes

Now that we build with -fms-extensions, union pipe_index can be included as an anonymous member in struct pipe_inode_info, avoiding the duplication.

---
Do we want to do this as well? At the very least it would give some more test coverage if this could be in -next for most of a cycle.

Yeah, this would also be a good conversion example so we could include it in kbuild-next with the appropriate Acks. We probably do not want to take too many other conversions in the initial pull. If people really want to use this in other places for 6.19, we should probably do a shared branch for these changes that maintainers could pull into their own trees.

Quoted 46 lines

Context for new people:

https://lore.kernel.org/lkml/CAHk-=wjeZwww6Zswn6F_iZTpUihTSNKYppLqj36iQDDhfntuEw@mail.gmail.com/
https://lore.kernel.org/linux-kbuild/[email protected]/

 include/linux/pipe_fs_i.h | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
include/linux/pipe_fs_i.h +1 -14
index 9d42d473d201..80539972e569 100644
@@ -44,12 +44,6 @@ typedef unsigned int pipe_index_t;
 typedef unsigned short pipe_index_t;
 #endif
 
-/*
- * We have to declare this outside 'struct pipe_inode_info',
- * but then we can't use 'union pipe_index' for an anonymous
- * union, so we end up having to duplicate this declaration
- * below. Annoying.
- */
 union pipe_index {
 	unsigned long head_tail;
 	struct {
@@ -87,14 +81,7 @@ struct pipe_inode_info {
 	struct mutex mutex;
 	wait_queue_head_t rd_wait, wr_wait;
 
-	/* This has to match the 'union pipe_index' above */
-	union {
-		unsigned long head_tail;
-		struct {
-			pipe_index_t head;
-			pipe_index_t tail;
-		};
-	};
+	union pipe_index;
 
 	unsigned int max_usage;
 	unsigned int ring_size;

base-commit: 778740ee2d00e5c04d0c8ffd9c3beea89b1ec554

Signature · 1 line
2.51.0
#2 lore raw
Quoted 7 lines · Nathan Chancellor

Yeah, this would also be a good conversion example so we could include it in kbuild-next with the appropriate Acks. We probably do not want to take too many other conversions in the initial pull. If people really want to use this in other places for 6.19, we should probably do a shared branch for these changes that maintainers could pull into their own trees.

Yes. This is a good example of what the use case is and why we're doing this extension. So Ack both on including it as such, and on the whole "let's not go overboard with other conversions" thing.

Linus

#3 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 7 lines · Nathan Chancellor

Yeah, this would also be a good conversion example so we could include it in kbuild-next with the appropriate Acks. We probably do not want to take too many other conversions in the initial pull. If people really want to use this in other places for 6.19, we should probably do a shared branch for these changes that maintainers could pull into their own trees.

Quoted 3 lines

Yes. This is a good example of what the use case is and why we're doing this extension. So Ack both on including it as such, and on the whole "let's not go overboard with other conversions" thing.

WHAT??? We're actually doing that? This is fscking lovely! I thought this would never fly and so I actually never proposed it. Who do I have to hug for doing this? I'm a very happy boy right now.

maintainer Applied
#4 lore raw
In reply to Rasmus Villemoes
Quoted 5 lines · Rasmus Villemoes

Now that we build with -fms-extensions, union pipe_index can be included as an anonymous member in struct pipe_inode_info, avoiding the duplication.

Applied to the vfs-6.19.misc branch of the vfs/vfs.git tree. Patches in the vfs-6.19.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.19.misc

[1/1] fs/pipe: stop duplicating union pipe_index declaration

      https://git.kernel.org/vfs/vfs/c/ade24f8214fe
#5 lore raw

Hi Christian,

Quoted 16 lines · Christian Brauner
Quoted 5 lines · Rasmus Villemoes

Now that we build with -fms-extensions, union pipe_index can be included as an anonymous member in struct pipe_inode_info, avoiding the duplication.

Applied to the vfs-6.19.misc branch of the vfs/vfs.git tree. Patches in the vfs-6.19.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Quoted 8 lines

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.19.misc

[1/1] fs/pipe: stop duplicating union pipe_index declaration

      https://git.kernel.org/vfs/vfs/c/ade24f8214fe

As you may have noticed since I do not actually see this pushed, this change requires the '-fms-extensions' change that we are carrying in the kbuild tree for 6.19.

https://git.kernel.org/kbuild/c/778740ee2d00e5c04d0c8ffd9c3beea89b1ec554

Would you be okay with us carrying this change there as well with your Ack? Once '-fms-extensions' makes it into 6.19-rc1, you should be free to make any other changes like this.

Cheers,
Nathan

#6 lore raw
Quoted 25 lines · Nathan Chancellor

Hi Christian,

Quoted 22 lines · Christian Brauner
Quoted 5 lines · Rasmus Villemoes

Now that we build with -fms-extensions, union pipe_index can be included as an anonymous member in struct pipe_inode_info, avoiding the duplication.

Applied to the vfs-6.19.misc branch of the vfs/vfs.git tree. Patches in the vfs-6.19.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.19.misc
Quoted 8 lines
Quoted 2 lines

[1/1] fs/pipe: stop duplicating union pipe_index declaration

      https://git.kernel.org/vfs/vfs/c/ade24f8214fe

As you may have noticed since I do not actually see this pushed, this change requires the '-fms-extensions' change that we are carrying in the kbuild tree for 6.19.

https://git.kernel.org/kbuild/c/778740ee2d00e5c04d0c8ffd9c3beea89b1ec554

Meh, I thought it was already enabled.
Are you pushing this as a new feature for v6.19 or is Linus ok with enabling this still during v6.18?

#7 lore raw
Quoted 4 lines · Christian Brauner

Meh, I thought it was already enabled.
Are you pushing this as a new feature for v6.19 or is Linus ok with enabling this still during v6.18?

I wasn't planning on doing any conversions for 6.18, but if it makes things easier for people to start doing this, I could certainly take just the "add new compiler flags" at any time.

Alternatively, maybe Rasmus/Nathan could just expose that commit 778740ee2d00 ("Kbuild: enable -fms-extensions") as a shared stable branch.

That commit seems to be directly on top of 6.18-rc2, so people who want it could just pull that commit instead.

Linus

#8 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 4 lines · Christian Brauner

Meh, I thought it was already enabled.
Are you pushing this as a new feature for v6.19 or is Linus ok with enabling this still during v6.18?

I wasn't planning on doing any conversions for 6.18, but if it makes things easier for people to start doing this, I could certainly take just the "add new compiler flags" at any time.

Oh nice!

Quoted 7 lines

Alternatively, maybe Rasmus/Nathan could just expose that commit 778740ee2d00 ("Kbuild: enable -fms-extensions") as a shared stable branch.

That commit seems to be directly on top of 6.18-rc2, so people who want it could just pull that commit instead.

I'm fine either way. @Nathan, if you just want to give Linus the patch if it's small enough or just want to give me a stable branch I can pull I'll be content. Thanks!

#9 lore raw
Quoted 3 lines · Christian Brauner

I'm fine either way. @Nathan, if you just want to give Linus the patch if it's small enough or just want to give me a stable branch I can pull I'll be content. Thanks!

I do not care either way but I created a shared branch/tag since it was easy enough to do. If Linus wants to take these directly for -rc4, I am fine with that as well.

Cheers,
Nathan

The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:

Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git tags/kbuild-ms-extensions-6.19

for you to fetch changes up to c4781dc3d1cf0e017e1f290607ddc56cfe187afc:

Kbuild: enable -fms-extensions (2025-10-29 16:23:47 -0700)

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

----------------------------------------------------------------
Nathan Chancellor (1):
jfs: Rename _inline to avoid conflict with clang's '-fms-extensions'

Rasmus Villemoes (1):
Kbuild: enable -fms-extensions

 Makefile                   | 3 +++
 fs/jfs/jfs_incore.h        | 6 +++---
 scripts/Makefile.extrawarn | 4 +++-
 3 files changed, 9 insertions(+), 4 deletions(-)
#10 lore raw

fms extension (Was: [PATCH] fs/pipe: stop duplicating union pipe_index declaration)

Quoted 12 lines · Nathan Chancellor
Quoted 3 lines · Christian Brauner

I'm fine either way. @Nathan, if you just want to give Linus the patch if it's small enough or just want to give me a stable branch I can pull I'll be content. Thanks!

I do not care either way but I created a shared branch/tag since it was easy enough to do. If Linus wants to take these directly for -rc4, I am fine with that as well.

Cheers,
Nathan

Quoted 7 lines

The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:

Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git tags/kbuild-ms-extensions-6.19

Thanks, I pulled this and placed it into a branch that I can base other branches on.

_But_, I'm already running into problems. :)

I'm changing a struct ns_common in ns_common.h (struct ns_common) and wanted to make use of the fms extensions. ns_common.h is heavily included by virtue of the namespace stuff. So we get an include chain like the following:

In file included from ./include/linux/cgroup.h:23,

                 from ./include/linux/memcontrol.h:13,
                 from ./include/linux/swap.h:9,
                 from ./include/asm-generic/tlb.h:15,
                 from ./arch/x86/include/asm/tlb.h:8,
                 from ./arch/x86/include/asm/efi.h:7,
                 from drivers/firmware/efi/libstub/x86-stub.c:13:

./include/linux/ns_common.h:132:31: error: declaration does not declare anything [-Werror]
132 | struct ns_tree;
| ^
./include/linux/ns_common.h: In function '__ns_ref_active_read':
./include/linux/ns_common.h:228:31: error: 'const struct ns_common' has no member named '__ns_ref_active'
228 | return atomic_read(&ns->__ns_ref_active);
| ^~
In file included from ./arch/x86/include/asm/bug.h:108,

                 from ./arch/x86/include/asm/alternative.h:9,
                 from ./arch/x86/include/asm/segment.h:6,
                 from ./arch/x86/include/asm/ptrace.h:5,
                 from ./arch/x86/include/asm/math_emu.h:5,
                 from ./arch/x86/include/asm/processor.h:13,
                 from ./arch/x86/include/asm/timex.h:5,
                 from ./include/linux/timex.h:67,
                 from ./include/linux/time32.h:13,
                 from ./include/linux/time.h:60,
                 from ./include/linux/efi.h:17,
                 from drivers/firmware/efi/libstub/x86-stub.c:9:

Because struct cgroup_namespace embeddds struct ns_common and it proliferates via mm stuff into the efi code.

So the EFI cod has it's own KBUILD_CFLAGS. It does:

# non-x86 reuses KBUILD_CFLAGS, x86 does not
cflags-y			:= $(KBUILD_CFLAGS)

<snip>

KBUILD_CFLAGS			:= $(subst $(CC_FLAGS_FTRACE),,$(cflags-y)) \
				   -Os -DDISABLE_BRANCH_PROFILING \
				   -include $(srctree)/include/linux/hidden.h \
				   -D__NO_FORTIFY \
				   -ffreestanding \
				   -fno-stack-protector \
				   $(call cc-option,-fno-addrsig) \
				   -D__DISABLE_EXPORTS

which means x86 doesn't get -fms-extension breaking the build. If I manually insert:

drivers/firmware/efi/libstub/Makefile +2 -0
index 94b05e4451dd..4ad2f8f42134 100644
@@ -42,6 +42,8 @@ KBUILD_CFLAGS                 := $(subst $(CC_FLAGS_FTRACE),,$(cflags-y)) \
                                   -ffreestanding \
                                   -fno-stack-protector \
                                   $(call cc-option,-fno-addrsig) \
+                                  -fms-extensions \
+                                  -Wno-microsoft-anon-tag \
                                   -D__DISABLE_EXPORTS
 

The build works...

I think we need to decide how to fix this now because as soon as someone makes use of the extension that is indirectly included by that libstub thing we're fscked.

maintainer
#11 lore raw

Re: fms extension (Was: [PATCH] fs/pipe: stop duplicating union pipe_index declaration)

Quoted 27 lines · Christian Brauner
Quoted 12 lines · Nathan Chancellor
Quoted 3 lines · Christian Brauner

I'm fine either way. @Nathan, if you just want to give Linus the patch if it's small enough or just want to give me a stable branch I can pull I'll be content. Thanks!

I do not care either way but I created a shared branch/tag since it was easy enough to do. If Linus wants to take these directly for -rc4, I am fine with that as well.

Cheers,
Nathan

Quoted 7 lines

The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:

Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git tags/kbuild-ms-extensions-6.19

Thanks, I pulled this and placed it into a branch that I can base other branches on.

_But_, I'm already running into problems. :)

...

Quoted 37 lines

Because struct cgroup_namespace embeddds struct ns_common and it proliferates via mm stuff into the efi code.

So the EFI cod has it's own KBUILD_CFLAGS. It does:

# non-x86 reuses KBUILD_CFLAGS, x86 does not
cflags-y                        := $(KBUILD_CFLAGS)

<snip>

KBUILD_CFLAGS                   := $(subst $(CC_FLAGS_FTRACE),,$(cflags-y)) \
                                   -Os -DDISABLE_BRANCH_PROFILING \
                                   -include $(srctree)/include/linux/hidden.h \
                                   -D__NO_FORTIFY \
                                   -ffreestanding \
                                   -fno-stack-protector \
                                   $(call cc-option,-fno-addrsig) \
                                   -D__DISABLE_EXPORTS

which means x86 doesn't get -fms-extension breaking the build. If I manually insert:

drivers/firmware/efi/libstub/Makefile +2 -0
index 94b05e4451dd..4ad2f8f42134 100644
@@ -42,6 +42,8 @@ KBUILD_CFLAGS                 := $(subst $(CC_FLAGS_FTRACE),,$(cflags-y)) \
                                   -ffreestanding \
                                   -fno-stack-protector \
                                   $(call cc-option,-fno-addrsig) \
+                                  -fms-extensions \
+                                  -Wno-microsoft-anon-tag \
                                   -D__DISABLE_EXPORTS
 

The build works...

Quoted 3 lines

I think we need to decide how to fix this now because as soon as someone makes use of the extension that is indirectly included by that libstub thing we're fscked.

Unless anyone is feeling brave and wants to untangle the x86 command line delta between the stub and core kernel, I suggest we just add these flags just like you proposed (assuming all supported compilers tolerate their presence)

#12 lore raw

Re: fms extension (Was: [PATCH] fs/pipe: stop duplicating union pipe_index declaration)

Quoted 66 lines · Ard Biesheuvel
Quoted 27 lines · Christian Brauner
Quoted 12 lines · Nathan Chancellor
Quoted 3 lines · Christian Brauner

I'm fine either way. @Nathan, if you just want to give Linus the patch if it's small enough or just want to give me a stable branch I can pull I'll be content. Thanks!

I do not care either way but I created a shared branch/tag since it was easy enough to do. If Linus wants to take these directly for -rc4, I am fine with that as well.

Cheers,
Nathan

Quoted 7 lines

The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:

Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git tags/kbuild-ms-extensions-6.19

Thanks, I pulled this and placed it into a branch that I can base other branches on.

_But_, I'm already running into problems. :)

...

Quoted 37 lines

Because struct cgroup_namespace embeddds struct ns_common and it proliferates via mm stuff into the efi code.

So the EFI cod has it's own KBUILD_CFLAGS. It does:

# non-x86 reuses KBUILD_CFLAGS, x86 does not
cflags-y                        := $(KBUILD_CFLAGS)

<snip>

KBUILD_CFLAGS                   := $(subst $(CC_FLAGS_FTRACE),,$(cflags-y)) \
                                   -Os -DDISABLE_BRANCH_PROFILING \
                                   -include $(srctree)/include/linux/hidden.h \
                                   -D__NO_FORTIFY \
                                   -ffreestanding \
                                   -fno-stack-protector \
                                   $(call cc-option,-fno-addrsig) \
                                   -D__DISABLE_EXPORTS

which means x86 doesn't get -fms-extension breaking the build. If I manually insert:

drivers/firmware/efi/libstub/Makefile +2 -0
index 94b05e4451dd..4ad2f8f42134 100644
@@ -42,6 +42,8 @@ KBUILD_CFLAGS                 := $(subst $(CC_FLAGS_FTRACE),,$(cflags-y)) \
                                   -ffreestanding \
                                   -fno-stack-protector \
                                   $(call cc-option,-fno-addrsig) \
+                                  -fms-extensions \
+                                  -Wno-microsoft-anon-tag \
                                   -D__DISABLE_EXPORTS
 

The build works...

Quoted 8 lines
Quoted 3 lines

I think we need to decide how to fix this now because as soon as someone makes use of the extension that is indirectly included by that libstub thing we're fscked.

Unless anyone is feeling brave and wants to untangle the x86 command line delta between the stub and core kernel, I suggest we just add these flags just like you proposed (assuming all supported compilers tolerate their presence)

There are several other places in the kernel that blow away KBUILD_CFLAGS like this that will need the same fix (I went off of searching for -std=gnu11, as that was needed in many places to fix GCC 15). It is possible that we might want to take the opportunity to unify these flags into something like KBUILD_DIALECT_CFLAGS but for now, I just bothered with adding the flags in the existing places.

arch/arm64/kernel/vdso32/Makefile +2 -1
index ffa3536581f6..9d0efed91414 100644
@@ -63,7 +63,7 @@ VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
                $(filter -Werror,$(KBUILD_CPPFLAGS)) \
                -Werror-implicit-function-declaration \
                -Wno-format-security \
-               -std=gnu11
+               -std=gnu11 -fms-extensions
 VDSO_CFLAGS  += -O2
 # Some useful compiler-dependent flags from top-level Makefile
 VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
@@ -71,6 +71,7 @@ VDSO_CFLAGS += -fno-strict-overflow
 VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)
 VDSO_CFLAGS += -Werror=date-time
 VDSO_CFLAGS += $(call cc32-option,-Werror=incompatible-pointer-types)
+VDSO_CFLAGS += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
 
 # Compile as THUMB2 or ARM. Unwinding via frame-pointers in THUMB2 is
 # unreliable.
arch/loongarch/vdso/Makefile +1 -1
index d8316f993482..c0cc3ca5da9f 100644
@@ -19,7 +19,7 @@ ccflags-vdso := \
 cflags-vdso := $(ccflags-vdso) \
 	-isystem $(shell $(CC) -print-file-name=include) \
 	$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
-	-std=gnu11 -O2 -g -fno-strict-aliasing -fno-common -fno-builtin \
+	-std=gnu11 -fms-extensions -O2 -g -fno-strict-aliasing -fno-common -fno-builtin \
 	-fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
 	$(call cc-option, -fno-asynchronous-unwind-tables) \
 	$(call cc-option, -fno-stack-protector)
arch/parisc/boot/compressed/Makefile +1 -1
index 17c42d718eb3..f8481e4e9d21 100644
@@ -18,7 +18,7 @@ KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
 ifndef CONFIG_64BIT
 KBUILD_CFLAGS += -mfast-indirect-calls
 endif
-KBUILD_CFLAGS += -std=gnu11
+KBUILD_CFLAGS += -std=gnu11 -fms-extensions
 
 LDFLAGS_vmlinux := -X -e startup --as-needed -T
 $(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE
arch/powerpc/boot/Makefile +2 -1
index c47b78c1d3e7..f1a4761ebd44 100644
@@ -70,7 +70,7 @@ BOOTCPPFLAGS	:= -nostdinc $(LINUXINCLUDE)
 BOOTCPPFLAGS	+= -isystem $(shell $(BOOTCC) -print-file-name=include)
 
 BOOTCFLAGS	:= $(BOOTTARGETFLAGS) \
-		   -std=gnu11 \
+		   -std=gnu11 -fms-extensions \
 		   -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		   -fno-strict-aliasing -O2 \
 		   -msoft-float -mno-altivec -mno-vsx \
@@ -86,6 +86,7 @@ BOOTARFLAGS	:= -crD
 
 ifdef CONFIG_CC_IS_CLANG
 BOOTCFLAGS += $(CLANG_FLAGS)
+BOOTCFLAGS += -Wno-microsoft-anon-tag
 BOOTAFLAGS += $(CLANG_FLAGS)
 endif
 
arch/s390/Makefile +2 -1
index b4769241332b..8578361133a4 100644
@@ -22,7 +22,7 @@ KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
 ifndef CONFIG_AS_IS_LLVM
 KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
 endif
-KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11
+KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11 -fms-extensions
 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
 KBUILD_CFLAGS_DECOMPRESSOR += -D__DECOMPRESSOR
 KBUILD_CFLAGS_DECOMPRESSOR += -Wno-pointer-sign
@@ -35,6 +35,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-membe
 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-array-bounds)
+KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
 
 UTS_MACHINE	:= s390x
 STACK_SIZE	:= $(if $(CONFIG_KASAN),65536,$(if $(CONFIG_KMSAN),65536,16384))
arch/s390/purgatory/Makefile +2 -1
index bd39b36e7bd6..0c196a5b194a 100644
@@ -13,7 +13,7 @@ CFLAGS_sha256.o := -D__NO_FORTIFY
 $(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE
 	$(call if_changed_rule,as_o_S)
 
-KBUILD_CFLAGS := -std=gnu11 -fno-strict-aliasing -Wall -Wstrict-prototypes
+KBUILD_CFLAGS := -std=gnu11 -fms-extensions -fno-strict-aliasing -Wall -Wstrict-prototypes
 KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
 KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
 KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common
@@ -21,6 +21,7 @@ KBUILD_CFLAGS += -fno-stack-protector
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
 KBUILD_CFLAGS += -D__DISABLE_EXPORTS
 KBUILD_CFLAGS += $(CLANG_FLAGS)
+KBUILD_CFLAGS += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
 KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
 KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
 KBUILD_AFLAGS += -D__DISABLE_EXPORTS
arch/x86/Makefile +3 -1
index 4db7e4bf69f5..e20e25b8b16c 100644
@@ -48,7 +48,8 @@ endif
 
 # How to compile the 16-bit code.  Note we always compile for -march=i386;
 # that way we can complain to the user if the CPU is insufficient.
-REALMODE_CFLAGS	:= -std=gnu11 -m16 -g -Os -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \
+REALMODE_CFLAGS	:= -std=gnu11 -fms-extensions -m16 -g -Os \
+		   -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \
 		   -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \
 		   -fno-strict-aliasing -fomit-frame-pointer -fno-pic \
 		   -mno-mmx -mno-sse $(call cc-option,-fcf-protection=none)
@@ -60,6 +61,7 @@ REALMODE_CFLAGS += $(cc_stack_align4)
 REALMODE_CFLAGS += $(CLANG_FLAGS)
 ifdef CONFIG_CC_IS_CLANG
 REALMODE_CFLAGS += -Wno-gnu
+REALMODE_CFLAGS += -Wno-microsoft-anon-tag
 endif
 export REALMODE_CFLAGS
 
arch/x86/boot/compressed/Makefile +5 -2
index 74657589264d..68f9d7a1683b 100644
@@ -25,7 +25,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
 # avoid errors with '-march=i386', and future flags may depend on the target to
 # be valid.
 KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
-KBUILD_CFLAGS += -std=gnu11
+KBUILD_CFLAGS += -std=gnu11 -fms-extensions
 KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
 KBUILD_CFLAGS += -Wundef
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
@@ -36,7 +36,10 @@ KBUILD_CFLAGS += -mno-mmx -mno-sse
 KBUILD_CFLAGS += -ffreestanding -fshort-wchar
 KBUILD_CFLAGS += -fno-stack-protector
 KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
-KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
+ifdef CONFIG_CC_IS_CLANG
+KBUILD_CFLAGS += -Wno-gnu
+KBUILD_CFLAGS += -Wno-microsoft-anon-tag
+endif
 KBUILD_CFLAGS += -Wno-pointer-sign
 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 KBUILD_CFLAGS += -D__DISABLE_EXPORTS
drivers/firmware/efi/libstub/Makefile +2 -2
index 94b05e4451dd..7d15a85d579f 100644
@@ -11,12 +11,12 @@ cflags-y			:= $(KBUILD_CFLAGS)
 
 cflags-$(CONFIG_X86_32)		:= -march=i386
 cflags-$(CONFIG_X86_64)		:= -mcmodel=small
-cflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ -std=gnu11 \
+cflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ -std=gnu11 -fms-extensions \
 				   -fPIC -fno-strict-aliasing -mno-red-zone \
 				   -mno-mmx -mno-sse -fshort-wchar \
 				   -Wno-pointer-sign \
 				   $(call cc-disable-warning, address-of-packed-member) \
-				   $(call cc-disable-warning, gnu) \
+				   $(if $(CONFIG_CC_IS_CLANG),-Wno-gnu -Wno-microsoft-anon-tag) \
 				   -fno-asynchronous-unwind-tables \
 				   $(CLANG_FLAGS)
 
#13 lore raw

Re: fms extension (Was: [PATCH] fs/pipe: stop duplicating union pipe_index declaration)

Quoted 76 lines · Nathan Chancellor
Quoted 66 lines · Ard Biesheuvel
Quoted 27 lines · Christian Brauner
Quoted 12 lines · Nathan Chancellor
Quoted 3 lines · Christian Brauner

I'm fine either way. @Nathan, if you just want to give Linus the patch if it's small enough or just want to give me a stable branch I can pull I'll be content. Thanks!

I do not care either way but I created a shared branch/tag since it was easy enough to do. If Linus wants to take these directly for -rc4, I am fine with that as well.

Cheers,
Nathan

Quoted 7 lines

The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:

Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git tags/kbuild-ms-extensions-6.19

Thanks, I pulled this and placed it into a branch that I can base other branches on.

_But_, I'm already running into problems. :)

...

Quoted 37 lines

Because struct cgroup_namespace embeddds struct ns_common and it proliferates via mm stuff into the efi code.

So the EFI cod has it's own KBUILD_CFLAGS. It does:

# non-x86 reuses KBUILD_CFLAGS, x86 does not
cflags-y                        := $(KBUILD_CFLAGS)

<snip>

KBUILD_CFLAGS                   := $(subst $(CC_FLAGS_FTRACE),,$(cflags-y)) \
                                   -Os -DDISABLE_BRANCH_PROFILING \
                                   -include $(srctree)/include/linux/hidden.h \
                                   -D__NO_FORTIFY \
                                   -ffreestanding \
                                   -fno-stack-protector \
                                   $(call cc-option,-fno-addrsig) \
                                   -D__DISABLE_EXPORTS

which means x86 doesn't get -fms-extension breaking the build. If I manually insert:

drivers/firmware/efi/libstub/Makefile +2 -0
index 94b05e4451dd..4ad2f8f42134 100644
@@ -42,6 +42,8 @@ KBUILD_CFLAGS                 := $(subst $(CC_FLAGS_FTRACE),,$(cflags-y)) \
                                   -ffreestanding \
                                   -fno-stack-protector \
                                   $(call cc-option,-fno-addrsig) \
+                                  -fms-extensions \
+                                  -Wno-microsoft-anon-tag \
                                   -D__DISABLE_EXPORTS
 

The build works...

Quoted 8 lines
Quoted 3 lines

I think we need to decide how to fix this now because as soon as someone makes use of the extension that is indirectly included by that libstub thing we're fscked.

Unless anyone is feeling brave and wants to untangle the x86 command line delta between the stub and core kernel, I suggest we just add these flags just like you proposed (assuming all supported compilers tolerate their presence)

Quoted 6 lines

There are several other places in the kernel that blow away KBUILD_CFLAGS like this that will need the same fix (I went off of searching for -std=gnu11, as that was needed in many places to fix GCC 15). It is possible that we might want to take the opportunity to unify these flags into something like KBUILD_DIALECT_CFLAGS but for now, I just bothered with adding the flags in the existing places.

That should hopefully do it. Can you update the shared branch with that and then tell me when I can repull?

Quoted 177 lines
arch/arm64/kernel/vdso32/Makefile +2 -1
index ffa3536581f6..9d0efed91414 100644
@@ -63,7 +63,7 @@ VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
                $(filter -Werror,$(KBUILD_CPPFLAGS)) \
                -Werror-implicit-function-declaration \
                -Wno-format-security \
-               -std=gnu11
+               -std=gnu11 -fms-extensions
 VDSO_CFLAGS  += -O2
 # Some useful compiler-dependent flags from top-level Makefile
 VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
@@ -71,6 +71,7 @@ VDSO_CFLAGS += -fno-strict-overflow
 VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)
 VDSO_CFLAGS += -Werror=date-time
 VDSO_CFLAGS += $(call cc32-option,-Werror=incompatible-pointer-types)
+VDSO_CFLAGS += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
 
 # Compile as THUMB2 or ARM. Unwinding via frame-pointers in THUMB2 is
 # unreliable.
arch/loongarch/vdso/Makefile +1 -1
index d8316f993482..c0cc3ca5da9f 100644
@@ -19,7 +19,7 @@ ccflags-vdso := \
 cflags-vdso := $(ccflags-vdso) \
 	-isystem $(shell $(CC) -print-file-name=include) \
 	$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
-	-std=gnu11 -O2 -g -fno-strict-aliasing -fno-common -fno-builtin \
+	-std=gnu11 -fms-extensions -O2 -g -fno-strict-aliasing -fno-common -fno-builtin \
 	-fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
 	$(call cc-option, -fno-asynchronous-unwind-tables) \
 	$(call cc-option, -fno-stack-protector)
arch/parisc/boot/compressed/Makefile +1 -1
index 17c42d718eb3..f8481e4e9d21 100644
@@ -18,7 +18,7 @@ KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
 ifndef CONFIG_64BIT
 KBUILD_CFLAGS += -mfast-indirect-calls
 endif
-KBUILD_CFLAGS += -std=gnu11
+KBUILD_CFLAGS += -std=gnu11 -fms-extensions
 
 LDFLAGS_vmlinux := -X -e startup --as-needed -T
 $(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE
arch/powerpc/boot/Makefile +2 -1
index c47b78c1d3e7..f1a4761ebd44 100644
@@ -70,7 +70,7 @@ BOOTCPPFLAGS	:= -nostdinc $(LINUXINCLUDE)
 BOOTCPPFLAGS	+= -isystem $(shell $(BOOTCC) -print-file-name=include)
 
 BOOTCFLAGS	:= $(BOOTTARGETFLAGS) \
-		   -std=gnu11 \
+		   -std=gnu11 -fms-extensions \
 		   -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		   -fno-strict-aliasing -O2 \
 		   -msoft-float -mno-altivec -mno-vsx \
@@ -86,6 +86,7 @@ BOOTARFLAGS	:= -crD
 
 ifdef CONFIG_CC_IS_CLANG
 BOOTCFLAGS += $(CLANG_FLAGS)
+BOOTCFLAGS += -Wno-microsoft-anon-tag
 BOOTAFLAGS += $(CLANG_FLAGS)
 endif
 
arch/s390/Makefile +2 -1
index b4769241332b..8578361133a4 100644
@@ -22,7 +22,7 @@ KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
 ifndef CONFIG_AS_IS_LLVM
 KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
 endif
-KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11
+KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11 -fms-extensions
 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
 KBUILD_CFLAGS_DECOMPRESSOR += -D__DECOMPRESSOR
 KBUILD_CFLAGS_DECOMPRESSOR += -Wno-pointer-sign
@@ -35,6 +35,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-membe
 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-array-bounds)
+KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
 
 UTS_MACHINE	:= s390x
 STACK_SIZE	:= $(if $(CONFIG_KASAN),65536,$(if $(CONFIG_KMSAN),65536,16384))
arch/s390/purgatory/Makefile +2 -1
index bd39b36e7bd6..0c196a5b194a 100644
@@ -13,7 +13,7 @@ CFLAGS_sha256.o := -D__NO_FORTIFY
 $(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE
 	$(call if_changed_rule,as_o_S)
 
-KBUILD_CFLAGS := -std=gnu11 -fno-strict-aliasing -Wall -Wstrict-prototypes
+KBUILD_CFLAGS := -std=gnu11 -fms-extensions -fno-strict-aliasing -Wall -Wstrict-prototypes
 KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
 KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
 KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common
@@ -21,6 +21,7 @@ KBUILD_CFLAGS += -fno-stack-protector
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
 KBUILD_CFLAGS += -D__DISABLE_EXPORTS
 KBUILD_CFLAGS += $(CLANG_FLAGS)
+KBUILD_CFLAGS += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
 KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
 KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
 KBUILD_AFLAGS += -D__DISABLE_EXPORTS
arch/x86/Makefile +3 -1
index 4db7e4bf69f5..e20e25b8b16c 100644
@@ -48,7 +48,8 @@ endif
 
 # How to compile the 16-bit code.  Note we always compile for -march=i386;
 # that way we can complain to the user if the CPU is insufficient.
-REALMODE_CFLAGS	:= -std=gnu11 -m16 -g -Os -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \
+REALMODE_CFLAGS	:= -std=gnu11 -fms-extensions -m16 -g -Os \
+		   -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \
 		   -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \
 		   -fno-strict-aliasing -fomit-frame-pointer -fno-pic \
 		   -mno-mmx -mno-sse $(call cc-option,-fcf-protection=none)
@@ -60,6 +61,7 @@ REALMODE_CFLAGS += $(cc_stack_align4)
 REALMODE_CFLAGS += $(CLANG_FLAGS)
 ifdef CONFIG_CC_IS_CLANG
 REALMODE_CFLAGS += -Wno-gnu
+REALMODE_CFLAGS += -Wno-microsoft-anon-tag
 endif
 export REALMODE_CFLAGS
 
arch/x86/boot/compressed/Makefile +5 -2
index 74657589264d..68f9d7a1683b 100644
@@ -25,7 +25,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
 # avoid errors with '-march=i386', and future flags may depend on the target to
 # be valid.
 KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
-KBUILD_CFLAGS += -std=gnu11
+KBUILD_CFLAGS += -std=gnu11 -fms-extensions
 KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
 KBUILD_CFLAGS += -Wundef
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
@@ -36,7 +36,10 @@ KBUILD_CFLAGS += -mno-mmx -mno-sse
 KBUILD_CFLAGS += -ffreestanding -fshort-wchar
 KBUILD_CFLAGS += -fno-stack-protector
 KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
-KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
+ifdef CONFIG_CC_IS_CLANG
+KBUILD_CFLAGS += -Wno-gnu
+KBUILD_CFLAGS += -Wno-microsoft-anon-tag
+endif
 KBUILD_CFLAGS += -Wno-pointer-sign
 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 KBUILD_CFLAGS += -D__DISABLE_EXPORTS
drivers/firmware/efi/libstub/Makefile +2 -2
index 94b05e4451dd..7d15a85d579f 100644
@@ -11,12 +11,12 @@ cflags-y			:= $(KBUILD_CFLAGS)
 
 cflags-$(CONFIG_X86_32)		:= -march=i386
 cflags-$(CONFIG_X86_64)		:= -mcmodel=small
-cflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ -std=gnu11 \
+cflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ -std=gnu11 -fms-extensions \
 				   -fPIC -fno-strict-aliasing -mno-red-zone \
 				   -mno-mmx -mno-sse -fshort-wchar \
 				   -Wno-pointer-sign \
 				   $(call cc-disable-warning, address-of-packed-member) \
-				   $(call cc-disable-warning, gnu) \
+				   $(if $(CONFIG_CC_IS_CLANG),-Wno-gnu -Wno-microsoft-anon-tag) \
 				   -fno-asynchronous-unwind-tables \
 				   $(CLANG_FLAGS)
 
#14 lore raw

Re: fms extension (Was: [PATCH] fs/pipe: stop duplicating union pipe_index declaration)

Quoted 10 lines · Christian Brauner
Quoted 6 lines · Nathan Chancellor

There are several other places in the kernel that blow away KBUILD_CFLAGS like this that will need the same fix (I went off of searching for -std=gnu11, as that was needed in many places to fix GCC 15). It is possible that we might want to take the opportunity to unify these flags into something like KBUILD_DIALECT_CFLAGS but for now, I just bothered with adding the flags in the existing places.

That should hopefully do it. Can you update the shared branch with that and then tell me when I can repull?

I have applied this as commit e066b73bd881 ("kbuild: Add '-fms-extensions' to areas with dedicated CFLAGS") in the kbuild-ms-extensions branch. I may solicit acks from architecture maintainers but I would like to make sure there are no other surprises before then.

Quoted 176 lines
Quoted 176 lines
arch/arm64/kernel/vdso32/Makefile +2 -1
index ffa3536581f6..9d0efed91414 100644
@@ -63,7 +63,7 @@ VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
                $(filter -Werror,$(KBUILD_CPPFLAGS)) \
                -Werror-implicit-function-declaration \
                -Wno-format-security \
-               -std=gnu11
+               -std=gnu11 -fms-extensions
 VDSO_CFLAGS  += -O2
 # Some useful compiler-dependent flags from top-level Makefile
 VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
@@ -71,6 +71,7 @@ VDSO_CFLAGS += -fno-strict-overflow
 VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)
 VDSO_CFLAGS += -Werror=date-time
 VDSO_CFLAGS += $(call cc32-option,-Werror=incompatible-pointer-types)
+VDSO_CFLAGS += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
 
 # Compile as THUMB2 or ARM. Unwinding via frame-pointers in THUMB2 is
 # unreliable.
arch/loongarch/vdso/Makefile +1 -1
index d8316f993482..c0cc3ca5da9f 100644
@@ -19,7 +19,7 @@ ccflags-vdso := \
 cflags-vdso := $(ccflags-vdso) \
 	-isystem $(shell $(CC) -print-file-name=include) \
 	$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
-	-std=gnu11 -O2 -g -fno-strict-aliasing -fno-common -fno-builtin \
+	-std=gnu11 -fms-extensions -O2 -g -fno-strict-aliasing -fno-common -fno-builtin \
 	-fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
 	$(call cc-option, -fno-asynchronous-unwind-tables) \
 	$(call cc-option, -fno-stack-protector)
arch/parisc/boot/compressed/Makefile +1 -1
index 17c42d718eb3..f8481e4e9d21 100644
@@ -18,7 +18,7 @@ KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
 ifndef CONFIG_64BIT
 KBUILD_CFLAGS += -mfast-indirect-calls
 endif
-KBUILD_CFLAGS += -std=gnu11
+KBUILD_CFLAGS += -std=gnu11 -fms-extensions
 
 LDFLAGS_vmlinux := -X -e startup --as-needed -T
 $(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE
arch/powerpc/boot/Makefile +2 -1
index c47b78c1d3e7..f1a4761ebd44 100644
@@ -70,7 +70,7 @@ BOOTCPPFLAGS	:= -nostdinc $(LINUXINCLUDE)
 BOOTCPPFLAGS	+= -isystem $(shell $(BOOTCC) -print-file-name=include)
 
 BOOTCFLAGS	:= $(BOOTTARGETFLAGS) \
-		   -std=gnu11 \
+		   -std=gnu11 -fms-extensions \
 		   -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		   -fno-strict-aliasing -O2 \
 		   -msoft-float -mno-altivec -mno-vsx \
@@ -86,6 +86,7 @@ BOOTARFLAGS	:= -crD
 
 ifdef CONFIG_CC_IS_CLANG
 BOOTCFLAGS += $(CLANG_FLAGS)
+BOOTCFLAGS += -Wno-microsoft-anon-tag
 BOOTAFLAGS += $(CLANG_FLAGS)
 endif
 
arch/s390/Makefile +2 -1
index b4769241332b..8578361133a4 100644
@@ -22,7 +22,7 @@ KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
 ifndef CONFIG_AS_IS_LLVM
 KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
 endif
-KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11
+KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11 -fms-extensions
 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
 KBUILD_CFLAGS_DECOMPRESSOR += -D__DECOMPRESSOR
 KBUILD_CFLAGS_DECOMPRESSOR += -Wno-pointer-sign
@@ -35,6 +35,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-membe
 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-array-bounds)
+KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
 
 UTS_MACHINE	:= s390x
 STACK_SIZE	:= $(if $(CONFIG_KASAN),65536,$(if $(CONFIG_KMSAN),65536,16384))
arch/s390/purgatory/Makefile +2 -1
index bd39b36e7bd6..0c196a5b194a 100644
@@ -13,7 +13,7 @@ CFLAGS_sha256.o := -D__NO_FORTIFY
 $(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE
 	$(call if_changed_rule,as_o_S)
 
-KBUILD_CFLAGS := -std=gnu11 -fno-strict-aliasing -Wall -Wstrict-prototypes
+KBUILD_CFLAGS := -std=gnu11 -fms-extensions -fno-strict-aliasing -Wall -Wstrict-prototypes
 KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
 KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
 KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common
@@ -21,6 +21,7 @@ KBUILD_CFLAGS += -fno-stack-protector
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
 KBUILD_CFLAGS += -D__DISABLE_EXPORTS
 KBUILD_CFLAGS += $(CLANG_FLAGS)
+KBUILD_CFLAGS += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
 KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
 KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
 KBUILD_AFLAGS += -D__DISABLE_EXPORTS
arch/x86/Makefile +3 -1
index 4db7e4bf69f5..e20e25b8b16c 100644
@@ -48,7 +48,8 @@ endif
 
 # How to compile the 16-bit code.  Note we always compile for -march=i386;
 # that way we can complain to the user if the CPU is insufficient.
-REALMODE_CFLAGS	:= -std=gnu11 -m16 -g -Os -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \
+REALMODE_CFLAGS	:= -std=gnu11 -fms-extensions -m16 -g -Os \
+		   -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \
 		   -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \
 		   -fno-strict-aliasing -fomit-frame-pointer -fno-pic \
 		   -mno-mmx -mno-sse $(call cc-option,-fcf-protection=none)
@@ -60,6 +61,7 @@ REALMODE_CFLAGS += $(cc_stack_align4)
 REALMODE_CFLAGS += $(CLANG_FLAGS)
 ifdef CONFIG_CC_IS_CLANG
 REALMODE_CFLAGS += -Wno-gnu
+REALMODE_CFLAGS += -Wno-microsoft-anon-tag
 endif
 export REALMODE_CFLAGS
 
arch/x86/boot/compressed/Makefile +5 -2
index 74657589264d..68f9d7a1683b 100644
@@ -25,7 +25,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
 # avoid errors with '-march=i386', and future flags may depend on the target to
 # be valid.
 KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
-KBUILD_CFLAGS += -std=gnu11
+KBUILD_CFLAGS += -std=gnu11 -fms-extensions
 KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
 KBUILD_CFLAGS += -Wundef
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
@@ -36,7 +36,10 @@ KBUILD_CFLAGS += -mno-mmx -mno-sse
 KBUILD_CFLAGS += -ffreestanding -fshort-wchar
 KBUILD_CFLAGS += -fno-stack-protector
 KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
-KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
+ifdef CONFIG_CC_IS_CLANG
+KBUILD_CFLAGS += -Wno-gnu
+KBUILD_CFLAGS += -Wno-microsoft-anon-tag
+endif
 KBUILD_CFLAGS += -Wno-pointer-sign
 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 KBUILD_CFLAGS += -D__DISABLE_EXPORTS
drivers/firmware/efi/libstub/Makefile +2 -2
index 94b05e4451dd..7d15a85d579f 100644
@@ -11,12 +11,12 @@ cflags-y			:= $(KBUILD_CFLAGS)
 
 cflags-$(CONFIG_X86_32)		:= -march=i386
 cflags-$(CONFIG_X86_64)		:= -mcmodel=small
-cflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ -std=gnu11 \
+cflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ -std=gnu11 -fms-extensions \
 				   -fPIC -fno-strict-aliasing -mno-red-zone \
 				   -mno-mmx -mno-sse -fshort-wchar \
 				   -Wno-pointer-sign \
 				   $(call cc-disable-warning, address-of-packed-member) \
-				   $(call cc-disable-warning, gnu) \
+				   $(if $(CONFIG_CC_IS_CLANG),-Wno-gnu -Wno-microsoft-anon-tag) \
 				   -fno-asynchronous-unwind-tables \
 				   $(CLANG_FLAGS)
 
#15 lore raw

Re: fms extension (Was: [PATCH] fs/pipe: stop duplicating union pipe_index declaration)

Quoted 9 lines · Nathan Chancellor
Quoted 8 lines · Christian Brauner
Quoted 6 lines · Nathan Chancellor

There are several other places in the kernel that blow away KBUILD_CFLAGS like this that will need the same fix (I went off of searching for -std=gnu11, as that was needed in many places to fix GCC 15). It is possible that we might want to take the opportunity to unify these flags into something like KBUILD_DIALECT_CFLAGS but for now, I just bothered with adding the flags in the existing places.

Quoted 8 lines
Quoted 2 lines

That should hopefully do it. Can you update the shared branch with that and then tell me when I can repull?

I have applied this as commit e066b73bd881 ("kbuild: Add '-fms-extensions' to areas with dedicated CFLAGS") in the kbuild-ms-extensions branch. I may solicit acks from architecture maintainers but I would like to make sure there are no other surprises before then.

I'd like a stable branch before -rc5, please.

#17 lore raw

Re: fms extension (Was: [PATCH] fs/pipe: stop duplicating union pipe_index declaration)

Quoted 9 lines · Nathan Chancellor
Quoted 1 line · Christian Brauner

I'd like a stable branch before -rc5, please.

Sure thing. I have sent the change out for Acks now:

https://lore.kernel.org/20251101-kbuild-ms-extensions-dedicated-cflags-v1-1-38004aba524b@kernel.org/

I will finalize the branch by Thursday at the latest and ping you when it is ready.

Hey Nathan!

Any status update on this?

#18 lore raw

Re: fms extension (Was: [PATCH] fs/pipe: stop duplicating union pipe_index declaration)

Hey Christian,

Quoted 4 lines · Christian Brauner
Quoted 3 lines · Nathan Chancellor
Quoted 1 line · Christian Brauner

I'd like a stable branch before -rc5, please.

Quoted 8 lines
Quoted 6 lines

Sure thing. I have sent the change out for Acks now:

https://lore.kernel.org/20251101-kbuild-ms-extensions-dedicated-cflags-v1-1-38004aba524b@kernel.org/

I will finalize the branch by Thursday at the latest and ping you when it is ready.

Any status update on this?

Did https://lore.kernel.org/20251106174752.GA2440428@ax162/ not make it into your inbox?

Cheers,
Nathan