mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
Add getSymbolAlignment to the ObjectFile interface.
For regular object files this is only meaningful for common symbols. An object file format with direct support for atoms should be able to provide alignment information for all symbols. This replaces getCommonSymbolAlignment and fixes test-common-symbols-alignment.ll on darwin. This also includes a fix to MachOObjectFile::getSymbolFlags. It was marking undefined symbols as common (already tested by existing mcjit tests now that it is used). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180736 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -495,6 +495,19 @@ MachOObjectFile::getSymbolFileOffset(DataRefImpl Symb,
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
error_code MachOObjectFile::getSymbolAlignment(DataRefImpl DRI,
|
||||
uint32_t &Result) const {
|
||||
uint32_t flags;
|
||||
this->getSymbolFlags(DRI, flags);
|
||||
if (flags & SymbolRef::SF_Common) {
|
||||
SymbolTableEntryBase Entry = getSymbolTableEntryBase(this, DRI);
|
||||
Result = 1 << MachO::GET_COMM_ALIGN(Entry.Flags);
|
||||
} else {
|
||||
Result = 0;
|
||||
}
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
error_code MachOObjectFile::getSymbolSize(DataRefImpl DRI,
|
||||
uint64_t &Result) const {
|
||||
uint64_t BeginOffset;
|
||||
@ -609,8 +622,12 @@ error_code MachOObjectFile::getSymbolFlags(DataRefImpl DRI,
|
||||
|
||||
if (MachOType & MachO::NlistMaskExternal) {
|
||||
Result |= SymbolRef::SF_Global;
|
||||
if ((MachOType & MachO::NlistMaskType) == MachO::NListTypeUndefined)
|
||||
Result |= SymbolRef::SF_Common;
|
||||
if ((MachOType & MachO::NlistMaskType) == MachO::NListTypeUndefined) {
|
||||
uint64_t Value;
|
||||
getSymbolAddress(DRI, Value);
|
||||
if (Value)
|
||||
Result |= SymbolRef::SF_Common;
|
||||
}
|
||||
}
|
||||
|
||||
if (MachOFlags & (MachO::NListDescWeakRef | MachO::NListDescWeakDef))
|
||||
|
Reference in New Issue
Block a user