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

Re: Modutils patch needs some more work?



On Saturday 04 October 2003 13:26, Tony Hoyle wrote:
> The 32bit modutils still can't depmod on a 64bit kernel because of a
> structure size mismatch due to pointer differences:
>
> Sat Oct  4 12:08:06 2003: depmod: Unexpected value (32) in
> '/lib/modules/2.4.23-pre6-amd64/kernel/drivers/ieee1394/video1394.o' for
> ieee139
> 4_device_size
> Sat Oct  4 12:08:06 2003:       It is likely that the kernel structure
> has changed, if so then
> Sat Oct  4 12:08:06 2003:       you probably need a new version of
> modutils to handle this kernel.
> Sat Oct  4 12:08:06 2003:       Check linux/Documentation/Changes.
>
> This is because of the following in
> <source>/drivers/ieee1394/ieee1394_hotplug.h
>
> struct ieee1394_device_id {
>          u32 match_flags;
>          u32 vendor_id;
>          u32 model_id;
>          u32 specifier_id;
>          u32 version;
>          void *driver_data;
> };
>
> The size of the void* changes between 32 and 64bit, so this changes the
> value of the structure to be different to what modutils expects.

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)))));
 };
 
 /*



Reply to: