Convert another use of getSymbolNMTypeChar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193932 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2013-11-02 20:10:07 +00:00
parent 1b6c8d1f6c
commit 66b8ec520f

View File

@ -149,12 +149,16 @@ error_code COFFObjectFile::getSymbolType(DataRefImpl Symb,
if (symb->getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION) {
Result = SymbolRef::ST_Function;
} else {
char Type;
if (error_code ec = getSymbolNMTypeChar(Symb, Type))
return ec;
if (Type == 'r' || Type == 'R') {
Result = SymbolRef::ST_Data;
uint32_t Characteristics = 0;
if (symb->SectionNumber > 0) {
const coff_section *Section = NULL;
if (error_code ec = getSection(symb->SectionNumber, Section))
return ec;
Characteristics = Section->Characteristics;
}
if (Characteristics & COFF::IMAGE_SCN_MEM_READ &&
~Characteristics & COFF::IMAGE_SCN_MEM_WRITE) // Read only.
Result = SymbolRef::ST_Data;
}
}
return object_error::success;