[PATCH] D28626: RFC: Generalize inverted gc dependencies

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 13:10:45 PST 2017


ruiu added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:325
               Twine(Sec.sh_link));
-      auto *IS = cast<InputSection<ELFT>>(Sections[Sec.sh_link]);
-      IS->DependentSection = Sections[I];
+      if (uint32_t Link = Sec.sh_link) {
+        auto *IS = cast<InputSection<ELFT>>(Sections[Link]);
----------------
Does this mean that there is a section with SHF_LINK_ORDER bit but with a null sh_link? It  seems like a broken object file to me.


================
Comment at: lld/ELF/MarkLive.cpp:238-244
+    if (Sec->Flags & SHF_LINK_ORDER) {
+      forEachSuccessor<ELFT>(
+          cast<InputSection<ELFT>>(*Sec), [=](ResolvedReloc<ELFT> R) {
+            cast<InputSection<ELFT>>(R.Sec)->DependentSections.push_back(Sec);
+          });
+      continue;
+    }
----------------
Why do you need this code? It seems you initializes DependentSections in InputFiles.


https://reviews.llvm.org/D28626





More information about the llvm-commits mailing list