Skip to content
Snippets Groups Projects
Commit 350e6df5 authored by Axel Naumann's avatar Axel Naumann
Browse files

Remove erroneous adds (ROOT-8268).

parent ff518af0
No related branches found
No related tags found
No related merge requests found
--- lib/ExecutionEngine/MCJIT/MCJIT.cpp
+++ lib/ExecutionEngine/MCJIT/MCJIT.cpp
@@ -200,6 +200,9 @@
// If the cache did not contain a suitable object, compile the object
if (!ObjectToLoad) {
+
+ OwnedModules.markModuleAsLoaded(M);
+
ObjectToLoad = emitObject(M);
assert(ObjectToLoad && "Compilation did not produce an object.");
}
@@ -218,8 +221,6 @@
Buffers.push_back(std::move(ObjectToLoad));
LoadedObjects.push_back(std::move(*LoadedObject));
-
- OwnedModules.markModuleAsLoaded(M);
}
void MCJIT::finalizeLoadedModules() {
--- lib/ExecutionEngine/MCJIT/MCJIT.h
+++ lib/ExecutionEngine/MCJIT/MCJIT.h
@@ -35,10 +35,10 @@
RuntimeDyld::SymbolInfo findSymbol(const std::string &Name) override;
- // MCJIT doesn't support logical dylibs.
+ // Defer to the client resolver for lookup in logical dylibs.
RuntimeDyld::SymbolInfo
findSymbolInLogicalDylib(const std::string &Name) override {
- return nullptr;
+ return ClientResolver->findSymbolInLogicalDylib(Name);
}
private:
--- lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -160,19 +160,30 @@
// Common symbols requiring allocation, with their sizes and alignments
CommonSymbolList CommonSymbols;
+ // Weak symbols.
+ WeakSymbolList WeakSymbols;
+
// Parse symbols
DEBUG(dbgs() << "Parse symbols:\n");
for (symbol_iterator I = Obj.symbol_begin(), E = Obj.symbol_end(); I != E;
++I) {
uint32_t Flags = I->getFlags();
+ ErrorOr<object::SymbolRef::Type> SymTypeOrErr = I->getType();
+ Check(SymTypeOrErr.getError());
+ object::SymbolRef::Type SymType = *SymTypeOrErr;
+
if (Flags & SymbolRef::SF_Common)
CommonSymbols.push_back(*I);
- else {
- ErrorOr<object::SymbolRef::Type> SymTypeOrErr = I->getType();
- Check(SymTypeOrErr.getError());
- object::SymbolRef::Type SymType = *SymTypeOrErr;
-
+ else if (Flags & SymbolRef::SF_Weak) {
+ // We re-emit functions; processRelocationRef() is not required to
+ // support ST_Function.
+ ErrorOr<section_iterator> SIOrErr = I->getSection();
+ Check(SIOrErr.getError());
+ section_iterator SI = *SIOrErr;
+ assert(SI != Obj.section_end() && "Weak symbol doesn't have section?");
+ WeakSymbols.push_back(std::make_pair(I, SI));
+ } else {
// Get symbol name.
ErrorOr<StringRef> NameOrErr = I->getName();
Check(NameOrErr.getError());
--- lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
+++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
@@ -256,6 +256,10 @@
// Keep a map of common symbols to their info pairs
typedef std::vector<SymbolRef> CommonSymbolList;
+ // A list of weak symbols and their section/offset pairs.
+ typedef std::vector<std::pair<symbol_iterator, section_iterator>>
+ WeakSymbolList;
+
// For each symbol, keep a list of relocations based on it. Anytime
// its address is reassigned (the JIT re-compiled the function, e.g.),
// the relocations get re-resolved.
@@ -358,6 +362,11 @@
/// Dst.
void writeBytesUnaligned(uint64_t Value, uint8_t *Dst, unsigned Size) const;
+ /// \brief Process the weak symbols encountered while loading an object file
+ /// and finalize definitions.
+ void emitWeakSymbols(const ObjectFile &Obj, ObjSectionToIDMap &LocalSections,
+ WeakSymbolList &WeakSymbols);
+
/// \brief Given the common symbols discovered in the object file, emit a
/// new section for them and update the symbol mappings in the object and
/// symbol table.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment