aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-23 16:49:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-23 16:49:09 +0200
commit8793941652d6aa1c3d02b2f87f691e6d06254b7d (patch)
treea76b70f6b47d2a7441d22aa236549a02dc493ad0
parent739f68b9e45c925ccc5a28b9b796030272575e2b (diff)
Disable dynamic build system module loading in bootstrap build
We don't really need it so why jump through hoops like trying to portably link -ldl, etc.
-rw-r--r--bootstrap.gmake2
-rwxr-xr-xbootstrap.sh2
-rw-r--r--libbuild2/module.cxx23
3 files changed, 19 insertions, 8 deletions
diff --git a/bootstrap.gmake b/bootstrap.gmake
index 269d749..e4d4b33 100644
--- a/bootstrap.gmake
+++ b/bootstrap.gmake
@@ -43,7 +43,7 @@ ifeq ($(OS),Windows_NT)
chost := i686-w64-mingw32
override LIBS += -limagehlp
else
- override LIBS += -lpthread -ldl
+ override LIBS += -lpthread
endif
# Remove all the built-in rules, enable second expansion, etc.
diff --git a/bootstrap.sh b/bootstrap.sh
index 7d6a895..6eb570f 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -146,4 +146,4 @@ done
# mode since 4.9 doesn't recognize c++1z.
#
set -x
-"$cxx" "-I$libbutl" -I. -DBUILD2_BOOTSTRAP '-DBUILD2_HOST_TRIPLET="'"$host"'"' -std=c++1y "$@" -o build2/b-boot $r -lpthread -ldl
+"$cxx" "-I$libbutl" -I. -DBUILD2_BOOTSTRAP '-DBUILD2_HOST_TRIPLET="'"$host"'"' -std=c++1y "$@" -o build2/b-boot $r -lpthread
diff --git a/libbuild2/module.cxx b/libbuild2/module.cxx
index 1feb121..b06b030 100644
--- a/libbuild2/module.cxx
+++ b/libbuild2/module.cxx
@@ -4,10 +4,12 @@
#include <libbuild2/module.hxx>
-#ifndef _WIN32
-# include <dlfcn.h>
-#else
-# include <libbutl/win32-utility.hxx>
+#ifndef BUILD2_BOOTSTRAP
+# ifndef _WIN32
+# include <dlfcn.h>
+# else
+# include <libbutl/win32-utility.hxx>
+# endif
#endif
#include <libbuild2/file.hxx> // import()
@@ -76,6 +78,15 @@ namespace build2
<< "supported";
}
+ module_load_function* r (nullptr);
+
+ // No dynamic loading of build system modules during bootstrap.
+ //
+#ifdef BUILD2_BOOTSTRAP
+ if (!opt)
+ fail (loc) << "unknown build system module " << mod <<
+ info << "running bootstrap build system";
+#else
path lib;
#if 0
@@ -133,8 +144,6 @@ namespace build2
// Note that we don't unload our modules since it's not clear what would
// the benefit be.
//
- module_load_function* r (nullptr);
-
#ifndef _WIN32
// Use RTLD_NOW instead of RTLD_LAZY to both speed things up (we are going
// to use this module now) and to detect any symbol mismatches.
@@ -167,6 +176,8 @@ namespace build2
<< " (" << lib << "): " << win32::last_error_msg ();
#endif
+#endif // BUILD2_BOOTSTRAP
+
return r;
}