[commit: ghc] master: Add support for FreeBSD arm (297879a)

git at git.haskell.org git at git.haskell.org
Fri Jun 8 00:12:05 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/297879a78cc6ca4c27afb0cc863c8796b60da6e1/ghc

>---------------------------------------------------------------

commit 297879a78cc6ca4c27afb0cc863c8796b60da6e1
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Thu Jun 7 14:13:04 2018 -0400

    Add support for FreeBSD arm
    
    Test Plan: Tested on armv6, armv7 and aarch64 on FreeBSD 12-CURRENT.
    
    Reviewers: bgamari
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie, erikd, carter
    
    Differential Revision: https://phabricator.haskell.org/D4810


>---------------------------------------------------------------

297879a78cc6ca4c27afb0cc863c8796b60da6e1
 aclocal.m4                            | 16 ++++++++++++++++
 llvm-targets                          |  3 +++
 utils/llvm-targets/gen-data-layout.sh |  3 +++
 3 files changed, 22 insertions(+)

diff --git a/aclocal.m4 b/aclocal.m4
index 1cef842..11c7acd 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -651,6 +651,14 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
         $3="$$3 -D_HPUX_SOURCE"
         $5="$$5 -D_HPUX_SOURCE"
         ;;
+
+    arm*freebsd*)
+        # On arm/freebsd, tell gcc to generate Arm
+        # instructions (ie not Thumb).
+        $2="$$2 -marm"
+        $3="$$3 -Wl,-z,noexecstack"
+        $4="$$4 -z noexecstack"
+        ;;
     arm*linux*)
         # On arm/linux and arm/android, tell gcc to generate Arm
         # instructions (ie not Thumb).
@@ -659,6 +667,10 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
         $4="$$4 -z noexecstack"
         ;;
 
+    aarch64*freebsd*)
+        $3="$$3 -Wl,-z,noexecstack"
+        $4="$$4 -z noexecstack"
+        ;;
     aarch64*linux*)
         $3="$$3 -Wl,-z,noexecstack"
         $4="$$4 -z noexecstack"
@@ -1902,6 +1914,10 @@ case "$1" in
 # converts the canonicalized target into someting llvm can understand
 AC_DEFUN([GHC_LLVM_TARGET], [
   case "$2-$3" in
+    *-freebsd*-gnueabihf)
+      llvm_target_vendor="unknown"
+      llvm_target_os="freebsd-gnueabihf"
+      ;;
     hardfloat-*eabi)
       llvm_target_vendor="unknown"
       llvm_target_os="$3""hf"
diff --git a/llvm-targets b/llvm-targets
index 6da97ee..a0277f3 100644
--- a/llvm-targets
+++ b/llvm-targets
@@ -23,4 +23,7 @@
 ,("aarch64-apple-ios", ("e-m:o-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
 ,("i386-apple-ios", ("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128", "yonah", ""))
 ,("x86_64-apple-ios", ("e-m:o-i64:64-f80:128-n8:16:32:64-S128", "core2", ""))
+,("aarch64-unknown-freebsd", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
+,("armv6-unknown-freebsd-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm1176jzf-s", "+strict-align"))
+,("armv7-unknown-freebsd-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+strict-align"))
 ]
diff --git a/utils/llvm-targets/gen-data-layout.sh b/utils/llvm-targets/gen-data-layout.sh
index 7a65a3e..7b5f9e3 100755
--- a/utils/llvm-targets/gen-data-layout.sh
+++ b/utils/llvm-targets/gen-data-layout.sh
@@ -39,6 +39,9 @@ TARGETS=(
     "i386-apple-darwin" "x86_64-apple-darwin"
     # iOS
     "armv7-apple-ios arm64-apple-ios" "i386-apple-ios x86_64-apple-ios"
+
+    # FreeBSD ARM
+    "aarch64-unknown-freebsd" "armv6-unknown-freebsd-gnueabihf" "armv7-unknown-freebsd-gnueabihf"
 )
 
 # given the call to clang -c11 that clang --target -v generates,



More information about the ghc-commits mailing list