Re: [PATCH 1/4] linux/export: Fix alignment for 64-bit ksymtab entries
From: Masahiro Yamada
Date: Fri Dec 22 2023 - 02:02:12 EST
On Fri, Dec 22, 2023 at 3:08 PM Luis Chamberlain <mcgrof@xxxxxxxxxx> wrote:
>
> On Thu, Dec 21, 2023 at 10:07:13PM -0800, Luis Chamberlain wrote:
> >
> > If we want to go bananas we could even get a graph of size of modules
>
> Sorry I meant size of number of symbols Vs cost.
>
> Luis
But, 1/4 is really a bug-fix, isn't it?
ksymtab was previously 8-byte aligned for CONFIG_64BIT,
but now is only 4-byte aligned.
$ git show ddb5cdbafaaa^:include/linux/export.h |
head -n66 | tail -n5
struct kernel_symbol {
unsigned long value;
const char *name;
const char *namespace;
};
$ git show ddb5cdbafaaa^:include/asm-generic/export.h |
head -23 | tail -8
#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
#define KSYM_ALIGN 4
#elif defined(CONFIG_64BIT)
#define KSYM_ALIGN 8
#else
#define KSYM_ALIGN 4
#endif
In the old behavior, <linux/export.h> used C code
for producing ksymtab, hence it was naturally
aligned by the compiler. (unsigned long and pointer
require 8-byte alignment for CONFIG_64BIT)
<asm-generic/export.h> explicitly required
8-byte alignment for CONFIG_64BIT.
In the current behavior, <linux/export-internal.h>
produces all ksymtab by using inline assembler,
but it hard-codes ".balign 4".
--
Best Regards
Masahiro Yamada