mold icon indicating copy to clipboard operation
mold copied to clipboard

missing MODULE_LICENSE() when building nvidia kernel modules

Open nerijus opened this issue 3 years ago • 4 comments

Fedora 36, mold 1,4,2, trying to build nvidia kernel modules (I have akmod-nvidia-515.76-1.fc36.x86_64 installed from fedora-multimedia repo) I get:

akmodsbuild: LD [M]  /tmp/akmodsbuild.SOF7B9wS/BUILD/nvidia-kmod-515.76-x86_64/_kmod_build_5.19.11-200.fc36.x86_64/nvidia-peermem.o
akmodsbuild: LD [M]  /tmp/akmodsbuild.SOF7B9wS/BUILD/nvidia-kmod-515.76-x86_64/_kmod_build_5.19.11-200.fc36.x86_64/nvidia-drm.o
akmodsbuild: MODPOST /tmp/akmodsbuild.SOF7B9wS/BUILD/nvidia-kmod-515.76-x86_64/_kmod_build_5.19.11-200.fc36.x86_64/Module.symvers
akmodsbuild: ERROR: modpost: missing MODULE_LICENSE() in /tmp/akmodsbuild.SOF7B9wS/BUILD/nvidia-kmod-515.76-x86_64/_kmod_build_5.19.11-200.fc36.x86_64/nvidia.o
akmodsbuild: ERROR: modpost: missing MODULE_LICENSE() in /tmp/akmodsbuild.SOF7B9wS/BUILD/nvidia-kmod-515.76-x86_64/_kmod_build_5.19.11-200.fc36.x86_64/nvidia-uvm.o
akmodsbuild: make[2]: *** [scripts/Makefile.modpost:128: /tmp/akmodsbuild.SOF7B9wS/BUILD/nvidia-kmod-515.76-x86_64/_kmod_build_5.19.11-200.fc36.x86_64/Module.symvers] Error 1

Switching to /usr/bin/ld.bfd fixes error. The same problem is described in https://forums.developer.nvidia.com/t/error-modpost-missing-module-license-in-tmp-akmodsbuild-qbwum82l-build-nvidia-kmod-515-65-01-kmod-build-5-19-9-300-fc37-x86-64-nvidia-o/228489

nerijus avatar Sep 25 '22 11:09 nerijus

I believe Linux does something tricky with kernel modules, so I don't think mold can build them. We probably should show a warning message that that's not a supported use at the moment.

rui314 avatar Sep 25 '22 12:09 rui314

If only MODULE_LICENSE() is missing maybe it is not very difficult to support it?

nerijus avatar Sep 25 '22 12:09 nerijus

If it's the only issue, it might not be too difficult to fix, but I'm not sure about the assumption.

rui314 avatar Sep 25 '22 13:09 rui314

You are probably right, just read about how lld (clang linker) started to support linking Linux kernel. Although here we are talking about modules, not the kernel itself, so it might be easier.

nerijus avatar Sep 29 '22 13:09 nerijus