-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[lldb][LoongArch] Preserve temporary symbols starting with .L
in lldb symbol table
#158551
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
base: main
Are you sure you want to change the base?
Conversation
…db 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 ```
@llvm/pr-subscribers-backend-loongarch @llvm/pr-subscribers-lldb Author: ZhaoQi (zhaoqi5) ChangesLoongArch64 always uses symbols for relocations, so temporary symbols starting with ".L" should be preserved so that relocations in After this commit, three tests passed:
Full diff: https://github.com/llvm/llvm-project/pull/158551.diff 1 Files Affected:
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 931baf5927a04..0f8bc5fc93e07 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2119,8 +2119,12 @@ ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id,
// generated local labels used for internal purposes (e.g. debugging,
// optimization) and are not relevant for symbol resolution or external
// linkage.
- if (llvm::StringRef(symbol_name).starts_with(".L"))
- continue;
+ // LoongArch64 always uses symbols for relocations, so temporary symbols
+ // starting with ".L" should be preserved.
+ if (arch.GetMachine() != llvm::Triple::loongarch64) {
+ if (llvm::StringRef(symbol_name).starts_with(".L"))
+ continue;
+ }
// No need to add non-section symbols that have no names
if (symbol.getType() != STT_SECTION &&
(symbol_name == nullptr || symbol_name[0] == '\0'))
|
Co-authored-by: Lu Weining <[email protected]>
✅ With the latest revision this PR passed the C/C++ code formatter. |
cc @barsolo2000 |
I assume this is fallout from https://discourse.llvm.org/t/rfc-should-we-omit-local-symbols-in-elf-files-from-the-lldb-symbol-table/87384. Which I have no context for but I'll add some of those folks on review. |
I am not familiar with lldb. When RISC-V and LoongArch linker relaxation is enabled for assemblers, there are typically a lot of |
There are If these symbols are omitted from symbol table, lldb will fail to analyze the symbols info and fix the relocations in |
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: