[lld] [ELF] --retain-symbols-file: keep listed symbols in .symtab, not .dynsym (PR #209063)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 23:56:05 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- lld/ELF/Config.h lld/ELF/Driver.cpp lld/ELF/MarkLive.cpp lld/ELF/SymbolTable.cpp lld/ELF/Writer.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp
index fb2165a51..282081813 100644
--- a/lld/ELF/MarkLive.cpp
+++ b/lld/ELF/MarkLive.cpp
@@ -343,8 +343,7 @@ void MarkLive<ELFT, TrackWhyLive>::markSymbol(Symbol *sym, StringRef reason) {
 // .symtab retains them and the relocations keep valid symbol indices. Callers
 // invoke this only when .symtab filtering is active (--discard-* or
 // --retain-symbols-file); otherwise .symtab keeps every symbol anyway.
-template <class ELFT>
-static void markUsedSymbols(InputSectionBase &sec) {
+template <class ELFT> static void markUsedSymbols(InputSectionBase &sec) {
   auto mark = [&](const auto &rel) {
     sec.file->getRelocTargetSym(rel).setFlags(USED);
   };

``````````

</details>


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


More information about the llvm-commits mailing list