lkml.org 
[lkml]   [2003]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] gcc -Wpadded
From
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.022 / U:0.740 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site