History

build: add initial NetBSD support.

Not able to generate ELF files on NetBSD yet (lacks the note and crt1.o is actually named crt0.o on NetBSD), but -run works with these extra defines: -D__lint__ -D"__symbolrename(x)=asm(#x)" -D__NetBSD__ The -D__lint__ is an ugly hack, TCC should be able to emulate GCC just fine, but it seems TCC doesn't support __builtin_va_list yet? typedef __builtin_va_list __va_list; /usr/include/sys/ansi.h:72: error: ';' expected (got "__va_list")

minux committed 12 years ago

Commit 9714d2e1 parent 469ae3a3 files · +13 −4Browse files

Unified · Split

3 files
  1. configure +1 −0
  2. lib/bcheck.c +2 −2
  3. tccrun.c +10 −2
configure+1−0
@@ -56,6 +56,7 @@ case $targetos in · 55 unmodified lines
5656 DragonFly) noldl=yes;;
5757 OpenBSD) noldl=yes;;
5858 FreeBSD) noldl=yes;;
59+ NetBSD) noldl=yes;;
5960 *) ;;
6061 esac
6162
lib/bcheck.c+2−2
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 #include <stdarg.h>
2323 #include <string.h>
2424 #if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) \
25− && !defined(__DragonFly__) && !defined(__OpenBSD__)
25+ && !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
2626 #include <malloc.h>
2727 #endif
2828 #if !defined(_WIN32)
@@ -41,7 +41,7 @@ · 12 unmodified lines
4141
4242 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
4343 || defined(__DragonFly__) || defined(__dietlibc__) \
44− || defined(__UCLIBC__) || defined(__OpenBSD__) \
44+ || defined(__UCLIBC__) || defined(__OpenBSD__) || defined(__NetBSD__) \
4545 || defined(_WIN32) || defined(TCC_UCLIBC)
4646 #warning Bound checking does not support malloc (etc.) in this environment.
4747 #undef CONFIG_TCC_MALLOC_HOOKS
tccrun.c+10−2
@@ -486,10 +486,12 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level) · 485 unmodified lines
486486 if (level == 0) {
487487 #if defined(__APPLE__)
488488 *paddr = uc->uc_mcontext->__ss.__eip;
489−#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
489+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
490490 *paddr = uc->uc_mcontext.mc_eip;
491491 #elif defined(__dietlibc__)
492492 *paddr = uc->uc_mcontext.eip;
493+#elif defined(__NetBSD__)
494+ *paddr = uc->uc_mcontext.__gregs[_REG_EIP];
493495 #else
494496 *paddr = uc->uc_mcontext.gregs[REG_EIP];
495497 #endif
@@ -497,10 +499,12 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level) · 1 unmodified line
497499 } else {
498500 #if defined(__APPLE__)
499501 fp = uc->uc_mcontext->__ss.__ebp;
500−#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
502+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
501503 fp = uc->uc_mcontext.mc_ebp;
502504 #elif defined(__dietlibc__)
503505 fp = uc->uc_mcontext.ebp;
506+#elif defined(__NetBSD__)
507+ fp = uc->uc_mcontext.__gregs[_REG_EBP];
504508 #else
505509 fp = uc->uc_mcontext.gregs[REG_EBP];
506510 #endif
@@ -530,6 +534,8 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level) · 23 unmodified lines
530534 *paddr = uc->uc_mcontext->__ss.__rip;
531535 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
532536 *paddr = uc->uc_mcontext.mc_rip;
537+#elif defined(__NetBSD__)
538+ *paddr = uc->uc_mcontext.__gregs[_REG_RIP];
533539 #else
534540 *paddr = uc->uc_mcontext.gregs[REG_RIP];
535541 #endif
@@ -539,6 +545,8 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level) · 3 unmodified lines
539545 fp = uc->uc_mcontext->__ss.__rbp;
540546 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
541547 fp = uc->uc_mcontext.mc_rbp;
548+#elif defined(__NetBSD__)
549+ fp = uc->uc_mcontext.__gregs[_REG_RBP];
542550 #else
543551 fp = uc->uc_mcontext.gregs[REG_RBP];
544552 #endif

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