Re: [PATCH] linux/export.h: remove unneeded .balign directive

From: Masahiro Yamada
Date: Sun Jan 07 2024 - 06:35:00 EST


On Fri, Jan 5, 2024 at 5:21 PM Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
>
> On Thu, Jan 4, 2024 at 3:17 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> >
> > On Thu, Jan 4, 2024 at 1:05 AM Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
> > >
> > > Happy new 2024 Masahiro,
> > >
> > > some small nits.
> > >
> > > What about adding links to the commits...
> > >
> > > linux/export: Fix alignment for 64-bit ksymtab entries
> > > [ Upstream commit f6847807c22f6944c71c981b630b9fff30801e73 ]
> > >
> > > linux/export: Ensure natural alignment of kcrctab array
> > > [ Upstream commit 753547de0daecbdbd1af3618987ddade325d9aaa ]
> > >
> > > ^^ AFAICS in linux-stable - v6.6.10-rc1 includes both
> > > ^^ Is yours a follow-up and makes sense for linux-stable releases?
> >
> >
> > No.
> >
> > This patch is a separate clean-up, not a bug fix.
> >
> > No need for back-porting.
> >
>
> Thanks for the clarification.
>
> But it is an improvement - so no discarding at link-time means
> reduction of build-time?
> Amy numbers?


The .export_symbol is already discarded.

The alignment of discarded code is "don't care".
So, this is a code clean-up.

I do not think there is a noticeable difference
in the build speed.




See line 1005 of include/asm-generic/vmlinux.h.lds


#define COMMON_DISCARDS \
SANITIZER_DISCARDS \
PATCHABLE_DISCARDS \
*(.discard) \
*(.discard.*) \
*(.export_symbol) \
*(.modinfo) \
/* ld.bfd warns about .gnu.version* even when not emitted */ \
*(.gnu.version*)










> >
> >
> >
> > >
> > > ...and CC Helge Deller?
> >
>
> CC in the patch - makes for me only sense if you agree on adding above
> commit-ids of Helge's work.
> I think this is good in sense of follow-able references.
>
> Best regards,
> -Sedat-
>
> >
> > You did it.
> >
> >
> > Thanks.
> >
> >
> >
> >
> >
> > > Best regards,
> > > -Sedat-
> > >
> > > Link: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/log/?h=linux-6.6.y
> > >
> > > On Wed, Jan 3, 2024 at 2:55 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> > > >
> > > > The .export_symbol section is discarded by the linker script, hence
> > > > no alignment is needed. Simplify the code.
> > > >
> > > > Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> > > > ---
> > > >
> > > > include/linux/export.h | 10 +++-------
> > > > 1 file changed, 3 insertions(+), 7 deletions(-)
> > > >
> > > > diff --git a/include/linux/export.h b/include/linux/export.h
> > > > index 0bbd02fd351d..dff230bb5aca 100644
> > > > --- a/include/linux/export.h
> > > > +++ b/include/linux/export.h
> > > > @@ -15,13 +15,9 @@
> > > > */
> > > >
> > > > #ifdef CONFIG_64BIT
> > > > -#define __EXPORT_SYMBOL_REF(sym) \
> > > > - .balign 8 ASM_NL \
> > > > - .quad sym
> > > > +#define __EXPORT_SYMBOL_PTR .quad
> > > > #else
> > > > -#define __EXPORT_SYMBOL_REF(sym) \
> > > > - .balign 4 ASM_NL \
> > > > - .long sym
> > > > +#define __EXPORT_SYMBOL_PTR .long
> > > > #endif
> > > >
> > > > #define ___EXPORT_SYMBOL(sym, license, ns) \
> > > > @@ -29,7 +25,7 @@
> > > > __export_symbol_##sym: ASM_NL \
> > > > .asciz license ASM_NL \
> > > > .asciz ns ASM_NL \
> > > > - __EXPORT_SYMBOL_REF(sym) ASM_NL \
> > > > + __EXPORT_SYMBOL_PTR sym ASM_NL \
> > > > .previous
> > > >
> > > > #if defined(__DISABLE_EXPORTS)
> > > > --
> > > > 2.40.1
> > > >
> > > >
> > >
> >
> >
> > --
> > Best Regards
> > Masahiro Yamada



--
Best Regards
Masahiro Yamada