Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Subject | [PATCH] gcc -Wpadded | From | Albert Cahalan <> | Date | 12 Jul 2003 18:57:20 -0400 |
| |
Explicit padding is better than compiler-generated padding, because awareness of the issue reduces waste. There's also a security issue, with info leaking whenever padded structs get copied to the user.
This patch adds -Wpadded for i386, mips, and s390.
diff -Naurd old/arch/i386/Makefile new/arch/i386/Makefile --- old/arch/i386/Makefile 2003-07-12 18:36:52.000000000 -0400 +++ new/arch/i386/Makefile 2003-07-12 18:47:01.000000000 -0400 @@ -27,6 +27,8 @@ # prevent gcc from keeping the stack 16 byte aligned CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,) +CFLAGS += $(call check_gcc,-Wpadded,) + align := $(subst -functions=0,,$(call check_gcc,-falign-functions=0,-malign-functions=0)) cflags-$(CONFIG_M386) += -march=i386 diff -Naurd old/arch/mips/Makefile new/arch/mips/Makefile --- old/arch/mips/Makefile 2003-07-12 18:42:12.000000000 -0400 +++ new/arch/mips/Makefile 2003-07-12 18:46:21.000000000 -0400 @@ -78,6 +78,7 @@ AFLAGS += $(cflags-y) CFLAGS += $(cflags-y) +CFLAGS += $(call check_gcc,-Wpadded,) # diff -Naurd old/arch/s390/Makefile new/arch/s390/Makefile --- old/arch/s390/Makefile 2003-07-12 18:41:49.000000000 -0400 +++ new/arch/s390/Makefile 2003-07-12 18:44:41.000000000 -0400 @@ -38,6 +38,7 @@ CFLAGS += $(cflags-y) CFLAGS += $(call check_gcc,-finline-limit=10000,) +CFLAGS += $(call check_gcc,-Wpadded,) CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare OBJCOPYFLAGS := -O binary
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |