[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Modutils patch needs some more work?



On Sat, 4 Oct 2003 15:07:23 +0200, 
Arnd Bergmann <arnd@arndb.de> wrote:
>Actually, the problem is a little more tricky. The modutils already handle
>pointers in device_id fields correctly for anything except ieee1394.
>The problem here is padding: on ia32, uint64_t variables are 4 byte aligned,
>while they are 8 byte aligned on amd64 and the compiler there inserts
>an empty word between version and driver_data.
>
>Can you check if this patch fixes the problem without breaking for
>32 bit kernels?
>
>	Arnd <><
>
>--- ./depmod/depmod.c	2003-10-04 14:59:11.000000000 +0200
>+++ ./depmod/depmod.c.orig	2003-10-04 14:58:37.000000000 +0200
>@@ -198,7 +198,7 @@
> 	__u32 model_id;
> 	__u32 specifier_id;
> 	__u32 version;
>-	ElfW(Addr) driver_data;
>+	ElfW(Addr) driver_data __attribute__((aligned(sizeof(ElfW(Addr)))));
> };
> 
> /*

info gcc says "The `aligned' attribute can only increase the alignment;
but you can decrease it by specifying `packed' as well".  Try

	ElfW(Addr) driver_data __attribute__ ((packed));

The kernel structure will require a corresponding __attribute__ ((packed));



Reply to: