diff options
-rw-r--r-- | src/expand/proc_macro.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 4 | ||||
-rw-r--r-- | src/trans/target.cpp | 14 | ||||
-rw-r--r-- | tools/minicargo/build.cpp | 3 | ||||
-rw-r--r-- | tools/minicargo/manifest.cpp | 4 |
5 files changed, 26 insertions, 1 deletions
diff --git a/src/expand/proc_macro.cpp b/src/expand/proc_macro.cpp index 29bd6e8c..d34a91a5 100644 --- a/src/expand/proc_macro.cpp +++ b/src/expand/proc_macro.cpp @@ -24,7 +24,7 @@ # include <sys/wait.h> #endif -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) || defined(__NetBSD__) extern char **environ; #endif diff --git a/src/main.cpp b/src/main.cpp index c63ce0d6..369c80de 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,6 +52,10 @@ # else # define DEFAULT_TARGET_NAME "i586-windows-gnu" # endif +#elif defined(__NetBSD__) +# if defined(__amd64__) +# define DEFAULT_TARGET_NAME "x86_64-unknown-netbsd" +# endif #elif defined(__OpenBSD__) # if defined(__amd64__) # define DEFAULT_TARGET_NAME "x86_64-unknown-openbsd" diff --git a/src/trans/target.cpp b/src/trans/target.cpp index 1f04666e..a91b1225 100644 --- a/src/trans/target.cpp +++ b/src/trans/target.cpp @@ -94,6 +94,13 @@ namespace ARCH_X86_64 }; } + else if(target_name == "x86_64-unknown-netbsd") + { + return TargetSpec { + "unix", "netbsd", "gnu", CodegenMode::Gnu11, "x86_64-unknown-netbsd", + ARCH_X86_64 + }; + } else if(target_name == "i686-unknown-openbsd") { return TargetSpec { @@ -147,6 +154,13 @@ void Target_SetCfg(const ::std::string& target_name) } Cfg_SetValue("target_env", g_target.m_env_name); + if( g_target.m_os_name == "netbsd" ) + { + Cfg_SetFlag("netbsd"); + Cfg_SetValue("target_vendor", "unknown"); + } + Cfg_SetValue("target_env", g_target.m_env_name); + if( g_target.m_os_name == "openbsd" ) { Cfg_SetFlag("openbsd"); diff --git a/tools/minicargo/build.cpp b/tools/minicargo/build.cpp index bde2b09d..5c5a8f25 100644 --- a/tools/minicargo/build.cpp +++ b/tools/minicargo/build.cpp @@ -51,6 +51,9 @@ extern int _putenv_s(const char*, const char*); # define HOST_TARGET "x86_64-windows-gnu" # else # endif +#elif defined(__NetBSD__) +# define EXESUF "" +# define HOST_TARGET "x86_64-unknown-netbsd" #else # define EXESUF "" # define HOST_TARGET "x86_64-unknown-linux-gnu" diff --git a/tools/minicargo/manifest.cpp b/tools/minicargo/manifest.cpp index 3cb59113..6e2bf451 100644 --- a/tools/minicargo/manifest.cpp +++ b/tools/minicargo/manifest.cpp @@ -14,6 +14,10 @@ # define TARGET_NAME "i586-windows-msvc" # define CFG_UNIX false # define CFG_WINDOWS true +#elif defined(__NetBSD__) +# define TARGET_NAME "x86_64-unknown-netbsd" +# define CFG_UNIX true +# define CFG_WINDOWS false #else # define TARGET_NAME "x86_64-unknown-linux-gnu" # define CFG_UNIX true |