[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190813124134.GB14284@kroah.com>
Date: Tue, 13 Aug 2019 14:41:34 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Matthias Maennich <maennich@...gle.com>
Cc: linux-kernel@...r.kernel.org, maco@...roid.com,
kernel-team@...roid.com, arnd@...db.de, geert@...ux-m68k.org,
hpa@...or.com, jeyu@...nel.org, joel@...lfernandes.org,
kstewart@...uxfoundation.org, linux-arch@...r.kernel.org,
linux-kbuild@...r.kernel.org, linux-m68k@...ts.linux-m68k.org,
linux-modules@...r.kernel.org, linux-scsi@...r.kernel.org,
linux-usb@...r.kernel.org, lucas.de.marchi@...il.com,
maco@...gle.com, michal.lkml@...kovi.net, mingo@...hat.com,
oneukum@...e.com, pombredanne@...b.com, sam@...nborg.org,
sboyd@...eaurora.org, sspatil@...gle.com,
stern@...land.harvard.edu, tglx@...utronix.de,
usb-storage@...ts.one-eyed-alien.net, x86@...nel.org,
yamada.masahiro@...ionext.com,
Andrew Morton <akpm@...ux-foundation.org>,
Nicolas Pitre <nico@...xnic.net>,
Michael Ellerman <mpe@...erman.id.au>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>
Subject: Re: [PATCH v2 02/10] export: explicitly align struct kernel_symbol
On Tue, Aug 13, 2019 at 01:16:59PM +0100, Matthias Maennich wrote:
> This change allows growing struct kernel_symbol without wasting bytes to
> alignment. It also concretized the alignment of ksymtab entries if
> relative references are used for ksymtab entries.
>
> struct kernel_symbol was already implicitly being aligned to the word
> size, except on x86_64 and m68k, where it is aligned to 16 and 2 bytes,
> respectively.
>
> As far as I can tell there is no requirement for aligning struct
> kernel_symbol to 16 bytes on x86_64, but gcc aligns structs to their
> size, and the linker aligns the custom __ksymtab sections to the largest
> data type contained within, so setting KSYM_ALIGN to 16 was necessary to
> stay consistent with the code generated for non-ASM EXPORT_SYMBOL(). Now
> that non-ASM EXPORT_SYMBOL() explicitly aligns to word size (8),
> KSYM_ALIGN is no longer necessary.
>
> In case of relative references, the alignment has been changed
> accordingly to not waste space when adding new struct members.
>
> As for m68k, struct kernel_symbol is aligned to 2 bytes even though the
> structure itself is 8 bytes; using a 4-byte alignment shouldn't hurt.
>
> I manually verified the output of the __ksymtab sections didn't change
> on x86, x86_64, arm, arm64 and m68k. As expected, the section contents
> didn't change, and the ELF section alignment only changed on x86_64 and
> m68k. Feedback from other archs more than welcome.
>
> Co-developed-by: Martijn Coenen <maco@...roid.com>
> Signed-off-by: Martijn Coenen <maco@...roid.com>
> Signed-off-by: Matthias Maennich <maennich@...gle.com>
Ick, messy, nice fix.
Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Powered by blists - more mailing lists