[Lldb-commits] [lldb] [lldb] Fix section offset of synthesized entry point symbol (PR #190348)

Sergei Barannikov via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 3 07:22:59 PDT 2026


https://github.com/s-barannikov created https://github.com/llvm/llvm-project/pull/190348

In the non-ARM case, the offset was left unset, so the symbol synthesized for the entry point pointed to the start of the containing section.
As a drive-by change, simplify offset adjustment in ARM case.


>From 1e64368d920ea928e426e00c7c9f04cc0c46eac5 Mon Sep 17 00:00:00 2001
From: Sergei Barannikov <barannikov88 at gmail.com>
Date: Fri, 3 Apr 2026 17:16:23 +0300
Subject: [PATCH] [lldb] Fix section offset of synthesized entry point symbol

The offset was left unset in non-ARM case.
---
 lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 7cc782cf2823e..ffb3f915980ba 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -3333,7 +3333,7 @@ void ObjectFileELF::ParseSymtab(Symtab &lldb_symtab) {
           /*is_trampoline=*/false,
           /*is_artificial=*/true,
           /*section_sp=*/section_sp,
-          /*offset=*/0,
+          /*offset=*/entry_point_addr.GetOffset(),
           /*size=*/0, // FDE can span multiple symbols so don't use its size.
           /*size_is_valid=*/false,
           /*contains_linker_annotations=*/false,
@@ -3344,8 +3344,8 @@ void ObjectFileELF::ParseSymtab(Symtab &lldb_symtab) {
       // address.
       if (arch.GetMachine() == llvm::Triple::arm &&
           (entry_point_file_addr & 1)) {
-        symbol.GetAddressRef().SetOffset(entry_point_addr.GetOffset() ^ 1);
-        m_address_class_map[entry_point_file_addr ^ 1] =
+        symbol.GetAddressRef().Slide(-1);
+        m_address_class_map[entry_point_file_addr - 1] =
             AddressClass::eCodeAlternateISA;
       } else {
         m_address_class_map[entry_point_file_addr] = AddressClass::eCode;



More information about the lldb-commits mailing list