Skip to content

Conversation

@mysterymath
Copy link
Contributor

This adds a loose port of the MachO why-live flag to ELF LLD.

This flag takes a glob matching symbols for which to report liveness information. The flag can be specified multiple times. For each symbol, a chain of objects is reported from GC root to that symbol.

A reported object is either a symbol or a section. Sections might be alive by virtue of some symbol within them being alive. Symbols might be alive either by being directly referenced by another symbol or just by virtue of being within a live section. Both symbols and sections may intrinsically be alive for various internal or flag reasons; these are the GC roots.

@github-actions
Copy link

github-actions bot commented Feb 4, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 8942d5ee6f73f00b9ccb1a1e4c27d4ff43fc41fe 59f826ba63825d4ecd6e6e9bd77bac4ab49120ee --extensions cpp,h -- lld/ELF/Config.h lld/ELF/Driver.cpp lld/ELF/MarkLive.cpp
View the diff from clang-format here.
diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp
index 679817fb38..1ab2ebad68 100644
--- a/lld/ELF/MarkLive.cpp
+++ b/lld/ELF/MarkLive.cpp
@@ -265,7 +265,8 @@ template <class ELFT> void MarkLive<ELFT>::printWhyLive(Symbol *s) const {
         return;
       cur = *it->second;
     } else {
-      // TODO: Some sections are enqueued without symbols, so maybe cur could be a section?
+      // TODO: Some sections are enqueued without symbols, so maybe cur could be
+      // a section?
       auto *d = dyn_cast<Defined>(std::get<Symbol *>(cur));
       if (!d)
         return;

@mysterymath mysterymath closed this Feb 5, 2025
@mysterymath mysterymath deleted the lld-why-live branch February 5, 2025 21:44
@mysterymath mysterymath restored the lld-why-live branch February 5, 2025 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant