You are not logged in.

#1 2026-04-17 08:53:58

marzoul
Member
Registered: 2012-10-29
Posts: 40

Driver compilation issue, kernel compilation flags, or gcc bug ?

Hi,

TLDR

I am experiencing compilation issues for a driver, where the .ko files are generated, but modprobe rejects with Exec format error.

So far I suspect that this is a gcc 15.2.1 bug, potentially linked to kernel compilation flags.
This is why I am posting that here - potentially most knowledgeable people are here.
Just say if this topic should be in another location in forums.

DETAILS

The driver of interest is the Xilinx QDMA driver for PCIe FPGA boards.
In case it is useful, the webpage : https://xilinx.github.io/dma_ip_drivers … index.html

To ease experiments I created an AUR package that describes these issues. Because it _should_ work with the provided patches.
https://aur.archlinux.org/packages/xilinx-qdma-git

Current status is : compilation with the small patches finished, .ko files are generated and installed, but modprobe rejects these with the following error message :

modprobe: ERROR: could not insert 'qdma_pf': Exec format error

It is worth noting that compilation and link is done without warning. But the next step with the kernel objtool emits a large amount of such fishy warnings :

qdma-pf.o: warning: objtool: eqdma_cpm5_hw_desc_err_process() falls through to next function eqdma_cpm5_config_num_regs_get()
qdma-pf.o: warning: objtool: .eh_frame+0xa23c: data relocation to !ENDBR: eqdma_cpm5_dump_reg_info.cold+0x0

Searching internet, these warnings look similar to previous gcc bugs that are supposedly fixed already.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116174

To help with analysis, we could test on a machine with Ubuntu 24 and gcc 13.3.
Compilation and link and objtool go fine. Kernel modules are accepted by modprobe. And the PCIe board works \o/

Which indicates the current toolchain in Archlinux has some sort of a problem.
I tried with gcc 14, but I am hitting unsupported compilation options that are set by the kernel Makefiles.
Digging in the kernel build Makefiles I could find how to add custom options, but not how to remove options event for dirty experiment purposes.

REPRODUCER

I took the effort and created a small reproducer that emits these warnings, with the minimal set of compilation flags that generates the exact same warnings.
Here is an archive in a public cloud (tar.gz, 1.5 kB) :
https://cloud.univ-grenoble-alpes.fr/s/PP5KdEFQwRGn3RN
The warnings at objtool step :

main_ld.o: warning: objtool: func2() falls through to next function func1()
main_ld.o: warning: objtool: func1() falls through to next function process()

Remove any option from CFLAGS (except first line) and objtool messages change
The warnings disappear if that option is removed : -fno-plt
I don't know what that option does and obviously I cant test the phony generated object.

But I would like to test if the QDMA driver would work if only could remove that option from compilation flags.
Any advice how I could do that ?

Could it be a gcc bug ?

Thanks for your time :-)

Last edited by marzoul (2026-04-17 09:25:57)

Offline

#2 2026-04-17 11:22:39

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 577

Re: Driver compilation issue, kernel compilation flags, or gcc bug ?

marzoul wrote:

I am experiencing compilation issues for a driver, where the .ko files are generated, but modprobe rejects with Exec format error.

I built modules with `make` in dma_ip_drivers/QDMA/linux-kernel/ and inserted qdma_pf.ko with no problem:

[78212.904378] qdma_pf: loading out-of-tree module taints kernel.
[78212.904432] qdma_pf: module verification failed: signature and/or required key missing - tainting kernel
[78212.964898] qdma_pf:qdma_mod_init: Xilinx QDMA PF Reference Driver v2024.1.0.0.

gcc (GCC) 15.2.1 20260209
linux-6.19.11-arch1-1

Are you sure you are trying to insert module into the same kernel as it is built for?

Online

#3 2026-04-17 15:03:48

marzoul
Member
Registered: 2012-10-29
Posts: 40

Re: Driver compilation issue, kernel compilation flags, or gcc bug ?

Thank you for your answer.

I have same version of gcc, but not of linux :
gcc (GCC) 15.2.1 20260209
6.19.10.arch1-1

Maybe some changes were made in latest linux package for better compatibility with gcc 15.2.1.
I'll update when the machine is available.

Offline

#4 2026-04-17 18:48:31

marzoul
Member
Registered: 2012-10-29
Posts: 40

Re: Driver compilation issue, kernel compilation flags, or gcc bug ?

dimich wrote:

I built modules with `make` in dma_ip_drivers/QDMA/linux-kernel/ and inserted qdma_pf.ko with no problem:

After system update and reboot just to be sure, I re-confirm the compilation with makepkg is broken on at least 2 machines. Same Archlinux system, no dubious config.
gcc (GCC) 15.2.1 20260209
6.19.11-arch1-1 x86_64

You said that you just did make in directory linux-kernel.
I tried that to be sure (with patches from my AUR package) : it works !

So that seems to be a good temporary fallback.
I'll try to dig in the makepkg CFLAGS to check what is causing all this trouble.

Offline

#5 2026-04-17 19:18:20

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 577

Re: Driver compilation issue, kernel compilation flags, or gcc bug ?

marzoul wrote:

I'll try to dig in the makepkg CFLAGS to check what is causing all this trouble.

I'd suggest to create DKMS package for kernel modules. Without DKMS, besides CFLAGS and other possible pitfalls of compiling by makepkg, you'll need to manually rebuild package after every kernel upgrade.

Last edited by dimich (2026-04-17 19:19:39)

Online

#6 Today 07:14:51

marzoul
Member
Registered: 2012-10-29
Posts: 40

Re: Driver compilation issue, kernel compilation flags, or gcc bug ?

dimich wrote:

I'd suggest to create DKMS package for kernel modules. Without DKMS, besides CFLAGS and other possible pitfalls of compiling by makepkg, you'll need to manually rebuild package after every kernel upgrade.

Thanks for the suggestion. That may be a personal position but I wouldn't like a failed recompilation after a kernel update (given the current set of patches I don't anticipate stability) so I usually actually prefer to be forced to recompile and reinstall the package separately. Dependencies to kernel versions are added in the package for that purpose.

I have found the set of makepkg options that make compilation fail : -fno-plt -fexceptions
So the package is now functional.

Offline

#7 Today 10:37:40

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 577

Re: Driver compilation issue, kernel compilation flags, or gcc bug ?

marzoul wrote:

I have found the set of makepkg options that make compilation fail : -fno-plt -fexceptions

Since kernel build system will set required compiler flags by itself, consider to build userspace binaries separately from kernel modules by separate make calls. And for modules just unset CFLAGS and LDFLAGS before calling make.

Online

Board footer

Powered by FluxBB