Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"relocation R_LARCH_B26 out of range" when building LoongArch allyesconfig with KCOV #1895

Open
nathanchance opened this issue Jul 29, 2023 · 2 comments
Labels
[ARCH] loongarch This bug impacts ARCH=loongarch [BUG] linux A bug that should be fixed in the mainline kernel. [BUG] Untriaged Something isn't working low priority This bug is not critical and not a priority

Comments

@nathanchance
Copy link
Member

nathanchance commented Jul 29, 2023

After https://git.kernel.org/chenhuacai/linux-loongson/c/54b9a87ddcc9102826437d3c26ed6c4ab2ad3677, I see the following errors when building ARCH=loongarch allyesconfig with the known broken configurations disabled:

$ make -skj"$(nproc)" ARCH=loongarch KCONFIG_ALLCONFIG=<(echo 'CONFIG_MODULES=n
CONFIG_CRASH_DUMP=n
CONFIG_RELOCATABLE=n
CONFIG_WERROR=n') LLVM=1 mrproper allyesconfig vmlinux
...
ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function dlm_lockspace_exit: .text+0x28): relocation R_LARCH_B26 out of range: 167866808 is not in [-134217728, 134217727]; references 'kset_unregister'
>>> referenced by lockspace.c
>>> defined in lib/lib.a(kobject.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function dlm_find_lockspace_global: .text+0x6c): relocation R_LARCH_B26 out of range: 168323444 is not in [-134217728, 134217727]; references '_raw_spin_lock'
>>> referenced by lockspace.c
>>> defined in vmlinux.a(kernel/locking/spinlock.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function dlm_find_lockspace_global: .text+0xc8): relocation R_LARCH_B26 out of range: 168324056 is not in [-134217728, 134217727]; references '_raw_spin_unlock'
>>> referenced by lockspace.c
>>> defined in vmlinux.a(kernel/locking/spinlock.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function dlm_find_lockspace_local: .text+0x12c): relocation R_LARCH_B26 out of range: 168323252 is not in [-134217728, 134217727]; references '_raw_spin_lock'
>>> referenced by lockspace.c
>>> defined in vmlinux.a(kernel/locking/spinlock.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function dlm_find_lockspace_local: .text+0x188): relocation R_LARCH_B26 out of range: 168323864 is not in [-134217728, 134217727]; references '_raw_spin_unlock'
>>> referenced by lockspace.c
>>> defined in vmlinux.a(kernel/locking/spinlock.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function dlm_find_lockspace_device: .text+0x1ec): relocation R_LARCH_B26 out of range: 168323060 is not in [-134217728, 134217727]; references '_raw_spin_lock'
>>> referenced by lockspace.c
>>> defined in vmlinux.a(kernel/locking/spinlock.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function dlm_find_lockspace_device: .text+0x248): relocation R_LARCH_B26 out of range: 168323672 is not in [-134217728, 134217727]; references '_raw_spin_unlock'
>>> referenced by lockspace.c
>>> defined in vmlinux.a(kernel/locking/spinlock.o)

ld.lld: error: vmlinux.a(fs/btrfs/file.o):(function btrfs_dirty_pages: .text+0x22c): relocation R_LARCH_B26 out of range: 155483484 is not in [-134217728, 134217727]; references '_printk'
>>> referenced by file.c
>>> defined in vmlinux.a(kernel/printk/printk.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function __dlm_new_lockspace: .text+0x438): relocation R_LARCH_B26 out of range: 168288072 is not in [-134217728, 134217727]; references 'mutex_lock_nested'
>>> referenced by lockspace.c
>>> defined in vmlinux.a(kernel/locking/mutex.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function __dlm_new_lockspace: .text+0x4dc): relocation R_LARCH_B26 out of range: 168036516 is not in [-134217728, 134217727]; references 'strlen'
>>> referenced by lockspace.c
>>> defined in lib/lib.a(string.o)

ld.lld: error: vmlinux.a(fs/btrfs/file.o):(function btrfs_drop_extents: .text+0x1740): relocation R_LARCH_B26 out of range: 155480080 is not in [-134217728, 134217727]; references 'abort_should_print_stack'
>>> referenced by file.c
>>> defined in vmlinux.a(fs/btrfs/ctree.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function __dlm_new_lockspace: .text+0x5ac): relocation R_LARCH_B26 out of range: 168037044 is not in [-134217728, 134217727]; references 'strncmp'
>>> referenced by lockspace.c
>>> defined in lib/lib.a(string.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function __dlm_new_lockspace: .text+0x6d4): relocation R_LARCH_B26 out of range: 168322508 is not in [-134217728, 134217727]; references '_raw_spin_unlock'
>>> referenced by lockspace.c
>>> defined in vmlinux.a(kernel/locking/spinlock.o)

ld.lld: error: vmlinux.a(fs/btrfs/file.o):(function btrfs_drop_extents: .text+0x19f0): relocation R_LARCH_B26 out of range: 155479392 is not in [-134217728, 134217727]; references 'abort_should_print_stack'
>>> referenced by file.c
>>> defined in vmlinux.a(fs/btrfs/ctree.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function __dlm_new_lockspace: .text+0x84c): relocation R_LARCH_B26 out of range: 168285556 is not in [-134217728, 134217727]; references 'mutex_unlock'
>>> referenced by lockspace.c
>>> defined in vmlinux.a(kernel/locking/mutex.o)

ld.lld: error: vmlinux.a(fs/dlm/lockspace.o):(function __dlm_new_lockspace: .text+0xde8): relocation R_LARCH_B26 out of range: 168319992 is not in [-134217728, 134217727]; references '_raw_spin_lock'
>>> referenced by lockspace.c
>>> defined in vmlinux.a(kernel/locking/spinlock.o)

ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)

Turning off CONFIG_KCOV avoids the issue. I assume that KCOV instrumentation is blowing up the size of the kernel and ld.lld is not able to cope with that? I would not even bother building allyesconfig normally but it is a better target than allmodconfig at the moment :)

cc @xen0n

@nathanchance nathanchance added [BUG] Untriaged Something isn't working [BUG] linux-next This is an issue only seen in linux-next [ARCH] loongarch This bug impacts ARCH=loongarch labels Jul 29, 2023
@xen0n
Copy link
Member

xen0n commented Jul 29, 2023

The LoongArch psABI can be pretty strict about the code model selection and access pattern at times, because support for range extension thunks isn't currently implemented nor mandated, so a symbol access in one of the smaller code model's way would naturally fall short in this case.

I'd investigate whether it's KCOV or lld that needs adaptation. thanks for the quick report!

@nathanchance
Copy link
Member Author

For what it's worth, I think this is low priority now that CONFIG_MODULES works (#1884), as we can use allmodconfig for testing, which has a much smaller final image size.

@nathanchance nathanchance added low priority This bug is not critical and not a priority [BUG] linux A bug that should be fixed in the mainline kernel. [BUG] Untriaged Something isn't working and removed [BUG] Untriaged Something isn't working [BUG] linux-next This is an issue only seen in linux-next labels Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] loongarch This bug impacts ARCH=loongarch [BUG] linux A bug that should be fixed in the mainline kernel. [BUG] Untriaged Something isn't working low priority This bug is not critical and not a priority
Projects
None yet
Development

No branches or pull requests

2 participants