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) { if (symb->getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION) {
Result = SymbolRef::ST_Function; Result = SymbolRef::ST_Function;
} else { } else {
char Type; uint32_t Characteristics = 0;
if (error_code ec = getSymbolNMTypeChar(Symb, Type)) if (symb->SectionNumber > 0) {
return ec; const coff_section *Section = NULL;
if (Type == 'r' || Type == 'R') { if (error_code ec = getSection(symb->SectionNumber, Section))
Result = SymbolRef::ST_Data; 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; return object_error::success;