[m-rev.] for review: Pass compiler flags to build bdwgc for musl.

Peter Wang novalazy at gmail.com
Thu Sep 21 14:43:35 AEST 2017


The version of bdwgc we have now works with musl libc to some degree.
I am waiting for the next release for bdwgc before upgrading our copy;
that will fix parallel marking and possibly other problems.

configure.ac:
Mmake.common.in:
    Check for functions getcontext and dl_iterate_phdr.

    Add -DNO_GETCONTEXT to BOEHM_CFLAGS if getcontext does not exist.

    Add -DHAVE_DL_ITERATE_PHDR to BOEHM_CFLAGS if dl_iterate_phdr does
    exist.
---
 Mmake.common.in |  4 +++-
 configure.ac    | 19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/Mmake.common.in b/Mmake.common.in
index 1472d17dd..dcc92ea64 100644
--- a/Mmake.common.in
+++ b/Mmake.common.in
@@ -171,7 +171,9 @@ GRADESTRING = $(shell $(SCRIPTS_DIR)/canonical_grade $(ALL_GRADEFLAGS))
 BOEHM_CFLAGS = @ENABLE_BOEHM_LARGE_CONFIG@ \
 	@ENABLE_BOEHM_USE_MMAP@ \
 	@ENABLE_BOEHM_USE_MUNMAP@ \
-	@ENABLE_BOEHM_XOPEN_SOURCE@
+	@ENABLE_BOEHM_XOPEN_SOURCE@ \
+	@BOEHM_NO_GETCONTEXT@ \
+	@BOEHM_HAVE_DL_ITERATE_PTR@
 
 # Additional options to pass to the C compiler when building Boehm-GC for
 # threads.
diff --git a/configure.ac b/configure.ac
index 4e470bc38..48b3decef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1373,7 +1373,7 @@ mercury_check_for_functions \
         access sleep opendir readdir closedir mkdir symlink readlink \
         gettimeofday setenv putenv _putenv posix_spawn sched_setaffinity \
         sched_getaffinity sched_getcpu sched_yield mkstemp mkdtemp \
-        setrlimit fma
+        setrlimit fma getcontext dl_iterate_phdr
 
 mercury_check_for_stdio_functions \
         snprintf _snprintf vsnprintf _vsnprintf
@@ -3321,6 +3321,23 @@ fi
 
 #-----------------------------------------------------------------------------#
 
+# It is necessary to pass -DNO_GETCONTEXT and -DHAVE_DL_ITERATE_PHDR when
+# building Boehm GC with musl libc.
+
+case $ac_cv_func_getcontext in
+    yes) BOEHM_NO_GETCONTEXT= ;;
+    no)  BOEHM_NO_GETCONTEXT="-DNO_GETCONTEXT" ;;
+esac
+AC_SUBST(BOEHM_NO_GETCONTEXT)
+
+case $ac_cv_func_dl_iterate_phdr in
+    yes) BOEHM_HAVE_DL_ITERATE_PTR="-DHAVE_DL_ITERATE_PHDR" ;;
+    no)  BOEHM_HAVE_DL_ITERATE_PTR= ;;
+esac
+AC_SUBST(BOEHM_HAVE_DL_ITERATE_PTR)
+
+#-----------------------------------------------------------------------------#
+
 # On some systems a prefix is attached to exported symbols. We need to account
 # for this when checking object files for namespace cleanliness.
 
-- 
2.14.1



More information about the reviews mailing list