Problems creating a driver (relocatable linking)
Posted: Fri Feb 11, 2022 5:01 am
I posted about that in stack overflow https://stackoverflow.com/questions/710 ... oc-section
Hello, this is my first question here. I'm writing a kernel, and looking for running drivers. The kernel can run some simple user applications in pe32+ format that loads on a fixed virtual address, however i need to load drivers in kernel space and that needs a compatible relocatable image.
I can read the dll import table, the subsystem and section headers of the driver image i created using msvc cl. But it seems to not have a ".reloc" section even though i specified in linker options /DYNAMICBASE and /FIXED:NO. The dll i created for the driver api seems to have the same problem and when i read hexadecimal output in HexDecoder. there is no reloc section. I've also seen the data directories and the relocation base entry is clear.
Here is the compiling options for the driver:
Here is for the dll driver kit
Hello, this is my first question here. I'm writing a kernel, and looking for running drivers. The kernel can run some simple user applications in pe32+ format that loads on a fixed virtual address, however i need to load drivers in kernel space and that needs a compatible relocatable image.
I can read the dll import table, the subsystem and section headers of the driver image i created using msvc cl. But it seems to not have a ".reloc" section even though i specified in linker options /DYNAMICBASE and /FIXED:NO. The dll i created for the driver api seems to have the same problem and when i read hexadecimal output in HexDecoder. there is no reloc section. I've also seen the data directories and the relocation base entry is clear.
Here is the compiling options for the driver:
Code: Select all
cl /I inc /I ../../libc/inc /I ../../libc/drv/inc /Fo:obj/x86_64/ /Fe:osdwm.sys src/*.c "../gdk.lib" /link /machine:x64 /subsystem:native /fixed:no /dynamicbase
copy /b osdwm.sys "../../kernel/iso/os/system"
Code: Select all
cl src/*.c /dll /dynamicbase /I ../inc /I ../drv/inc /Fe:gdk.dll /link /dll /fixed:no /dynamicbase /subsystem:native /machine:x64
copy /b gdk.dll "../../kernel/iso/os/system"
copy /b gdk.lib "../../drivers/gdk.lib"