Skip to content

Commit 28f926a

Browse files
committed
[cxxmodules] Testing! Kill preloading allmodules
I'm hoping that this works as we're resolving our undefined symbols by autoloading libraries (which is stronger than pcm!)
1 parent ec4c3ff commit 28f926a

File tree

1 file changed

+3
-43
lines changed

1 file changed

+3
-43
lines changed

core/metacling/src/TCling.cxx

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,47 +1288,6 @@ TCling::TCling(const char *name, const char *title, const char* const argv[])
12881288
fMetaProcessor = new cling::MetaProcessor(*fInterpreter, fMPOuts);
12891289

12901290
if (fInterpreter->getCI()->getLangOpts().Modules) {
1291-
// Setup core C++ modules if we have any to setup.
1292-
1293-
// Load libc and stl first.
1294-
LoadModules({"libc", "stl"}, *fInterpreter);
1295-
1296-
// Load core modules
1297-
// This should be vector in order to be able to pass it to LoadModules
1298-
std::vector<std::string> CoreModules = {"ROOT_Foundation_C","ROOT_Config",
1299-
"ROOT_Foundation_Stage1_NoRTTI", "Core", "RIO"};
1300-
// These modules contain global variables which conflict with users' code such as "PI".
1301-
// FIXME: Reducing those will let us be less dependent on rootmap files
1302-
static constexpr std::array<const char*, 4> ExcludeModules =
1303-
{ { "Rtools", "RSQLite", "RInterface", "RMVA"} };
1304-
1305-
LoadModules(CoreModules, *fInterpreter);
1306-
1307-
// Take this branch only from ROOT because we don't need to preload modules in rootcling
1308-
if (!fromRootCling) {
1309-
// Dynamically get all the modules and load them if they are not in core modules
1310-
clang::CompilerInstance &CI = *fInterpreter->getCI();
1311-
clang::ModuleMap &moduleMap = CI.getPreprocessor().getHeaderSearchInfo().getModuleMap();
1312-
clang::Preprocessor &PP = CI.getPreprocessor();
1313-
std::vector<std::string> ModulesPreloaded;
1314-
1315-
for (auto I = moduleMap.module_begin(), E = moduleMap.module_end(); I != E; ++I) {
1316-
clang::Module *M = I->second;
1317-
assert(M);
1318-
1319-
std::string ModuleName = GetModuleNameAsString(M, PP);
1320-
if (!ModuleName.empty() &&
1321-
std::find(CoreModules.begin(), CoreModules.end(), ModuleName) == CoreModules.end()
1322-
&& std::find(ExcludeModules.begin(), ExcludeModules.end(), ModuleName) == ExcludeModules.end()) {
1323-
if (M->IsSystem && !M->IsMissingRequirement)
1324-
LoadModule(ModuleName, *fInterpreter);
1325-
else if (!M->IsSystem && !M->IsMissingRequirement)
1326-
ModulesPreloaded.push_back(ModuleName);
1327-
}
1328-
}
1329-
LoadModules(ModulesPreloaded, *fInterpreter);
1330-
}
1331-
13321291
// Check that the gROOT macro was exported by any core module.
13331292
assert(fInterpreter->getMacro("gROOT") && "Couldn't load gROOT macro?");
13341293

@@ -5935,8 +5894,9 @@ static bool LookupBloomFilter(llvm::object::ObjectFile *soFile, uint32_t hash) {
59355894

59365895
StringRef contents = GetGnuHashSection(soFile);
59375896
if (contents.size() < 16)
5938-
// We need to search if the library doesn't have .gnu.hash section!
5939-
return true;
5897+
// Don't search symbols in a library which doesn't contain .gnu.hash section. ROOT is always generating
5898+
// libraries with .gnu.hash, so this library is likely a system library.
5899+
return false;
59405900
const char* hashContent = contents.data();
59415901

59425902
// See https://flapenguin.me/2017/05/10/elf-lookup-dt-gnu-hash/ for .gnu.hash table layout.

0 commit comments

Comments
 (0)