[Lldb-commits] [lldb] [lldb] change .sbss section type to eSectionTypeZeroFill (PR #99044)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 17 18:31:04 PDT 2024


https://github.com/dlav-sc updated https://github.com/llvm/llvm-project/pull/99044

>From 2b62658701e6a2c2cb651dc1a634c03bbb385f0d Mon Sep 17 00:00:00 2001
From: Daniil Avdeev <daniil.avdeev at syntacore.com>
Date: Thu, 11 Jul 2024 14:09:04 +0000
Subject: [PATCH] [lldb] SHT_NOBITS sections type

Sections with SHT_NOBITS type should be recognized as eSectionTypeZeroFill.
---
 lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 51bd34e95c77d..890db5c274814 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1696,7 +1696,6 @@ static SectionType GetSectionTypeFromName(llvm::StringRef Name) {
   return llvm::StringSwitch<SectionType>(Name)
       .Case(".ARM.exidx", eSectionTypeARMexidx)
       .Case(".ARM.extab", eSectionTypeARMextab)
-      .Cases(".bss", ".tbss", eSectionTypeZeroFill)
       .Case(".ctf", eSectionTypeDebug)
       .Cases(".data", ".tdata", eSectionTypeData)
       .Case(".eh_frame", eSectionTypeEHFrame)
@@ -1713,6 +1712,10 @@ SectionType ObjectFileELF::GetSectionType(const ELFSectionHeaderInfo &H) const {
     if (H.sh_flags & SHF_EXECINSTR)
       return eSectionTypeCode;
     break;
+  case SHT_NOBITS:
+    if (H.sh_flags & SHF_ALLOC)
+      return eSectionTypeZeroFill;
+    break;
   case SHT_SYMTAB:
     return eSectionTypeELFSymbolTable;
   case SHT_DYNSYM:



More information about the lldb-commits mailing list