From 8793941652d6aa1c3d02b2f87f691e6d06254b7d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 23 Aug 2019 16:49:09 +0200 Subject: 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. --- bootstrap.gmake | 2 +- bootstrap.sh | 2 +- libbuild2/module.cxx | 23 +++++++++++++++++------ 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 -#ifndef _WIN32 -# include -#else -# include +#ifndef BUILD2_BOOTSTRAP +# ifndef _WIN32 +# include +# else +# include +# endif #endif #include // 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; } -- cgit v1.1