https://sourceware.org/bugzilla/show_bug.cgi?id=30144
--- Comment #2 from Pali Rohár <pali at kernel dot org> --- As a workaround I have already come up with this: __attribute__((stdcall)) long DriverEntry(void *DriverObject, void *RegistryPath) asm("DriverEntry"); __attribute__((stdcall)) long DriverEntry(void *DriverObject, void *RegistryPath) { return 0; } And then you can use -Wl,--entry=DriverEntry for both AMD64 and IX86 archs. Via asm keyword in function declaration you can specify symbol name of the function itself. And because entry point symbol is basically used only by linker for filling base address field in PE binary, it can be anything. But this is still a workaround because it is not practical to add #ifdef for GNU tools into source code. Specially when MS tools do not need any special arch dependent command line switch or #ifdef. Switch /ENTRY:DriverEntry works for both AMD64 and IX86. I thought that it could be relatively easy for PE IX86 version of LD to search for symbol _XYZ@number when symbol XYZ specified in --entry does not exist. Specially because there is some logic related to this (--kill-at). But I have not looked at source code, so this was just my speculation... Another option would be to implement switch to instruct gcc (or ld) to "compile NT kernel driver" (I created issue for it: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108852) and part of it for IX86 platform could be automatic passing of --entry=_DriverEntry@8. -- You are receiving this mail because: You are on the CC list for the bug.