[llvm] [llvm-readelf] Add --extra-sym-info (PR #65580)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 21:35:46 PDT 2023


================
@@ -4058,17 +4075,31 @@ GNUELFDumper<ELFT>::getSymbolSectionNdx(const Elf_Sym &Symbol,
         SectionIndex <= ELF::SHN_HIRESERVE)
       return std::string("RSV[0x") +
              to_string(format_hex_no_prefix(SectionIndex, 4)) + "]";
-    // A normal section with an index
-    return to_string(format_decimal(SectionIndex, 3));
+    break;
   }
+
+  std::string Extra;
+  if (ExtraSymInfo) {
+    auto Sec = this->Obj.getSection(SectionIndex);
+    if (!Sec) {
+      this->reportUniqueWarning(Sec.takeError());
----------------
MaskRay wrote:

Added more tests to symbols.test and section-symbols.test

https://github.com/llvm/llvm-project/pull/65580


More information about the llvm-commits mailing list