Correction: the expected name is "_start" - not "_startup".

- avih


     On Saturday, September 9, 2023 at 07:19:32 PM GMT+3, avih 
<avih...@yahoo.com> wrote:  
 
 The following is test.c:

#include <windows.h>

void _start(void) {
    char buf[16] = {0};
    ExitProcess(42);
}


Try to compile it using:
tcc -Wl,-nostdlib test.c -lkernel32

Result:
tcc: error: undefined symbol 'memset'

Which I'm guessing is tcc trying to zero buf on startup using memset,
but failing to link the startup code.

It's possible to define memset at test.c and then it compiles and runs,
but I believe this should not be required.

Additionally, I don't know whether the name "_startup" and its prototype
are standardized, but if not, maybe it's worth either adding an option to
set the startup function name, or document the name _startup and its
prototype at the option help?

- avih
  
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to