[llvm] [llvm-nm] Drop STT_FILE/STT_SECTION from --special-syms (PR #192129)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 03:52:13 PDT 2026


================
@@ -1825,17 +1825,20 @@ static bool getSymbolNamesFromObject(SymbolicFile &Obj,
         return false;
       }
 
-      // Don't drop format specifc symbols for ARM and AArch64 ELF targets, they
-      // are used to repesent mapping symbols and needed to honor the
-      // --special-syms option.
-      auto *ELFObj = dyn_cast<ELFObjectFileBase>(&Obj);
-      bool HasMappingSymbol =
-          ELFObj && llvm::is_contained({ELF::EM_ARM, ELF::EM_AARCH64,
-                                        ELF::EM_CSKY, ELF::EM_RISCV},
-                                       ELFObj->getEMachine());
-      if (!HasMappingSymbol && !DebugSyms &&
-          (*SymFlagsOrErr & SymbolRef::SF_FormatSpecific))
-        continue;
+      // Drop format-specific symbols (STT_FILE, STT_SECTION, etc.) but
+      // retain mapping symbols (STT_NOTYPE such as $d, $x) on ARM, AArch64,
+      // CSKY, and RISC-V targets to honor option --special-syms.
----------------
jh7370 wrote:

"to honor the --special-syms option" (like it was before) reads better to me.

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


More information about the llvm-commits mailing list