From 9595cceed141c464305ccadd0d8f2976cadef35d Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Tue, 27 Apr 2021 18:45:45 +0200 Subject: [PATCH 1/2] [core] ACLiC: speed up building / loading: When loading an existing ACLiC library, and if we expect it to contain the dependencies (explicit linking), just load it, instead of trying to (re-)determine its dependencies from its undefined symbols: the outcome should be just the library dependencies we expect the library to know already. For the (rare) non-explicit-linking case, continue to find and load all dependent libraries. Way slower, but also way rarer. --- core/base/src/TSystem.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/base/src/TSystem.cxx b/core/base/src/TSystem.cxx index 1017d5af5f9fc..4702ceb5c7c50 100644 --- a/core/base/src/TSystem.cxx +++ b/core/base/src/TSystem.cxx @@ -22,6 +22,7 @@ allows a simple partial implementation for new OS'es. */ #include +#include #include "strlcpy.h" #include "TSystem.h" #include "TApplication.h" @@ -3346,16 +3347,19 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt, if (!f(I->c_str())) break; }; - auto LoadLibrary = [useCxxModules, produceRootmap, ForeachSharedLibDep](const TString &lib) { + + auto LoadLibrary = [linkDepLibraries, useCxxModules, produceRootmap, ForeachSharedLibDep](const TString &lib) { // We have no rootmap files or modules to construct `-l` flags enabling // explicit linking. We have to resolve the dependencies by ourselves // taking the job of the dyld. + // If !linkDepLibraries then the library might not know its dependencies + // and "just load the library" might fail. // FIXME: This is a rare case where we have rootcling running with // modules disabled. Remove this code once we fully switch to modules, // or implement a special flag in rootcling which selective enables // modules for dependent libraries and does not produce a module for // the ACLiC library. - if (useCxxModules && !produceRootmap) { + if (!linkDepLibraries && useCxxModules && !produceRootmap) { std::function LoadLibF = [](const char *dep) { return gInterpreter->Load(dep, /*skipReload*/ true) >= 0; }; @@ -3374,8 +3378,6 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt, if (!keep) k->SetBit(kMustCleanup); fCompiled->Add(k); - gInterpreter->GetSharedLibDeps(library); - return LoadLibrary(library); } else return kTRUE; From ed1001243dba982a3911503e5b019ef512435142 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Tue, 27 Apr 2021 18:48:56 +0200 Subject: [PATCH 2/2] [core] Deprecate !(ACLiC.LinkLibs & 1). Remove ancient macOS case. --- core/base/src/TSystem.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/base/src/TSystem.cxx b/core/base/src/TSystem.cxx index 4702ceb5c7c50..126548438e692 100644 --- a/core/base/src/TSystem.cxx +++ b/core/base/src/TSystem.cxx @@ -3317,15 +3317,17 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt, #endif Bool_t linkDepLibraries = !produceRootmap; if (gEnv) { -#if (defined(R__MACOSX) && !defined(MAC_OS_X_VERSION_10_5)) - Int_t linkLibs = gEnv->GetValue("ACLiC.LinkLibs",2); -#elif defined(R__WIN32) +#if defined(R__WIN32) Int_t linkLibs = gEnv->GetValue("ACLiC.LinkLibs",3); #else Int_t linkLibs = gEnv->GetValue("ACLiC.LinkLibs",1); #endif produceRootmap = linkLibs & 0x2; linkDepLibraries = linkLibs & 0x1; + if (!linkDepLibraries) { + static int onetime = (Warning("ACLiC", "Unsetting `ACLiC.LinkLibs & 1` is deprecated!"), 1); + (void)onetime; + } } // FIXME: Triggers clang false positive warning -Wunused-lambda-capture.