mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-26 03:50:07 +08:00
NetBSD: reintroduce NetBSD support. Currently, -run works but executable has an incorrect format.
This commit is contained in:
parent
8ff705554d
commit
f233cb182c
@ -223,7 +223,7 @@ typedef struct alloca_list_struct {
|
||||
#elif defined(__OpenBSD__)
|
||||
#define BOUND_TID_TYPE pid_t
|
||||
#define BOUND_GET_TID syscall (SYS_getthrid)
|
||||
#elif defined(__FreeBSD__)
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#define BOUND_TID_TYPE pid_t
|
||||
#define BOUND_GET_TID 0
|
||||
#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || defined(__riscv)
|
||||
|
11
libtcc.c
11
libtcc.c
@ -889,7 +889,11 @@ LIBTCCAPI TCCState *tcc_new(void)
|
||||
tcc_define_symbol(s, "__FreeBSD_kernel__", NULL);
|
||||
# endif
|
||||
# if defined(__NetBSD__)
|
||||
tcc_define_symbol(s, "__NetBSD__", "__NetBSD__");
|
||||
tcc_define_symbol(s, "__NetBSD__", "1");
|
||||
tcc_define_symbol(s, "__GNUC__", "4");
|
||||
tcc_define_symbol(s, "__GNUC_MINOR__", "0");
|
||||
tcc_define_symbol(s, "__GNUC_PATCHLEVEL__", "0");
|
||||
tcc_define_symbol(s, "_Pragma(x)", "");
|
||||
# endif
|
||||
# if defined(__OpenBSD__)
|
||||
tcc_define_symbol(s, "__OpenBSD__", "1");
|
||||
@ -1110,6 +1114,11 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
|
||||
tcc_add_crt(s, "crt1.o");
|
||||
tcc_add_crt(s, "crti.o");
|
||||
tcc_add_crt(s, "crtbegin.o");
|
||||
#elif defined(__NetBSD__)
|
||||
if (output_type != TCC_OUTPUT_DLL)
|
||||
tcc_add_crt(s, "crt0.o");
|
||||
tcc_add_crt(s, "crti.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)
|
||||
|
2
tcc.c
2
tcc.c
@ -173,6 +173,8 @@ static const char version[] =
|
||||
" FreeBSD"
|
||||
#elif defined(__OpenBSD__)
|
||||
" OpenBSD"
|
||||
#elif defined(__NetBSD__)
|
||||
" NetBSD"
|
||||
#else
|
||||
" Linux"
|
||||
#endif
|
||||
|
8
tccelf.c
8
tccelf.c
@ -1431,11 +1431,11 @@ ST_FUNC void tcc_add_runtime(TCCState *s1)
|
||||
#endif
|
||||
if (strlen(TCC_LIBTCC1) > 0)
|
||||
tcc_add_support(s1, TCC_LIBTCC1);
|
||||
#if defined(__OpenBSD__) || defined(__FreeBSD__)
|
||||
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
/* add crt end if not memory output */
|
||||
if (s1->output_type != TCC_OUTPUT_MEMORY) {
|
||||
tcc_add_crt(s1, "crtend.o");
|
||||
#if defined(__FreeBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
tcc_add_crt(s1, "crtn.o");
|
||||
#endif
|
||||
}
|
||||
@ -2070,7 +2070,7 @@ static void fill_dynamic(TCCState *s1, struct dyn_inf *dyninf)
|
||||
put_dt(dynamic, DT_RELA, dyninf->rel_addr);
|
||||
put_dt(dynamic, DT_RELASZ, dyninf->rel_size);
|
||||
put_dt(dynamic, DT_RELAENT, sizeof(ElfW_Rel));
|
||||
#if defined(__OpenBSD__) || defined(__FreeBSD__)
|
||||
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
put_dt(dynamic, DT_PLTGOT, s1->got->sh_addr);
|
||||
put_dt(dynamic, DT_PLTRELSZ, dyninf->rel_size);
|
||||
put_dt(dynamic, DT_JMPREL, dyninf->rel_addr);
|
||||
@ -2756,7 +2756,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
|
||||
#ifdef TCC_ARM_EABI
|
||||
sh->sh_type != SHT_ARM_EXIDX &&
|
||||
#endif
|
||||
#if defined(__OpenBSD__) || defined(__FreeBSD__)
|
||||
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
sh->sh_type != SHT_X86_64_UNWIND &&
|
||||
sh->sh_type != SHT_NOTE &&
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user