[RuntimeDyld] Replace manual flag checks with JITSymbolFlags::fromObjectSymbol.

llvm-svn: 277943
This commit is contained in:
Lang Hames 2016-08-07 00:18:14 +00:00
parent 73976f622d
commit 00769a0904
1 changed files with 5 additions and 13 deletions

View File

@ -224,11 +224,7 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
return NameOrErr.takeError();
// Compute JIT symbol flags.
JITSymbolFlags RTDyldSymFlags = JITSymbolFlags::None;
if (Flags & SymbolRef::SF_Weak)
RTDyldSymFlags |= JITSymbolFlags::Weak;
if (Flags & SymbolRef::SF_Exported)
RTDyldSymFlags |= JITSymbolFlags::Exported;
JITSymbolFlags JITSymFlags = JITSymbolFlags::fromObjectSymbol(*I);
if (Flags & SymbolRef::SF_Absolute &&
SymType != object::SymbolRef::ST_File) {
@ -245,7 +241,7 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
<< format("%p", (uintptr_t)Addr)
<< " flags: " << Flags << "\n");
GlobalSymbolTable[Name] =
SymbolTableEntry(SectionID, Addr, RTDyldSymFlags);
SymbolTableEntry(SectionID, Addr, JITSymFlags);
} else if (SymType == object::SymbolRef::ST_Function ||
SymType == object::SymbolRef::ST_Data ||
SymType == object::SymbolRef::ST_Unknown ||
@ -278,7 +274,7 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
<< format("%p", (uintptr_t)SectOffset)
<< " flags: " << Flags << "\n");
GlobalSymbolTable[Name] =
SymbolTableEntry(SectionID, SectOffset, RTDyldSymFlags);
SymbolTableEntry(SectionID, SectOffset, JITSymFlags);
}
}
}
@ -635,15 +631,11 @@ Error RuntimeDyldImpl::emitCommonSymbols(const ObjectFile &Obj,
Offset += AlignOffset;
}
uint32_t Flags = Sym.getFlags();
JITSymbolFlags RTDyldSymFlags = JITSymbolFlags::None;
if (Flags & SymbolRef::SF_Weak)
RTDyldSymFlags |= JITSymbolFlags::Weak;
if (Flags & SymbolRef::SF_Exported)
RTDyldSymFlags |= JITSymbolFlags::Exported;
JITSymbolFlags JITSymFlags = JITSymbolFlags::fromObjectSymbol(Sym);
DEBUG(dbgs() << "Allocating common symbol " << Name << " address "
<< format("%p", Addr) << "\n");
GlobalSymbolTable[Name] =
SymbolTableEntry(SectionID, Offset, RTDyldSymFlags);
SymbolTableEntry(SectionID, Offset, JITSymFlags);
Offset += Size;
Addr += Size;
}