summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-11-07 05:06:39 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-07 16:26:10 -0500
commit184f6bc6f17360421eb101c9deffb7f701072885 (patch)
tree09f35b655ec15d127166d2ac860a406a6be91a11 /m4
parent3d7e3d911c3dbfc114b7af33ad4b28cd2af29bbc (diff)
downloadhaskell-184f6bc6f17360421eb101c9deffb7f701072885.tar.gz
Factor out unregisterised and tables next to code m4 macros
These will be useful for upcoming RTS configure script.
Diffstat (limited to 'm4')
-rw-r--r--m4/ghc_tables_next_to_code.m441
-rw-r--r--m4/ghc_unregisterised.m426
2 files changed, 67 insertions, 0 deletions
diff --git a/m4/ghc_tables_next_to_code.m4 b/m4/ghc_tables_next_to_code.m4
new file mode 100644
index 0000000000..0f262bba57
--- /dev/null
+++ b/m4/ghc_tables_next_to_code.m4
@@ -0,0 +1,41 @@
+# GHC_TABLES_NEXT_TO_CODE
+# --------------------------------
+# Do a build with tables next to code?
+#
+# Whether the target architecture supports placing info tables
+# directly before the entry code (see TABLES_NEXT_TO_CODE in the RTS).
+# Whether we actually compile for TABLES_NEXT_TO_CODE depends on
+# whether we're building unregisterised code or not, which may be
+# decided by options to the compiler later.
+#
+# See https://gitlab.haskell.org/ghc/ghc/wikis/commentary/rts/storage/heap-objects#tables_next_to_code
+#
+AC_DEFUN([GHC_TABLES_NEXT_TO_CODE],
+[
+ AC_REQUIRE([GHC_UNREGISTERISED])
+ AC_MSG_CHECKING(whether target supports tables next to code)
+ case "$Unregisterised" in
+ NO)
+ case "$TargetArch" in
+ ia64|powerpc64|powerpc64le|s390x)
+ TablesNextToCodeDefault=NO
+ AC_MSG_RESULT([no])
+ ;;
+ *)
+ TablesNextToCodeDefault=YES
+ AC_MSG_RESULT([yes])
+ ;;
+ esac
+ ;;
+ YES)
+ TablesNextToCodeDefault=NO
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+ FP_DEFAULT_CHOICE_OVERRIDE_CHECK(
+ [tables-next-to-code],
+ [tables next to code],
+ [tables apart from code],
+ [TablesNextToCode],
+ [Build a tool chain with info tables laid out next to code (enabled by default when using the registerised ABI, on platforms that support it)])
+])
diff --git a/m4/ghc_unregisterised.m4 b/m4/ghc_unregisterised.m4
new file mode 100644
index 0000000000..ca3beb8733
--- /dev/null
+++ b/m4/ghc_unregisterised.m4
@@ -0,0 +1,26 @@
+# GHC_UNREGISTERISED
+# --------------------------------
+# Do an unregisterised build?
+AC_DEFUN([GHC_UNREGISTERISED],
+[
+ AC_MSG_CHECKING(whether target supports a registerised ABI)
+ case "$TargetArch" in
+ i386|x86_64|powerpc|powerpc64|powerpc64le|s390x|arm|aarch64|riscv64)
+ UnregisterisedDefault=NO
+ AC_MSG_RESULT([yes])
+ ;;
+ *)
+ UnregisterisedDefault=YES
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+ FP_DEFAULT_CHOICE_OVERRIDE_CHECK(
+ [unregisterised],
+ [unregisterised],
+ [registerised],
+ [Unregisterised],
+ [Build a toolchain with the unregisterised ABI (disabled by default on platforms with registerised support)],
+ [NO],
+ [YES],
+ [no])
+])