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
11051105 if (output_type != TCC_OUTPUT_DLL)
11061106 tcc_add_crt(s, "crt0.o");
11071107 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");
11081113 #elif !defined(TCC_TARGET_MACHO)
11091114 /* Mach-O with LC_MAIN doesn't need any crt startup code. */
11101115 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
14311431 #endif
14321432 if (strlen(TCC_LIBTCC1) > 0)
14331433 tcc_add_support(s1, TCC_LIBTCC1);
1434−#if defined(__OpenBSD__)
1434+#if defined(__OpenBSD__) || defined(__FreeBSD__)
14351435 /* add crt end if not memory output */
1436− if (s1->output_type != TCC_OUTPUT_MEMORY)
1436+ if (s1->output_type != TCC_OUTPUT_MEMORY) {
14371437 tcc_add_crt(s1, "crtend.o");
1438+#if defined(__FreeBSD__)
1439+ tcc_add_crt(s1, "crtn.o");
1440+#endif
1441+ }
14381442 #elif !defined(TCC_TARGET_MACHO)
14391443 /* add crt end if not memory output */
14401444 if (s1->output_type != TCC_OUTPUT_MEMORY)
@@ -2066,7 +2070,7 @@ static void fill_dynamic(TCCState *s1, struct dyn_inf *dyninf) · 625 unmodified lines
20662070 put_dt(dynamic, DT_RELA, dyninf->rel_addr);
20672071 put_dt(dynamic, DT_RELASZ, dyninf->rel_size);
20682072 put_dt(dynamic, DT_RELAENT, sizeof(ElfW_Rel));
2069−#ifdef __OpenBSD__
2073+#if defined(__OpenBSD__) || defined(__FreeBSD__)
20702074 put_dt(dynamic, DT_PLTGOT, s1->got->sh_addr);
20712075 put_dt(dynamic, DT_PLTRELSZ, dyninf->rel_size);
20722076 put_dt(dynamic, DT_JMPREL, dyninf->rel_addr);
@@ -2399,7 +2403,7 @@ static void create_arm_attribute_section(TCCState *s1) · 326 unmodified lines
23992403 }
24002404 #endif
24012405
2402−#ifdef __OpenBSD__
2406+#if defined(__OpenBSD__)
24032407 static Section *create_openbsd_note_section(TCCState *s1)
24042408 {
24052409 Section *s = find_section (s1, ".note.openbsd.ident");
@@ -2757,7 +2761,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1, · 351 unmodified lines
27572761 #ifdef TCC_ARM_EABI
27582762 sh->sh_type != SHT_ARM_EXIDX &&
27592763 #endif
2760−#ifdef __OpenBSD__
2764+#if defined(__OpenBSD__) || defined(__FreeBSD__)
27612765 sh->sh_type != SHT_X86_64_UNWIND &&
27622766 sh->sh_type != SHT_NOTE &&
27632767 #endif
tccrun.c+1−1
@@ -155,7 +155,7 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv) · 154 unmodified lines
155155 #ifdef CONFIG_TCC_BACKTRACE
156156 rt_context *rc = &g_rtctxt;
157157 #endif
158−# if defined(__APPLE__)
158+# if defined(__APPLE__) || defined(__FreeBSD__)
159159 char **envp = NULL;
160160 #else
161161 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