[PATCH] D85501: [lld-macho] Handle command-line option -sectcreate SEG SECT FILE

Greg McGary via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 11:46:09 PDT 2020


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


================
Comment at: lld/MachO/InputFiles.cpp:313
+  isec->data = {buf, mb.getBufferSize()};
+  inputSections.push_back(isec);
+}
----------------
int3 wrote:
> none of the other InputFile constructors modify `inputSections` directly; I think it would better fit the pattern if `OpaqueFile` instead inserted the `isec` in its `subsections` map (at an offset of zero)
Quite right. Fixed.


================
Comment at: lld/test/MachO/sectcreate.s:4
+# RUN: echo "Contents of -sectcreate option" >%t2
+# RUN: lld -flavor darwinnew -Z -o %t %t.o -sectcreate FOO BARF %t2
+# RUN: llvm-objdump -s %t | FileCheck %s
----------------
int3 wrote:
> would be interesting to test multiple `-sectcreate` flags in sequence, e.g. checking that we lay out their sections in sequence as well. Also, does ld64 interleave them amongst the other object files on the command line, or do the created sections all appear at the end? Would be good to match that behavior
ld64 does not interleave. It places them all at the end, after the input files. I augmented the test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85501



More information about the llvm-commits mailing list