mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-16 14:26:17 +00:00
move getSymbolNMTypeChar to the one program that needs it: nm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193933 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -207,74 +207,6 @@ error_code COFFObjectFile::getSymbolSize(DataRefImpl Symb,
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
error_code COFFObjectFile::getSymbolNMTypeChar(DataRefImpl Symb,
|
||||
char &Result) const {
|
||||
const coff_symbol *symb = toSymb(Symb);
|
||||
StringRef name;
|
||||
if (error_code ec = getSymbolName(Symb, name))
|
||||
return ec;
|
||||
char ret = StringSwitch<char>(name)
|
||||
.StartsWith(".debug", 'N')
|
||||
.StartsWith(".sxdata", 'N')
|
||||
.Default('?');
|
||||
|
||||
if (ret != '?') {
|
||||
Result = ret;
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
switch (symb->SectionNumber) {
|
||||
case COFF::IMAGE_SYM_UNDEFINED:
|
||||
// Check storage classes.
|
||||
if (symb->StorageClass == COFF::IMAGE_SYM_CLASS_WEAK_EXTERNAL) {
|
||||
Result = 'w';
|
||||
return object_error::success; // Don't do ::toupper.
|
||||
} else if (symb->Value != 0) // Check for common symbols.
|
||||
ret = 'c';
|
||||
else
|
||||
ret = 'u';
|
||||
break;
|
||||
case COFF::IMAGE_SYM_ABSOLUTE:
|
||||
ret = 'a';
|
||||
break;
|
||||
case COFF::IMAGE_SYM_DEBUG:
|
||||
ret = 'n';
|
||||
break;
|
||||
default:
|
||||
// Check section type.
|
||||
if (Characteristics & COFF::IMAGE_SCN_CNT_CODE)
|
||||
ret = 't';
|
||||
else if ( Characteristics & COFF::IMAGE_SCN_MEM_READ
|
||||
&& ~Characteristics & COFF::IMAGE_SCN_MEM_WRITE) // Read only.
|
||||
ret = 'r';
|
||||
else if (Characteristics & COFF::IMAGE_SCN_CNT_INITIALIZED_DATA)
|
||||
ret = 'd';
|
||||
else if (Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA)
|
||||
ret = 'b';
|
||||
else if (Characteristics & COFF::IMAGE_SCN_LNK_INFO)
|
||||
ret = 'i';
|
||||
|
||||
// Check for section symbol.
|
||||
else if ( symb->StorageClass == COFF::IMAGE_SYM_CLASS_STATIC
|
||||
&& symb->Value == 0)
|
||||
ret = 's';
|
||||
}
|
||||
|
||||
if (symb->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL)
|
||||
ret = ::toupper(static_cast<unsigned char>(ret));
|
||||
|
||||
Result = ret;
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
error_code COFFObjectFile::getSymbolSection(DataRefImpl Symb,
|
||||
section_iterator &Result) const {
|
||||
const coff_symbol *symb = toSymb(Symb);
|
||||
|
Reference in New Issue
Block a user