[PATCH] D106629: [lld/mac] Implement for section$start and section$ end symbols

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 23 07:57:03 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/OutputSection.h:70-71
   StringRef name;
+  SmallVector<Defined *, 1> sectionStartSymbols;
+  SmallVector<Defined *, 1> sectionEndSymbols;
   OutputSegment *parent = nullptr;
----------------
when will we have more than one symbol here?

also, if we're usually going to have just one element, since a TinyPtrVector better?


================
Comment at: lld/MachO/SymbolTable.cpp:243
+                            : osec->sectionEndSymbols)
+      .push_back(symtab->addSynthetic(sym.getName(), /*isec=*/nullptr,
+                                      /*value=*/-1, /*isPrivateExtern=*/true,
----------------
shouldn't we be passing in a non-null `isec` here?


================
Comment at: lld/test/MachO/start-end.s:72-78
+## (Fun fact: `-e 'section$start$__TEXT$__text -dead_strip` strips
+## everything in the text section because markLive runs well before
+## section$start symbols are replaced, so the entry point is just
+## an undefined symbol that keeps nothing alive, and then later it
+## sets the entry point to the start of the now-empty text section
+## and the output program crashes when running. This matches ld64's
+## behavior.)
----------------
😂


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106629/new/

https://reviews.llvm.org/D106629



More information about the llvm-commits mailing list