History

FreeBSD: little better support that targets FreeBSD 12.2 on amd64 but still not working - WIP

Christian Jullien committed 5 years ago

Commit a06fef31 parent f9c580b3 files · +15 −6Browse files

Unified · Split

3 files
  1. libtcc.c +5 −0
  2. tccelf.c +9 −5
  3. tccrun.c +1 −1
libtcc.c+5−0
@@ -1105,6 +1105,11 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) · 1104 unmodified lines
1105 if (output_type != TCC_OUTPUT_DLL)1105 if (output_type != TCC_OUTPUT_DLL)
1106 tcc_add_crt(s, "crt0.o");1106 tcc_add_crt(s, "crt0.o");
1107 tcc_add_crt(s, "crtbegin.o");1107 tcc_add_crt(s, "crtbegin.o");
1108#elif defined(__FreeBSD__)
1109 if (output_type != TCC_OUTPUT_DLL)
1110 tcc_add_crt(s, "crt1.o");
1111 tcc_add_crt(s, "crti.o");
1112 tcc_add_crt(s, "crtbegin.o");
1108#elif !defined(TCC_TARGET_MACHO)1113#elif !defined(TCC_TARGET_MACHO)
1109 /* Mach-O with LC_MAIN doesn't need any crt startup code. */1114 /* Mach-O with LC_MAIN doesn't need any crt startup code. */
1110 if (output_type != TCC_OUTPUT_DLL)1115 if (output_type != TCC_OUTPUT_DLL)
tccelf.c+9−5
@@ -1431,10 +1431,14 @@ ST_FUNC void tcc_add_runtime(TCCState *s1) · 1430 unmodified lines
1431#endif1431#endif
1432 if (strlen(TCC_LIBTCC1) > 0)1432 if (strlen(TCC_LIBTCC1) > 0)
1433 tcc_add_support(s1, TCC_LIBTCC1);1433 tcc_add_support(s1, TCC_LIBTCC1);
1434#if defined(__OpenBSD__)1434#if defined(__OpenBSD__) || defined(__FreeBSD__)
1435 /* add crt end if not memory output */1435 /* add crt end if not memory output */
1436 if (s1->output_type != TCC_OUTPUT_MEMORY)1436 if (s1->output_type != TCC_OUTPUT_MEMORY) {
1437 tcc_add_crt(s1, "crtend.o");1437 tcc_add_crt(s1, "crtend.o");
1438#if defined(__FreeBSD__)
1439 tcc_add_crt(s1, "crtn.o");
1440#endif
1441 }
1438#elif !defined(TCC_TARGET_MACHO)1442#elif !defined(TCC_TARGET_MACHO)
1439 /* add crt end if not memory output */1443 /* add crt end if not memory output */
1440 if (s1->output_type != TCC_OUTPUT_MEMORY)1444 if (s1->output_type != TCC_OUTPUT_MEMORY)
@@ -2066,7 +2070,7 @@ static void fill_dynamic(TCCState *s1, struct dyn_inf *dyninf) · 625 unmodified lines
2066 put_dt(dynamic, DT_RELA, dyninf->rel_addr);2070 put_dt(dynamic, DT_RELA, dyninf->rel_addr);
2067 put_dt(dynamic, DT_RELASZ, dyninf->rel_size);2071 put_dt(dynamic, DT_RELASZ, dyninf->rel_size);
2068 put_dt(dynamic, DT_RELAENT, sizeof(ElfW_Rel));2072 put_dt(dynamic, DT_RELAENT, sizeof(ElfW_Rel));
2069#ifdef __OpenBSD__2073#if defined(__OpenBSD__) || defined(__FreeBSD__)
2070 put_dt(dynamic, DT_PLTGOT, s1->got->sh_addr);2074 put_dt(dynamic, DT_PLTGOT, s1->got->sh_addr);
2071 put_dt(dynamic, DT_PLTRELSZ, dyninf->rel_size);2075 put_dt(dynamic, DT_PLTRELSZ, dyninf->rel_size);
2072 put_dt(dynamic, DT_JMPREL, dyninf->rel_addr);2076 put_dt(dynamic, DT_JMPREL, dyninf->rel_addr);
@@ -2399,7 +2403,7 @@ static void create_arm_attribute_section(TCCState *s1) · 326 unmodified lines
2399}2403}
2400#endif2404#endif
2401 2405
2402#ifdef __OpenBSD__2406#if defined(__OpenBSD__)
2403static Section *create_openbsd_note_section(TCCState *s1)2407static Section *create_openbsd_note_section(TCCState *s1)
2404{2408{
2405 Section *s = find_section (s1, ".note.openbsd.ident");2409 Section *s = find_section (s1, ".note.openbsd.ident");
@@ -2757,7 +2761,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1, · 351 unmodified lines
2757#ifdef TCC_ARM_EABI2761#ifdef TCC_ARM_EABI
2758 sh->sh_type != SHT_ARM_EXIDX &&2762 sh->sh_type != SHT_ARM_EXIDX &&
2759#endif2763#endif
2760#ifdef __OpenBSD__2764#if defined(__OpenBSD__) || defined(__FreeBSD__)
2761 sh->sh_type != SHT_X86_64_UNWIND &&2765 sh->sh_type != SHT_X86_64_UNWIND &&
2762 sh->sh_type != SHT_NOTE &&2766 sh->sh_type != SHT_NOTE &&
2763#endif2767#endif
tccrun.c+1−1
@@ -155,7 +155,7 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv) · 154 unmodified lines
155#ifdef CONFIG_TCC_BACKTRACE155#ifdef CONFIG_TCC_BACKTRACE
156 rt_context *rc = &g_rtctxt;156 rt_context *rc = &g_rtctxt;
157#endif157#endif
158# if defined(__APPLE__)158# if defined(__APPLE__) || defined(__FreeBSD__)
159 char **envp = NULL;159 char **envp = NULL;
160#else160#else
161 char **envp = environ;161 char **envp = environ;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t