OpenBSD: Fix crt startup names - WIP

This commit is contained in:
Christian Jullien 2020-11-29 08:47:27 +01:00
parent 4e12c2a6dc
commit dfe031caa6
2 changed files with 10 additions and 2 deletions

View File

@ -1091,7 +1091,11 @@ 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
#if defined(__OpenBSD__)
if (output_type != TCC_OUTPUT_DLL)
tcc_add_crt(s, "crt0.o");
tcc_add_crt(s, "crtbegin.o");
#elif !defined(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");

View File

@ -1429,7 +1429,11 @@ ST_FUNC void tcc_add_runtime(TCCState *s1)
#endif
if (strlen(TCC_LIBTCC1) > 0)
tcc_add_support(s1, TCC_LIBTCC1);
#ifndef TCC_TARGET_MACHO
#if defined(__OpenBSD__)
/* add crt end if not memory output */
if (s1->output_type != TCC_OUTPUT_MEMORY)
tcc_add_crt(s1, "crtend.o");
#elif !defined(TCC_TARGET_MACHO)
/* add crt end if not memory output */
if (s1->output_type != TCC_OUTPUT_MEMORY)
tcc_add_crt(s1, "crtn.o");