Objtool duplicating symbols in kernel module

I’ve got an interesting problem with objtool.
It seems to be injecting duplicate symbols into my kernel module object.

All the source files compile just fine, and the module works under Ubuntu with kernel 6.9.1. But I’ve noticed Ubuntu just links with ld, while opensuse calls objtool to do some post-processing.

savedcmd_/home/user/source/src/drivers/pci/driver.o := ld -m elf_x86_64 -z noexecstack --no-warn-rwx-segments   -r -o /home/user/source/src/drivers/pci/aim_mil.o @/home/user/source/src/drivers/pci/aim_mil.mod  ; ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --hacks=skylake --ibt --orc --retpoline --rethunk --sls --static-call --uaccess --prefix=16  --link  --module /home/user/source/src/drivers/pci/driver.o

/home/user/source/src/drivers/pci/driver.o: $(wildcard ./tools/objtool/objtool)

Unfortunately, this post-processing is introducing duplicate symbols. Running objdump before/after ld and objtool are executed shows the issue, but I don’t have a minimal reproduction.
Is there a way to bypass this symbol relocation somehow?
I’m buliding on microos/tumbleweed with kernel 6.9.7 at the moment.
The OS is partially locked down, so it’s tough to experiment.

And why exactly is it bad? So far you have not described any real problem you are trying to solve.

Well, the kernel 6.5.0-42 on Ubuntu 22.04 has CONFIG_OBJTOOL=y.

Set CONFIG_OBJTOOL=n?

GNU C/C++ 13 doesn’t allow duplicate/ambiguous symbols, and the flags passed to LD to bypass this behavior don’t seem to be implemented.
This fails the build/fails to link.

It appears to be a flaw or bug in the version of objtool being using in the opensuse kernel.
Disabling OBJTOOL manually by removing the references in the makefile solves this issue, setting the options appears to be broken/not passed through to the kernel build.

1 Like

Kernel in Factory is built with CONFIG_OBJTOOL=y and gcc13. May be the problem is with your custom module?

Anyway, tools/objtool/Documentation/objtool.txt describes how to disable it for a specific file or directory.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.