-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[LLDB] Omit loading local symbols in LLDB symbol table #154809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
f378e6a
b88812a
9262c0f
d06d408
6d5c05a
e6bf2f1
58e803e
0627882
d75bbbd
315266d
b97b006
bd6f552
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2037,6 +2037,18 @@ static char FindArmAarch64MappingSymbol(const char *symbol_name) { | |
| return '\0'; | ||
| } | ||
|
|
||
| static char FindRISCVMappingSymbol(const char *symbol_name) { | ||
| if (!symbol_name) | ||
| return '\0'; | ||
|
|
||
| if (symbol_name[0] == '$' && | ||
| (symbol_name[1] == 'd' || symbol_name[1] == 'x') && | ||
| symbol_name[2] == '\0') { | ||
| return symbol_name[1]; | ||
| } | ||
| return '\0'; | ||
| } | ||
|
|
||
| #define STO_MIPS_ISA (3 << 6) | ||
| #define STO_MICROMIPS (2 << 6) | ||
| #define IS_MICROMIPS(ST_OTHER) (((ST_OTHER)&STO_MIPS_ISA) == STO_MICROMIPS) | ||
|
|
@@ -2102,6 +2114,12 @@ ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, | |
| if (!symbol_name) | ||
| symbol_name = ""; | ||
|
|
||
| // Skip local symbols starting with ".L" because these are compiler | ||
| // generated local labels used for internal purposes (e.g. debugging, | ||
| // optimization) and are not relevant for symbol resolution or external | ||
| // linkage in RISC-V binaries. | ||
barsolo2000 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (symbol_name[0] == '.' && symbol_name[1] == 'L') | ||
barsolo2000 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
barsolo2000 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| continue; | ||
| // No need to add non-section symbols that have no names | ||
| if (symbol.getType() != STT_SECTION && | ||
| (symbol_name == nullptr || symbol_name[0] == '\0')) | ||
|
|
@@ -2190,9 +2208,9 @@ ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, | |
|
|
||
| int64_t symbol_value_offset = 0; | ||
| uint32_t additional_flags = 0; | ||
|
|
||
| llvm::Triple::ArchType arch_machine = arch.GetMachine(); | ||
barsolo2000 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (arch.IsValid()) { | ||
| if (arch.GetMachine() == llvm::Triple::arm) { | ||
| if (arch_machine == llvm::Triple::arm) { | ||
| if (symbol.getBinding() == STB_LOCAL) { | ||
| char mapping_symbol = FindArmAarch64MappingSymbol(symbol_name); | ||
| if (symbol_type == eSymbolTypeCode) { | ||
|
|
@@ -2217,7 +2235,7 @@ ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, | |
| if (mapping_symbol) | ||
| continue; | ||
| } | ||
| } else if (arch.GetMachine() == llvm::Triple::aarch64) { | ||
| } else if (arch_machine == llvm::Triple::aarch64) { | ||
| if (symbol.getBinding() == STB_LOCAL) { | ||
| char mapping_symbol = FindArmAarch64MappingSymbol(symbol_name); | ||
| if (symbol_type == eSymbolTypeCode) { | ||
|
|
@@ -2235,9 +2253,30 @@ ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, | |
| if (mapping_symbol) | ||
| continue; | ||
| } | ||
| } else if (arch_machine == llvm::Triple::riscv32 || | ||
barsolo2000 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| arch_machine == llvm::Triple::riscv64 || | ||
| arch_machine == llvm::Triple::riscv32be || | ||
| arch_machine == llvm::Triple::riscv64be) { | ||
| if (symbol.getBinding() == STB_LOCAL) { | ||
| char mapping_symbol = FindRISCVMappingSymbol(symbol_name); | ||
|
||
| if (symbol_type == eSymbolTypeCode) { | ||
| switch (mapping_symbol) { | ||
| case 'x': | ||
| // $x - marks a RISCV instruction sequence | ||
| address_class_map[symbol.st_value] = AddressClass::eCode; | ||
| break; | ||
| case 'd': | ||
barsolo2000 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // $d - marks a RISCV data item sequence | ||
| address_class_map[symbol.st_value] = AddressClass::eData; | ||
| break; | ||
| } | ||
| } | ||
| if (mapping_symbol) | ||
barsolo2000 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| continue; | ||
| } | ||
| } | ||
|
|
||
| if (arch.GetMachine() == llvm::Triple::arm) { | ||
| if (arch_machine == llvm::Triple::arm) { | ||
| if (symbol_type == eSymbolTypeCode) { | ||
| if (symbol.st_value & 1) { | ||
| // Subtracting 1 from the address effectively unsets the low order | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.