Skip to content

"Unexpected run-time relocations (.rela) detected!" when building x86_64 bzImage after LLVM commit fa02a6ed66b1700c996b49c96c6bc0eb014c9518 #2165

@nathanchance

Description

@nathanchance

After llvm/llvm-project@fa02a6e, I see:

$ printf 'CONFIG_%s\n' KERNEL_GZIP=n KERNEL_ZSTD=y >arch/x86/configs/zstd.config

$ make -skj"$(nproc)" ARCH=x86_64 LLVM=1 mrproper defconfig zstd.config bzImage
ld.lld: error: Unexpected run-time relocations (.rela) detected!
make[5]: *** [arch/x86/boot/compressed/Makefile:116: arch/x86/boot/compressed/vmlinux] Error 1
...

With

diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 07e0e64b9a98..f3fae2a904ac 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -43,6 +43,8 @@ KBUILD_CFLAGS += -D__DISABLE_EXPORTS
 KBUILD_CFLAGS += $(call cc-option,-Wa$(comma)-mrelax-relocations=no)
 KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h

+CFLAGS_misc.o += -fno-jump-tables
+
 # sev-decode-insn.c indirectly includes inat-table.c which is generated during
 # compilation and stored in $(objtree). Add the directory to the includes so
 # that the compiler finds it even with out-of-tree builds (make O=/some/path).

I do not any linker script assertion failures but I am not sure if that would be considered a hack. Perhaps there is another way to get rid of these relocations (or find out what symbols are causing these sections to appear?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    [BUG] llvm (main)A bug in an unreleased version of LLVM (this label is appropriate for regressions)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions