RE: [PATCH 0/4] Section alignment issues?

From: David Laight
Date: Fri Dec 22 2023 - 04:49:27 EST


...
> diff --git a/include/linux/init.h b/include/linux/init.h
> index 3fa3f6241350..650311e4b215 100644
> --- a/include/linux/init.h
> +++ b/include/linux/init.h
> @@ -264,6 +264,7 @@ extern struct module __this_module;
> #define ____define_initcall(fn, __stub, __name, __sec) \
> __define_initcall_stub(__stub, fn) \
> asm(".section \"" __sec "\", \"a\" \n" \
> + ".balign 4 \n" \
> __stringify(__name) ": \n" \
> ".long " __stringify(__stub) " - . \n" \
> ".previous \n"); \
>
>
>
> Then, "this section requires at least 4 byte alignment"
> is recorded in the sh_addralign field.

Perhaps one of the headers should contain (something like):
#ifdef CONFIG_64
#define BALIGN_PTR ".balign 8\n"
#else
#define BALIGN_PTR ".balign 4\n"
#endif

to make it all easier (although that example doesn't need it).

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)