diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-24 10:20:30 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-24 10:20:30 +0000 |
commit | d7a32ea4b86c04ba0c4736f803527eb393a40867 (patch) | |
tree | 1b09dcd2e51416a33c0b030346842e8ea6dd3e38 /llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | |
parent | 595348228569c587e14bf8cea1c4fdf1b503c104 (diff) | |
download | bcm5719-llvm-d7a32ea4b86c04ba0c4736f803527eb393a40867.tar.gz bcm5719-llvm-d7a32ea4b86c04ba0c4736f803527eb393a40867.zip |
Change how symbol sizes are handled in lib/Object.
COFF and MachO only define symbol sizes for common symbols. Reflect that
in the class hierarchy by having a method for common symbols only in the base
and a general one in ELF.
This avoids the need of using a magic value for the size, which had a few
problems
* Most callers didn't check for it.
* The ones that did could not tell the magic value from a file actually having
that value.
llvm-svn: 240529
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 6d64d683743..22de8c8ba29 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -118,8 +118,8 @@ static std::error_code getOffset(const SymbolRef &Sym, uint64_t &Result) { if (std::error_code EC = Sym.getAddress(Address)) return EC; - if (Address == UnknownAddressOrSize) { - Result = UnknownAddressOrSize; + if (Address == UnknownAddress) { + Result = UnknownAddress; return std::error_code(); } @@ -129,7 +129,7 @@ static std::error_code getOffset(const SymbolRef &Sym, uint64_t &Result) { return EC; if (SecI == Obj->section_end()) { - Result = UnknownAddressOrSize; + Result = UnknownAddress; return std::error_code(); } @@ -387,7 +387,7 @@ void RuntimeDyldImpl::computeTotalAllocSize(const ObjectFile &Obj, uint32_t Flags = I->getFlags(); if (Flags & SymbolRef::SF_Common) { // Add the common symbols to a list. We'll allocate them all below. - uint64_t Size = I->getSize(); + uint64_t Size = I->getCommonSize(); CommonSize += Size; } } @@ -494,7 +494,7 @@ void RuntimeDyldImpl::emitCommonSymbols(const ObjectFile &Obj, } uint32_t Align = Sym.getAlignment(); - uint64_t Size = Sym.getSize(); + uint64_t Size = Sym.getCommonSize(); CommonSize += Align + Size; SymbolsToAllocate.push_back(Sym); @@ -517,7 +517,7 @@ void RuntimeDyldImpl::emitCommonSymbols(const ObjectFile &Obj, for (auto &Sym : SymbolsToAllocate) { uint32_t Align = Sym.getAlignment(); StringRef Name; - uint64_t Size = Sym.getSize(); + uint64_t Size = Sym.getCommonSize(); Check(Sym.getName(Name)); if (Align) { // This symbol has an alignment requirement. |