Skip to content

Commit a5db0d3

Browse files
committed
Apply symbols and types to TMS320C6x ELFs
1 parent 086a7ba commit a5db0d3

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

view/elf/elfview.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,8 +1338,16 @@ bool ElfView::Init()
13381338
DefineElfSymbol(FunctionSymbol, entry->name, entry->value, false, entry->binding);
13391339
break;
13401340
case ELF_STT_FUNC:
1341-
DefineElfSymbol(FunctionSymbol, entry->name, entry->value, false, entry->binding);
1342-
break;
1341+
{
1342+
auto symbolType = FunctionSymbol;
1343+
if (m_plat && m_plat->GetName() == "tms320c6x" &&
1344+
(entry->name.find('$') != std::string::npos || entry->name == "LOOP")) {
1345+
// TMS320C6x ELFs use ELF_STT_FUNC *$* and LOOP symbols for labeling blocks
1346+
symbolType = LocalLabelSymbol;
1347+
}
1348+
DefineElfSymbol(symbolType, entry->name, entry->value, false, entry->binding);
1349+
break;
1350+
}
13431351
case ELF_STT_TLS:
13441352
/* - only create Binja symbols for .symtab (not .dynsym) symbols
13451353
- ignore mapping symbols, all is assumed data
@@ -2617,9 +2625,9 @@ void ElfView::DefineElfSymbol(BNSymbolType type, const string& incomingName, uin
26172625
}
26182626
}
26192627

2620-
if (!typeRef && m_arch && m_arch->GetName() == "hexagon")
2628+
if (!typeRef && m_arch && (m_arch->GetName() == "hexagon" || m_arch->GetName() == "tms320c6x"))
26212629
{
2622-
// Apply platform types for statically linked Hexagon binaries
2630+
// Apply platform types for statically linked Hexagon and TMS320C6x binaries
26232631
typeRef = GetDefaultPlatform()->GetFunctionByName(rawName);
26242632
}
26252633

0 commit comments

Comments
 (0)