diff --git a/libtcc.c b/libtcc.c index 61168deb..81c65444 100644 --- a/libtcc.c +++ b/libtcc.c @@ -1040,9 +1040,12 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) /* add libc crt1/crti objects */ if ((output_type == TCC_OUTPUT_EXE || output_type == TCC_OUTPUT_DLL) && !s->nostdlib) { +#ifndef TCC_TARGET_MACHO + /* Mach-O with LC_MAIN doesn't need any crt startup code. */ if (output_type != TCC_OUTPUT_DLL) tcc_add_crt(s, "crt1.o"); tcc_add_crt(s, "crti.o"); +#endif } #endif return 0;