Hi Ard, On Wed, Mar 19, 2025 at 8:38 AM Ard Biesheuvel <ardb@xxxxxxxxxx> wrote: > > The issue here is that we deliberately hide __ref_stack_chk_guard from > the compiler, because Clang will otherwise generate incorrect code. > [0] > > I managed to work around this issue using the hack below, but I'm not > too familiar with the gendwarfksyms code, so I'll leave it up to Sami > and Masahiro to decide whether this is the right approach before > sending out a patch. > > > --- a/arch/x86/include/asm/asm-prototypes.h > +++ b/arch/x86/include/asm/asm-prototypes.h > @@ -20,6 +20,7 @@ > extern void cmpxchg8b_emu(void); > #endif > > -#if defined(__GENKSYMS__) && defined(CONFIG_STACKPROTECTOR) > +#if (defined(__GENKSYMS__) || defined(__GENDWARFKSYMS__)) \ > + && defined(CONFIG_STACKPROTECTOR) > extern unsigned long __ref_stack_chk_guard; > #endif > > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -311,7 +311,8 @@ > ifdef CONFIG_GENDWARFKSYMS > cmd_gensymtypes_S = \ > $(getasmexports) | \ > - $(CC) $(c_flags) -c -o $(@:.o=.gendwarfksyms.o) -xc -; \ > + $(CC) -D__GENDWARFKSYMS__ \ > + $(c_flags) -c -o $(@:.o=.gendwarfksyms.o) -xc -; \ > $(call getexportsymbols,\1) | \ > $(gendwarfksyms) $(@:.o=.gendwarfksyms.o) > else The patch looks reasonable to me. Thanks for figuring this out! Sami