From: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
To: Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Cc: "Bjørn Mork" <bjorn-yOkvZcmFvRU@public.gmane.org>,
"USB list" <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Linux-Next <linux-next-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-kbuild
<linux-kbuild-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Linux/m68k <linux-m68k-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [-next] FATAL: drivers/gpu/drm/udl/udl: sizeof(struct usb_device_id)=24 is not a modulo of the size of section __mod_usb_device_table=44.
Date: Fri, 15 Jun 2012 23:02:55 +0200 [thread overview]
Message-ID: <CAMuHMdUj6tAcWhkSkV43Kw3-2-3+JzgP6W=2w3fjL2KBfRh9ZQ@mail.gmail.com> (raw)
In-Reply-To: <20120615201021.GB14544-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
Hi Greg,
On Fri, Jun 15, 2012 at 10:10 PM, Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
> On Fri, Jun 15, 2012 at 07:42:08PM +0200, Geert Uytterhoeven wrote:
>> commit 81df2d594340dcb6d1a02191976be88a1ca8120c ("USB: allow match
>> on bInterfaceNumber") added a byte to the interior of struct usb_device_id,
>> enabling implicit padding:
>>
>> --- a/include/linux/mod_devicetable.h
>> +++ b/include/linux/mod_devicetable.h
>> @@ -115,6 +118,9 @@ struct usb_device_id {
>> __u8 bInterfaceSubClass;
>> __u8 bInterfaceProtocol;
>>
>> + /* Used for vendor-specific interface matches */
>> + __u8 bInterfaceNumber;
>> +
>> /* not matched against */
>> kernel_ulong_t driver_info;
>> };
>>
>> On m68k, this causes failures like:
>>
>> | FATAL: drivers/gpu/drm/udl/udl: sizeof(struct usb_device_id)=24 is
>> not a modulo of the size of section __mod_usb_device_table=44.
>> | Fix definition of struct usb_device_id in mod_devicetable.h
>>
>> M68k is special in that it uses 2 for the alignment of 32-bit entities, hence
>> sizeof(struct usb_device_id) = 22.
>>
>> However, when cross-compiling on amd64, sizeof(struct usb_device_id) = 24
>> in scripts/mod/file2alias.c.
>
> I don't really understand, what is the problem here? The fact that we
> added one byte to the structure? And now something breaks? How?
>
> What can we do to resolve it?
As "kernel_ulong_t driver_info" is no longer naturally aligned, the
compiler will
add implicit padding. But the padding depends on the architecture.
It can be fixed by adding explicit padding. Probably it should be padded by
7 bytes (not 3), as kernel_ulong_t may require 8-byte alignment on some 64-bit
platforms. Or by an explicit alignment attribute.
See also
* commit 8175fe2dda1c93a9c596921c8ed4a0b4baccdefe ("HID: fix
hid_device_id for cross compiling")
* commit 7492d4a416d68ab4bd254b36ffcc4e0138daa8ff ("sdio: fix module
device table definition for m68k")
* commit 9e2d3cd34a159948dc753a14573e16bffc04dba8 ("[PATCH]
mod_devicetable.h fixes")
Still, there's a bug in file2alias (which is compiled by the host
compiler), in that
it may use different padding than the target platform when cross-compiling.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-06-15 21:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-15 17:42 [-next] FATAL: drivers/gpu/drm/udl/udl: sizeof(struct usb_device_id)=24 is not a modulo of the size of section __mod_usb_device_table=44 Geert Uytterhoeven
2012-06-15 20:10 ` Greg Kroah-Hartman
[not found] ` <20120615201021.GB14544-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-06-15 21:02 ` Geert Uytterhoeven [this message]
2012-06-15 23:12 ` Greg Kroah-Hartman
2012-06-16 13:23 ` Bjørn Mork
2012-06-16 15:43 ` Andreas Schwab
2012-06-17 14:00 ` Bjørn Mork
2012-06-17 15:42 ` Andreas Schwab
2012-06-25 12:22 ` [PATCH] mod/file2alias: make modalias generation safe for cross compiling Andreas Schwab
[not found] ` <m2d34n1sz9.fsf_-_-hBGjKatGTSWzQB+pC5nmwQ@public.gmane.org>
2012-06-25 20:32 ` Geert Uytterhoeven
[not found] ` <alpine.DEB.2.00.1206252217580.21346-97SZ98TBZzA1xEWliksxXw@public.gmane.org>
2012-06-25 21:43 ` Andreas Schwab
2012-06-26 5:00 ` Sam Ravnborg
2012-06-26 13:27 ` [PATCH v2] " Andreas Schwab
2012-06-16 18:33 ` [-next] FATAL: drivers/gpu/drm/udl/udl: sizeof(struct usb_device_id)=24 is not a modulo of the size of section __mod_usb_device_table=44 Philippe De Muyter
2012-06-16 19:11 ` Greg Kroah-Hartman
2012-06-16 19:30 ` Geert Uytterhoeven
2012-06-16 18:51 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMuHMdUj6tAcWhkSkV43Kw3-2-3+JzgP6W=2w3fjL2KBfRh9ZQ@mail.gmail.com' \
--to=geert-td1emuhucqxl1znqvxdv9g@public.gmane.org \
--cc=bjorn-yOkvZcmFvRU@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=linux-kbuild-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-m68k-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-next-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).