[llvm] r340703 - [ORC] Do not include non-global symbols in getObjectSymbolFlags.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 26 09:46:02 PDT 2018
Author: lhames
Date: Sun Aug 26 09:46:02 2018
New Revision: 340703
URL: http://llvm.org/viewvc/llvm-project?rev=340703&view=rev
Log:
[ORC] Do not include non-global symbols in getObjectSymbolFlags.
Private symbols are not visible outside the object file, and so not defined by
the object file from ORC's perspective.
No test case yet. Ideally this would be a unit test parsing a checked-in binary,
but I am not aware of any way to reference the LLVM source root from a unit
test.
Modified:
llvm/trunk/lib/ExecutionEngine/Orc/Layer.cpp
Modified: llvm/trunk/lib/ExecutionEngine/Orc/Layer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/Layer.cpp?rev=340703&r1=340702&r2=340703&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/Layer.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/Layer.cpp Sun Aug 26 09:46:02 2018
@@ -115,17 +115,22 @@ Expected<SymbolFlagsMap> getObjectSymbol
SymbolFlagsMap SymbolFlags;
for (auto &Sym : (*Obj)->symbols()) {
- if (!(Sym.getFlags() & object::BasicSymbolRef::SF_Undefined) &&
- (Sym.getFlags() & object::BasicSymbolRef::SF_Exported)) {
- auto Name = Sym.getName();
- if (!Name)
- return Name.takeError();
- auto InternedName = ES.getSymbolStringPool().intern(*Name);
- auto SymFlags = JITSymbolFlags::fromObjectSymbol(Sym);
- if (!SymFlags)
- return SymFlags.takeError();
- SymbolFlags[InternedName] = std::move(*SymFlags);
- }
+ // Skip symbols not defined in this object file.
+ if (Sym.getFlags() & object::BasicSymbolRef::SF_Undefined)
+ continue;
+
+ // Skip symbols that are not global.
+ if (!(Sym.getFlags() & object::BasicSymbolRef::SF_Global))
+ continue;
+
+ auto Name = Sym.getName();
+ if (!Name)
+ return Name.takeError();
+ auto InternedName = ES.getSymbolStringPool().intern(*Name);
+ auto SymFlags = JITSymbolFlags::fromObjectSymbol(Sym);
+ if (!SymFlags)
+ return SymFlags.takeError();
+ SymbolFlags[InternedName] = std::move(*SymFlags);
}
return SymbolFlags;
More information about the llvm-commits
mailing list