[PATCH] D76839: [lld-macho] Extend SyntheticSections to cover all segment load commands

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 11:55:25 PDT 2020


int3 marked 3 inline comments as done.
int3 added inline comments.


================
Comment at: lld/MachO/OutputSegment.cpp:20-36
+uint32_t initProt(StringRef name) {
+  if (name == segment_names::text)
+    return VM_PROT_READ | VM_PROT_EXECUTE;
+  else if (name == segment_names::pageZero)
+    return 0;
+  else if (name == segment_names::linkEdit)
+    return VM_PROT_READ;
----------------
this is more or less what ld64 does


================
Comment at: lld/MachO/Writer.h:17
 
+class LoadCommand {
+public:
----------------
Had to move this to the header so that MachHeaderSection's implementation in SyntheticSections.cpp could access it. That said, I'm a bit undecided on whether it really makes sense for things like `MachHeaderSection` to be there -- while it technically is a synthetic section, if it only gets used by one component of the linker (i.e. in Writer.cpp), maybe it should be defined there?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76839





More information about the llvm-commits mailing list