Skip to content

Commit d68a447

Browse files
committed
[TMS320C6x] Add block label symbols
1 parent 29daf96 commit d68a447

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

view/elf/elfview.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,11 +1338,15 @@ bool ElfView::Init()
13381338
DefineElfSymbol(FunctionSymbol, entry->name, entry->value, false, entry->binding);
13391339
break;
13401340
case ELF_STT_FUNC:
1341-
if (!m_plat || m_plat->GetName() != "tms320c6x" || entry->name.find('$') == std::string::npos) {
1342-
// TMS320C6x ELFs contain function symbols for labeling blocks that aren't actually functions
1343-
DefineElfSymbol(FunctionSymbol, entry->name, entry->value, false, entry->binding);
1341+
{
1342+
auto symbolType = FunctionSymbol;
1343+
if (m_plat && m_plat->GetName() == "tms320c6x" && entry->name.find('$') != std::string::npos) {
1344+
// TMS320C6x ELFs use ELF_STT_FUNC symbols for labeling blocks
1345+
symbolType = LocalLabelSymbol;
1346+
}
1347+
DefineElfSymbol(symbolType, entry->name, entry->value, false, entry->binding);
1348+
break;
13441349
}
1345-
break;
13461350
case ELF_STT_TLS:
13471351
/* - only create Binja symbols for .symtab (not .dynsym) symbols
13481352
- ignore mapping symbols, all is assumed data
@@ -2620,9 +2624,9 @@ void ElfView::DefineElfSymbol(BNSymbolType type, const string& incomingName, uin
26202624
}
26212625
}
26222626

2623-
if (!typeRef && m_arch && m_arch->GetName() == "hexagon")
2627+
if (!typeRef && m_arch && (m_arch->GetName() == "hexagon" || m_arch->GetName() == "tms320c6x"))
26242628
{
2625-
// Apply platform types for statically linked Hexagon binaries
2629+
// Apply platform types for statically linked Hexagon and TMS320C6x binaries
26262630
typeRef = GetDefaultPlatform()->GetFunctionByName(rawName);
26272631
}
26282632

0 commit comments

Comments
 (0)