mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 21:24:00 +00:00
Make computeSymbolSizes never fail.
On ELF that was already the case since getting the size of a symbol never fails. On MachO and COFF we could fail trying to get the section of a symbol. But we don't really need the section, just the section number to know if two symbols are in the same section or not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240580 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -258,6 +258,11 @@ COFFObjectFile::getSymbolSection(DataRefImpl Ref,
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
unsigned COFFObjectFile::getSymbolSectionID(SymbolRef Sym) const {
|
||||
COFFSymbolRef Symb = getCOFFSymbol(Sym.getRawDataRefImpl());
|
||||
return Symb.getSectionNumber();
|
||||
}
|
||||
|
||||
void COFFObjectFile::moveSectionNext(DataRefImpl &Ref) const {
|
||||
const coff_section *Sec = toSec(Ref);
|
||||
Sec += 1;
|
||||
@ -311,6 +316,13 @@ bool COFFObjectFile::isSectionBSS(DataRefImpl Ref) const {
|
||||
return (Sec->Characteristics & BssFlags) == BssFlags;
|
||||
}
|
||||
|
||||
unsigned COFFObjectFile::getSectionID(SectionRef Sec) const {
|
||||
uintptr_t Offset =
|
||||
uintptr_t(Sec.getRawDataRefImpl().p) - uintptr_t(SectionTable);
|
||||
assert((Offset % sizeof(coff_section)) == 0);
|
||||
return (Offset / sizeof(coff_section)) + 1;
|
||||
}
|
||||
|
||||
bool COFFObjectFile::isSectionVirtual(DataRefImpl Ref) const {
|
||||
const coff_section *Sec = toSec(Ref);
|
||||
// In COFF, a virtual section won't have any in-file
|
||||
|
Reference in New Issue
Block a user