Skip to contentSkip to conversation

gcc -Wpadded

PATCH New Albert Cahalan 1 participant 1 message Jul 12, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc -Wpadded

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.

arch/i386/Makefile +2 -0
diff -Naurd old/arch/i386/Makefile new/arch/i386/Makefile
@@ -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

arch/mips/Makefile +1 -0
diff -Naurd old/arch/mips/Makefile new/arch/mips/Makefile
@@ -78,6 +78,7 @@
 
 AFLAGS		+= $(cflags-y)
 CFLAGS		+= $(cflags-y)
+CFLAGS		+= $(call check_gcc,-Wpadded,)
 
 
 #
arch/s390/Makefile +1 -0
diff -Naurd old/arch/s390/Makefile new/arch/s390/Makefile
@@ -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