[Git][ghc/ghc][wip/hadrian-windows-bindist-cross] 2 commits: Fix endian

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Thu Aug 24 09:41:05 UTC 2023



Matthew Pickering pushed to branch wip/hadrian-windows-bindist-cross at Glasgow Haskell Compiler / GHC


Commits:
94ec86a6 by Matthew Pickering at 2023-08-24T09:58:47+01:00
Fix endian

- - - - -
37fca247 by Matthew Pickering at 2023-08-24T10:40:37+01:00
Check linker supports --target separately

- - - - -


3 changed files:

- configure.ac
- + m4/fp_prog_ld_target.m4
- utils/ghc-toolchain/src/GHC/Toolchain/PlatformDetails.hs


Changes:

=====================================
configure.ac
=====================================
@@ -493,6 +493,10 @@ FP_PROG_LD_IS_GNU
 FP_PROG_LD_NO_COMPACT_UNWIND
 FP_PROG_LD_FILELIST
 
+FP_PROG_CC_LINKER_TARGET([CONF_GCC_LINKER_OPTS_STAGE1])
+FP_PROG_CC_LINKER_TARGET([CONF_GCC_LINKER_OPTS_STAGE2])
+FP_PROG_CC_LINKER_TARGET([CFLAGS])
+
 dnl ** Which nm to use?
 dnl --------------------------------------------------------------
 FP_FIND_NM


=====================================
m4/fp_prog_ld_target.m4
=====================================
@@ -0,0 +1,23 @@
+# FP_PROG_CC_LINKER_TARGET
+# -------------------
+# Check to see if the C compiler used as a linker supports `--target`
+AC_DEFUN([FP_PROG_CC_LINKER_TARGET],
+[
+AC_MSG_CHECKING([whether $CC used as a linker understands --target],
+[
+    echo 'int foo() { return 0; }' > conftest1.c
+    echo 'int bar() { return 0; }' > conftest2.c
+    ${CC} -c conftest1.c
+    ${CC} -c conftest2.c
+    if "$CC" $$2 --target=$LlvmTarget -o conftest conftest1.o conftest2.o
+    # > /dev/null 2>&1
+    then
+        $2="--target=$LlvmTarget $$2"
+        AC_MSG_RESULT([yes])
+    else
+        fp_cv_cc_linker_target=no
+        AC_MSG_RESULT([no])
+    fi
+    rm -rf conftest*
+])
+])# FP_PROG_CC_LINKER_TARGET


=====================================
utils/ghc-toolchain/src/GHC/Toolchain/PlatformDetails.hs
=====================================
@@ -105,7 +105,7 @@ checkEndianness__BYTE_ORDER__ cc = checking "endianness (__BYTE_ORDER__)" $ do
         [ "#include <sys/param.h>"
         , "#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__"
         , "little"
-        , "#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__"
+        , "#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__"
         , "big"
         , "#else"
         , "unknown"



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3c7c845547395840c0cde43f003062a37fb18c9e...37fca247303df4e095ac55a226a648b9cf8c7669

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3c7c845547395840c0cde43f003062a37fb18c9e...37fca247303df4e095ac55a226a648b9cf8c7669
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230824/17bf0ca3/attachment-0001.html>


More information about the ghc-commits mailing list