summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/HsVersions.h2
-rw-r--r--compiler/main/DriverPipeline.hs2
-rw-r--r--compiler/main/StaticFlags.hs7
-rw-r--r--compiler/nativeGen/Platform.hs4
4 files changed, 13 insertions, 2 deletions
diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h
index ad17189907..4d8e52133f 100644
--- a/compiler/HsVersions.h
+++ b/compiler/HsVersions.h
@@ -17,7 +17,7 @@ you will screw up the layout where they are used in case expressions!
#include "ghc_boot_platform.h"
/* This macro indicates that the target OS supports ELF-like shared libraries */
-#if linux_TARGET_OS || freebsd_TARGET_OS
+#if linux_TARGET_OS || freebsd_TARGET_OS || openbsd_TARGET_OS
#define elf_OBJ_FORMAT 1
#endif
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 08d568fa6b..464aa28350 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1538,7 +1538,7 @@ linkBinary dflags o_files dep_packages = do
let
thread_opts | WayThreaded `elem` ways = [
-#if !defined(mingw32_TARGET_OS) && !defined(freebsd_TARGET_OS) && !defined(haiku_TARGET_OS)
+#if !defined(mingw32_TARGET_OS) && !defined(freebsd_TARGET_OS) && !defined(openbsd_TARGET_OS) && !defined(haiku_TARGET_OS)
"-lpthread"
#endif
#if defined(osf3_TARGET_OS)
diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs
index a8e35516ad..52a86948e4 100644
--- a/compiler/main/StaticFlags.hs
+++ b/compiler/main/StaticFlags.hs
@@ -413,6 +413,9 @@ way_details =
-- the problems are our fault or theirs, but it seems that using the
-- alternative 1:1 threading library libthr works around it:
"-optl-lthr"
+#elif defined(openbsd_TARGET_OS)
+ "-optc-pthread"
+ , "-optl-pthread"
#elif defined(solaris2_TARGET_OS)
"-optl-lrt"
#endif
@@ -428,6 +431,10 @@ way_details =
-- with -fPIC. Labels not in the current package are assumed to be in a DLL
-- different from the current one.
, "-fPIC"
+#elif defined(openbsd_TARGET_OS)
+ -- Without this, linking the shared libHSffi fails because
+ -- it uses pthread mutexes.
+ , "-optl-pthread"
#endif
],
diff --git a/compiler/nativeGen/Platform.hs b/compiler/nativeGen/Platform.hs
index afbf0b2ae2..6c6b124a15 100644
--- a/compiler/nativeGen/Platform.hs
+++ b/compiler/nativeGen/Platform.hs
@@ -49,6 +49,7 @@ data OS
| OSSolaris
| OSMinGW32
| OSFreeBSD
+ | OSOpenBSD
deriving (Show, Eq)
@@ -56,6 +57,7 @@ data OS
osElfTarget :: OS -> Bool
osElfTarget OSLinux = True
osElfTarget OSFreeBSD = True
+osElfTarget OSOpenBSD = True
osElfTarget _ = False
-- | This is the target platform as far as the #ifdefs are concerned.
@@ -96,6 +98,8 @@ defaultTargetOS = OSSolaris
defaultTargetOS = OSMinGW32
#elif freebsd_TARGET_OS
defaultTargetOS = OSFreeBSD
+#elif openbsd_TARGET_OS
+defaultTargetOS = OSOpenBSD
#else
defaultTargetOS = OSUnknown
#endif