Subject: Re: linux-next: build failure after merge of the mm-nonmm-unstable tree

From: Finn Thain <[email-masked]>
Date: Fri, 2 Jan 2026 10:15:39 +1100 (AEDT)

On Thu, 1 Jan 2026, Randy Dunlap wrote:

> > The following patch produces a build failure.
> > 
> > diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
> > index fd855e32c9b9..8442eebaada1 100644
> > --- a/arch/x86/boot/compressed/misc.h
> > +++ b/arch/x86/boot/compressed/misc.h
> > @@ -8,6 +8,7 @@
> >   * we just keep it from happening. (This list needs to be extended when new
> >   * paravirt and debugging variants are added.)
> >   */
> > +#include <generated/autoconf.h>
> >  #undef CONFIG_PARAVIRT
> >  #undef CONFIG_PARAVIRT_XXL
> >  #undef CONFIG_PARAVIRT_SPINLOCKS
> > 
> > 
> > Problem is, you can't do #undef unless you know that #define has already 
> > taken place, and you can't #define again if #undef has already taken 
> > place...
> > 
> > Anyway, that's just BTW: I don't feel any need to revise the patches I 
> > sent.
> > 
> 
> Hi,
> You mean something more than
> 
> +#include <generated/autoconf.h>
> +#ifdef CONFIG_PARAVIRT
>  #undef CONFIG_PARAVIRT
> +#endif
> +#ifdef CONFIG_PARAVIRT_XXL
>  #undef CONFIG_PARAVIRT_XXL
> +#endif
> +#ifdef CONFIG_PARAVIRT_SPINLOCKS
>  #undef CONFIG_PARAVIRT_SPINLOCKS
> +#endif
> 

That's not what I meant. Perhaps I should have said, you can't #undef 
unless you know that #include has already taken place. That is, if some 
header does #undef CONFIG_FOO on the assumption that #include 
<generated/autoconf.h> has already taken place, then it is fragile.

autoconf.h contains no multiple inclusion guard, and it gets included by 
multiple other headers, so it is prone to 0, 1 or N inclusions. Ordering 
with respect to #undef CONFIG_FOO is anyone's guess...

FYI, the build failure I was referring to looks like this. It's actually 
caused by solving the fragility problem I just described above...

  LD      arch/x86/boot/compressed/vmlinux
x86_64-linux-ld: error: unplaced orphan section `.altinstructions' from `arch/x86/boot/compressed/ident_map_64.o'
x86_64-linux-ld: error: unplaced orphan section `.altinstr_replacement' from `arch/x86/boot/compressed/ident_map_64.o'
x86_64-linux-ld: error: unplaced orphan section `.altinstr_aux' from `arch/x86/boot/compressed/ident_map_64.o'
x86_64-linux-ld: arch/x86/boot/compressed/ident_map_64.o: in function `ident_p4d_init':
ident_map_64.c:(.text+0x57f): undefined reference to `__pti_set_user_pgtbl'
x86_64-linux-ld: arch/x86/boot/compressed/ident_map_64.o: in function `kernel_ident_mapping_init':
ident_map_64.c:(.text+0x8ab): undefined reference to `__pti_set_user_pgtbl'
x86_64-linux-ld: arch/x86/boot/compressed/ident_map_64.o:(.altinstr_aux+0x2): undefined reference to `boot_cpu_data'
x86_64-linux-ld: arch/x86/boot/compressed/ident_map_64.o:(.altinstr_aux+0x14): undefined reference to `boot_cpu_data'
x86_64-linux-ld: arch/x86/boot/compressed/ident_map_64.o:(.altinstr_aux+0x26): undefined reference to `boot_cpu_data'
x86_64-linux-ld: arch/x86/boot/compressed/vmlinux: hidden symbol `__pti_set_user_pgtbl' isn't defined
x86_64-linux-ld: final link failed: bad value
make[3]: *** [arch/x86/boot/compressed/Makefile:119: arch/x86/boot/compressed/vmlinux] Error 1
make[2]: *** [arch/x86/boot/Makefile:96: arch/x86/boot/compressed/vmlinux] Error 2
make[1]: *** [arch/x86/Makefile:310: bzImage] Error 2
make: *** [Makefile:248: __sub-make] Error 2

If you wish to try that experiment, you'll probably need something like this:

./scripts/config -e WERROR -e LD_ORPHAN_WARN --set-str LD_ORPHAN_WARN_LEVEL error -e EFI_STUB -e CPU_SUP_AMD -e AMD_MEM_ENCRYPT