Unified · Split
| @@ -1091,7 +1091,11 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) · 1090 unmodified lines | ||
| 1091 | 1091 | /* add libc crt1/crti objects */ |
| 1092 | 1092 | if ((output_type == TCC_OUTPUT_EXE || output_type == TCC_OUTPUT_DLL) && |
| 1093 | 1093 | !s->nostdlib) { |
| 1094 | −#ifndef TCC_TARGET_MACHO | |
| 1094 | +#if defined(__OpenBSD__) | |
| 1095 | + if (output_type != TCC_OUTPUT_DLL) | |
| 1096 | + tcc_add_crt(s, "crt0.o"); | |
| 1097 | + tcc_add_crt(s, "crtbegin.o"); | |
| 1098 | +#elif !defined(TCC_TARGET_MACHO) | |
| 1095 | 1099 | /* Mach-O with LC_MAIN doesn't need any crt startup code. */ |
| 1096 | 1100 | if (output_type != TCC_OUTPUT_DLL) |
| 1097 | 1101 | tcc_add_crt(s, "crt1.o"); |
| @@ -1429,7 +1429,11 @@ ST_FUNC void tcc_add_runtime(TCCState *s1) · 1428 unmodified lines | ||
| 1429 | 1429 | #endif |
| 1430 | 1430 | if (strlen(TCC_LIBTCC1) > 0) |
| 1431 | 1431 | tcc_add_support(s1, TCC_LIBTCC1); |
| 1432 | −#ifndef TCC_TARGET_MACHO | |
| 1432 | +#if defined(__OpenBSD__) | |
| 1433 | + /* add crt end if not memory output */ | |
| 1434 | + if (s1->output_type != TCC_OUTPUT_MEMORY) | |
| 1435 | + tcc_add_crt(s1, "crtend.o"); | |
| 1436 | +#elif !defined(TCC_TARGET_MACHO) | |
| 1433 | 1437 | /* add crt end if not memory output */ |
| 1434 | 1438 | if (s1->output_type != TCC_OUTPUT_MEMORY) |
| 1435 | 1439 | tcc_add_crt(s1, "crtn.o"); |