[PATCH] D85501: [lld-macho] Handle command-line option -sectcreate SEG SECT FILE
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 12:04:00 PDT 2020
int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.
lgtm modulo those changes
================
Comment at: lld/MachO/InputFiles.cpp:313
+ isec->data = {buf, mb.getBufferSize()};
+ subsections.push_back({{0, isec}});
+}
----------------
nit: `subsections.emplace_back({0, isec});`
================
Comment at: lld/test/MachO/sectcreate.s:11
+# RUN: llvm-objdump -s %t | FileCheck %s
+
+# CHECK: Contents of section SEC1:
----------------
let's check that `__text` appears before the additional sections
================
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
----------------
gkm wrote:
> 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.
Thanks for checking! I think it's worthwhile for us to codify this behavior -- we could put `%t.o` in between the `sectcreate` flags below to demonstrate that interleaving doesn't occur.
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