OpenBSD: define more internal symbols to support tcc on OpenBSD.

This commit is contained in:
Christian Jullien 2020-12-07 07:15:56 +01:00
parent 170be79a42
commit a3d5e4aa43
2 changed files with 11 additions and 3 deletions

View file

@ -17,7 +17,7 @@ typedef union { long long __ll; long double __ld; } max_align_t;
typedef signed char int8_t; typedef signed char int8_t;
typedef signed short int int16_t; typedef signed short int int16_t;
typedef signed int int32_t; typedef signed int int32_t;
#if defined(__LP64__) && !defined(__APPLE__) #if defined(__LP64__) && !defined(__APPLE__) && !defined(__OpenBSD__)
typedef signed long int int64_t; typedef signed long int int64_t;
#else #else
typedef signed long long int int64_t; typedef signed long long int int64_t;
@ -25,7 +25,7 @@ typedef signed long long int int64_t;
typedef unsigned char uint8_t; typedef unsigned char uint8_t;
typedef unsigned short int uint16_t; typedef unsigned short int uint16_t;
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
#if defined(__LP64__) && !defined(__APPLE__) #if defined(__LP64__) && !defined(__APPLE__) && !defined(__OpenBSD__)
typedef unsigned long int uint64_t; typedef unsigned long int uint64_t;
#else #else
typedef unsigned long long int uint64_t; typedef unsigned long long int uint64_t;

View file

@ -892,7 +892,15 @@ LIBTCCAPI TCCState *tcc_new(void)
tcc_define_symbol(s, "__NetBSD__", "__NetBSD__"); tcc_define_symbol(s, "__NetBSD__", "__NetBSD__");
# endif # endif
# if defined(__OpenBSD__) # if defined(__OpenBSD__)
tcc_define_symbol(s, "__OpenBSD__", "__OpenBSD__"); tcc_define_symbol(s, "__OpenBSD__", "1");
tcc_define_symbol(s, "_ANSI_LIBRARY_", "1");
tcc_define_symbol(s, "__GNUC__", "4");
tcc_define_symbol(s, "__builtin_alloca", "alloca"); /* as we claim GNUC */
/* used by math.h */
tcc_define_symbol(s, "__builtin_huge_val()", "1e500");
tcc_define_symbol(s, "__builtin_huge_valf()", "1e50f");
tcc_define_symbol(s, "__builtin_huge_vall()", "1e5000L");
tcc_define_symbol(s, "__builtin_nanf(ignored_string)", "(0.0F/0.0F)");
# endif # endif
#endif #endif