[llvm-branch-commits] [lld] [lld-macho] Collect S_ATTR_LIVE_SUPPORT sections with the markLive roots (PR #242230)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 13 02:24:30 PST 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/MachO/MarkLive.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/MachO/MarkLive.cpp b/lld/MachO/MarkLive.cpp
index 053e60f3c..50df2dc4a 100644
--- a/lld/MachO/MarkLive.cpp
+++ b/lld/MachO/MarkLive.cpp
@@ -302,31 +302,31 @@ void MarkLiveImpl<RecordWhyLive>::markTransitively() {
 
     // S_ATTR_LIVE_SUPPORT sections are live if they point _to_ a live
     // section. Process them in a second pass.
-    parallelForChunks(
-        ArrayRef(liveSupport), 256,
-        [&](size_t shard, ArrayRef<ConcatInputSection *> chunk) {
-          for (ConcatInputSection *isec : chunk) {
-            if (isec->isLive(0))
-              continue;
-
-            for (const Relocation &r : isec->relocs) {
-              InputSection *referentIsec = nullptr;
-              if (auto *s = dyn_cast<Symbol *>(r.referent)) {
-                if (!s->isLive())
-                  continue;
-                if (auto *d = dyn_cast<Defined>(s))
-                  referentIsec = d->isec();
-              } else {
-                referentIsec = cast<InputSection *>(r.referent);
-                if (!referentIsec->isLive(r.getAddend()))
-                  continue;
-              }
-              enqueue(isec, 0, makeEntry(referentIsec, nullptr), shards[shard]);
-              break;
-            }
-          }
-          flush(shard);
-        });
+    parallelForChunks(ArrayRef(liveSupport), 256,
+                      [&](size_t shard, ArrayRef<ConcatInputSection *> chunk) {
+                        for (ConcatInputSection *isec : chunk) {
+                          if (isec->isLive(0))
+                            continue;
+
+                          for (const Relocation &r : isec->relocs) {
+                            InputSection *referentIsec = nullptr;
+                            if (auto *s = dyn_cast<Symbol *>(r.referent)) {
+                              if (!s->isLive())
+                                continue;
+                              if (auto *d = dyn_cast<Defined>(s))
+                                referentIsec = d->isec();
+                            } else {
+                              referentIsec = cast<InputSection *>(r.referent);
+                              if (!referentIsec->isLive(r.getAddend()))
+                                continue;
+                            }
+                            enqueue(isec, 0, makeEntry(referentIsec, nullptr),
+                                    shards[shard]);
+                            break;
+                          }
+                        }
+                        flush(shard);
+                      });
 
     // S_ATTR_LIVE_SUPPORT could have marked additional sections live,
     // which in turn could mark additional S_ATTR_LIVE_SUPPORT sections live.

``````````

</details>


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


More information about the llvm-branch-commits mailing list