Skip to content

Commit c6679a6

Browse files
committed
[lldb][LoongArch] Preserve temporary symbols starting with .L in lldb symbol table
LoongArch64 always uses symbols for relocations, so temporary symbols starting with ".L" should be preserved so that relocations in `.debug_info` can be fixed correctly. After this commit, three tests passed: ``` lldb-shell :: SymbolFile/DWARF/anon_class_w_and_wo_export_symbols.ll lldb-shell :: SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp lldb-shell :: SymbolFile/DWARF/clang-gmodules-type-lookup.c ```
1 parent c44e015 commit c6679a6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,8 +2119,12 @@ ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id,
21192119
// generated local labels used for internal purposes (e.g. debugging,
21202120
// optimization) and are not relevant for symbol resolution or external
21212121
// linkage.
2122-
if (llvm::StringRef(symbol_name).starts_with(".L"))
2123-
continue;
2122+
// LoongArch64 always uses symbols for relocations, so temporary symbols
2123+
// starting with ".L" should be preserved.
2124+
if (arch.GetMachine() != llvm::Triple::loongarch64) {
2125+
if (llvm::StringRef(symbol_name).starts_with(".L"))
2126+
continue;
2127+
}
21242128
// No need to add non-section symbols that have no names
21252129
if (symbol.getType() != STT_SECTION &&
21262130
(symbol_name == nullptr || symbol_name[0] == '\0'))

0 commit comments

Comments
 (0)