mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-01 04:20:09 +08:00
OpenBSD: Fix warning and other *BSD builds.
This commit is contained in:
parent
e6d15a5df1
commit
a3524bd780
38
libtcc.c
38
libtcc.c
@ -897,21 +897,31 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
|
|||||||
#if TARGETOS_OpenBSD
|
#if TARGETOS_OpenBSD
|
||||||
if (output_type != TCC_OUTPUT_DLL)
|
if (output_type != TCC_OUTPUT_DLL)
|
||||||
tcc_add_crt(s, "crt0.o");
|
tcc_add_crt(s, "crt0.o");
|
||||||
|
if (output_type == TCC_OUTPUT_DLL)
|
||||||
|
tcc_add_crt(s, "crtbeginS.o");
|
||||||
|
else
|
||||||
|
tcc_add_crt(s, "crtbegin.o");
|
||||||
#elif TARGETOS_FreeBSD
|
#elif TARGETOS_FreeBSD
|
||||||
if (output_type != TCC_OUTPUT_DLL)
|
if (output_type != TCC_OUTPUT_DLL)
|
||||||
tcc_add_crt(s, "crt1.o");
|
tcc_add_crt(s, "crt1.o");
|
||||||
tcc_add_crt(s, "crti.o");
|
tcc_add_crt(s, "crti.o");
|
||||||
#elif TARGETOS_NetBSD
|
if (s->static_link)
|
||||||
if (output_type != TCC_OUTPUT_DLL)
|
|
||||||
tcc_add_crt(s, "crt0.o");
|
|
||||||
tcc_add_crt(s, "crti.o");
|
|
||||||
#endif
|
|
||||||
if (s->static_link && !TARGETOS_OpenBSD)
|
|
||||||
tcc_add_crt(s, "crtbeginT.o");
|
tcc_add_crt(s, "crtbeginT.o");
|
||||||
else if (output_type == TCC_OUTPUT_DLL)
|
else if (output_type == TCC_OUTPUT_DLL)
|
||||||
tcc_add_crt(s, "crtbeginS.o");
|
tcc_add_crt(s, "crtbeginS.o");
|
||||||
else
|
else
|
||||||
tcc_add_crt(s, "crtbegin.o");
|
tcc_add_crt(s, "crtbegin.o");
|
||||||
|
#elif TARGETOS_NetBSD
|
||||||
|
if (output_type != TCC_OUTPUT_DLL)
|
||||||
|
tcc_add_crt(s, "crt0.o");
|
||||||
|
tcc_add_crt(s, "crti.o");
|
||||||
|
if (s->static_link)
|
||||||
|
tcc_add_crt(s, "crtbeginT.o");
|
||||||
|
else if (output_type == TCC_OUTPUT_DLL)
|
||||||
|
tcc_add_crt(s, "crtbeginS.o");
|
||||||
|
else
|
||||||
|
tcc_add_crt(s, "crtbegin.o");
|
||||||
|
#endif
|
||||||
#elif !TCC_TARGET_MACHO
|
#elif !TCC_TARGET_MACHO
|
||||||
/* Mach-O with LC_MAIN doesn't need any crt startup code. */
|
/* Mach-O with LC_MAIN doesn't need any crt startup code. */
|
||||||
if (output_type != TCC_OUTPUT_DLL)
|
if (output_type != TCC_OUTPUT_DLL)
|
||||||
@ -1174,13 +1184,15 @@ LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname)
|
|||||||
const char *libs[] = { "%s/lib%s.dylib", "%s/lib%s.a", NULL };
|
const char *libs[] = { "%s/lib%s.dylib", "%s/lib%s.a", NULL };
|
||||||
const char **pp = s->static_link ? libs + 1 : libs;
|
const char **pp = s->static_link ? libs + 1 : libs;
|
||||||
#elif defined TARGETOS_OpenBSD
|
#elif defined TARGETOS_OpenBSD
|
||||||
const char *libs[] = { NULL, "%s/lib%s.a", NULL };
|
const char *libs[] = { s->static_link
|
||||||
const char **pp;
|
? NULL
|
||||||
if (s->static_link == 0) {
|
/* find exact versionned .so.x.y name as no
|
||||||
/* find exact versionned .so.x.y name as no symlink exists. */
|
symlink exists on OpenBSD. */
|
||||||
libs[0] = tcc_openbsd_library_soversion(s, libraryname);
|
: tcc_openbsd_library_soversion(s, libraryname),
|
||||||
}
|
"%s/lib%s.a",
|
||||||
pp = s->static_link ? libs + 1 : libs;
|
NULL
|
||||||
|
};
|
||||||
|
const char **pp = s->static_link ? libs + 1 : libs;
|
||||||
#else
|
#else
|
||||||
const char *libs[] = { "%s/lib%s.so", "%s/lib%s.a", NULL };
|
const char *libs[] = { "%s/lib%s.so", "%s/lib%s.a", NULL };
|
||||||
const char **pp = s->static_link ? libs + 1 : libs;
|
const char **pp = s->static_link ? libs + 1 : libs;
|
||||||
|
Loading…
Reference in New Issue
Block a user