Skip to content

Failed assertion "Cannot export BSS symbol" with ld.lld #2094

@nathanchance

Description

@nathanchance

Commit 90530521079e ("arm64/boot: Disallow BSS exports to startup code") in the arm64 tree (by @ardbiesheuvel) adds an ASSERT to the linker script to try and catch places where variables in .bss are used before .bss has actually been initialized. This assertions gets triggered in certain configurations; for example, allyesconfig fails with:

$ make -skj"$(nproc)" ARCH=arm64 LLVM=1 clean allyesconfig vmlinux
ld.lld: error: Cannot export BSS symbol _ctype to startup code
ld.lld: error: Cannot export BSS symbol swapper_pg_dir to startup code
ld.lld: error: Cannot export BSS symbol _etext to startup code
ld.lld: error: Cannot export BSS symbol __start_rodata to startup code
ld.lld: error: Cannot export BSS symbol __inittext_begin to startup code
ld.lld: error: Cannot export BSS symbol __inittext_end to startup code
ld.lld: error: Cannot export BSS symbol __initdata_begin to startup code
...

@arndb had a few randconfigs that hit this as well.

There does not appear to be an easy way to see what values these symbols have during linking to figure out why the assertion is failing. @MaskRay do you have any suggestions for how to debug something like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    [ARCH] arm64This bug impacts ARCH=arm64[BUG] linux-nextThis is an issue only seen in linux-next[FIXED][LLVM] 21This bug was fixed in LLVM 21[TOOL] lldThe issue is relevant to LLD linker[WORKAROUND] AppliedThis bug has an applied workaround

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions