Are you compiling with PIC - position independent code? Is it needed?
Or does the kernel device driver code loader do relocation fixups?
According to https://stackoverflow.com/questions/5311515/gcc-fpic-option
it's mostly relevant for shared libraries which are simultaneously
loaded at different addresses in the code spaces of different processes.
Probably not needed for device drivers, since I assume they're only
loaded once.
So, why does the linker think it is building a shared library?
- Alex
On 2019-10-14 5:55 p.m., Axel Dörfler wrote:
Hi there,
I'm trying to build a 64-bit version of a driver that uses the standard makefile-engine. However, linking is failing with this error:
relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
Does anybody have an idea on how to fix this?
I've already added -mcmodel=kernel/medium and a few other options I found in our ArchitectureRules (-mno-red-zone, -fno-omit-frame-pointer, -z max-page-size=0x1000), but it didn't change anything.
Bye,
Axel.