mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-23 14:25:07 +00:00
Compute correct symbol sizes for MachO and COFF.
Before this would dump from the symbol start to the end of the section. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240367 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/Object/Archive.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Object/SymbolSize.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
@@ -187,7 +188,14 @@ static void dumpCXXData(const ObjectFile *Obj) {
|
||||
|
||||
uint8_t BytesInAddress = Obj->getBytesInAddress();
|
||||
|
||||
for (const object::SymbolRef &Sym : Obj->symbols()) {
|
||||
ErrorOr<std::vector<std::pair<SymbolRef, uint64_t>>> SymAddrOrErr =
|
||||
object::computeSymbolSizes(*Obj);
|
||||
if (error(SymAddrOrErr.getError()))
|
||||
return;
|
||||
|
||||
for (auto &P : *SymAddrOrErr) {
|
||||
object::SymbolRef Sym = P.first;
|
||||
uint64_t SymSize = P.second;
|
||||
StringRef SymName;
|
||||
if (error(Sym.getName(SymName)))
|
||||
return;
|
||||
@@ -207,7 +215,6 @@ static void dumpCXXData(const ObjectFile *Obj) {
|
||||
uint64_t SymAddress;
|
||||
if (error(Sym.getAddress(SymAddress)))
|
||||
return;
|
||||
uint64_t SymSize = Sym.getSize();
|
||||
uint64_t SecAddress = Sec.getAddress();
|
||||
uint64_t SecSize = Sec.getSize();
|
||||
uint64_t SymOffset = SymAddress - SecAddress;
|
||||
|
Reference in New Issue
Block a user