[lld] wasm-ld: Preserve segment linking flags in --relocatable output (PR #210747)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 08:58:10 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 cpp -- lld/wasm/OutputSegment.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/wasm/OutputSegment.cpp b/lld/wasm/OutputSegment.cpp
index 10fef48c9..fccc73a6f 100644
--- a/lld/wasm/OutputSegment.cpp
+++ b/lld/wasm/OutputSegment.cpp
@@ -19,9 +19,9 @@ namespace lld::wasm {
 
 void OutputSegment::addInputSegment(InputChunk *inSeg) {
   alignment = std::max(alignment, inSeg->alignment);
-  // Carry input flags (RETAIN, STRINGS) into the relocatable SegmentInfo output;
-  // otherwise a relocatable link drops them and the downstream link loses RETAIN
-  // (segment GC'd) and STRINGS (string merge disabled).
+  // Carry input flags (RETAIN, STRINGS) into the relocatable SegmentInfo
+  // output; otherwise a relocatable link drops them and the downstream link
+  // loses RETAIN (segment GC'd) and STRINGS (string merge disabled).
   linkingFlags |= inSeg->flags;
   inputSegments.push_back(inSeg);
   size = llvm::alignTo(size, 1ULL << inSeg->alignment);

``````````

</details>


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


More information about the llvm-commits mailing list