aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2017-09-25 18:39:35 +0300
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2017-09-25 18:39:35 +0300
commitabd1532ad41f6b9c7f1c5a10b5b8df22d73567cf (patch)
treea420f289c620ed21d984d8d2d9657d6d67019800
parent560188711dc12a9d8b3a437069251096b37b1f82 (diff)
downloadtinycc-abd1532ad41f6b9c7f1c5a10b5b8df22d73567cf.tar.gz
tinycc-abd1532ad41f6b9c7f1c5a10b5b8df22d73567cf.tar.bz2
freebsd: allow building tcc which targets windows
Currently tcc doesn't have a compile-time config indicating that the target is freebsd, and as a result, the tcc binary adds freebsh stuff to elf headers if the compile-time (of tcc) *host* is freebsd. Test also that the target is not PE while generating an elf header. This still likely fails (but untested) when tcc targets other non-freebsd systems on a freebsd system, but for now fix it only when targetting windows.
-rw-r--r--tccelf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tccelf.c b/tccelf.c
index 9a7aa91..225cd9d 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -1832,7 +1832,8 @@ static void tcc_output_elf(TCCState *s1, FILE *f, int phnum, ElfW(Phdr) *phdr,
ehdr.e_ident[4] = ELFCLASSW;
ehdr.e_ident[5] = ELFDATA2LSB;
ehdr.e_ident[6] = EV_CURRENT;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if !defined(TCC_TARGET_PE) && (defined(__FreeBSD__) || defined(__FreeBSD_kernel__))
+ /* FIXME: should set only for freebsd _target_, but we exclude only PE target */
ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
#endif
#ifdef TCC_TARGET_ARM