]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix over-alignment problem on x86-64
authorAndi Kleen <ak@colin.muc.de>
Sun, 15 Jun 2003 12:21:41 +0000 (05:21 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 15 Jun 2003 12:21:41 +0000 (05:21 -0700)
Thanks to Jan Hubicka who suggested this fix.

The problem seems to be that gcc generates a 32byte alignment for static
objects > 32bytes.  This causes gas to set a high alignment on the
section, which causes the uneven (not multiple of sizeof(struct
kernel_param)) section size.  The pointer division with a base not being
a multiple of sizeof(*ptr) then causes the invalid result.

This just forces a small alignment, which makes the section end come out
with the correct alignment.

The only mystery left is why ld chose a 16 byte padding instead of
32byte.

include/linux/moduleparam.h

index e5255326364090d3335fda94ea7033f0b2cdd4de..62127f6f4ad9285c858b3107fe1ef278ecb71476 100644 (file)
@@ -40,7 +40,7 @@ struct kparam_string {
 #define __module_param_call(prefix, name, set, get, arg, perm)         \
        static char __param_str_##name[] __initdata = prefix #name;     \
        static struct kernel_param const __param_##name                 \
-                __attribute__ ((unused,__section__ ("__param")))       \
+    __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
        = { __param_str_##name, perm, set, get, arg }
 
 #define module_param_call(name, set, get, arg, perm)                         \