[PATCH] D119668: [lld-macho] Add -static

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 06:54:42 PST 2022


int3 added a comment.

> -static drives will probably drive me (or anyone) insane if it is to be completely and correctly implemented. It seems to touch everything, and I don't even know if everything below is all that it does.

I guess my question is... why are we implementing this, if it's too much work to implement correctly? Do you foresee a real use case?



================
Comment at: lld/MachO/Driver.cpp:1219
+  if (const Arg *arg = args.getLastArg(OPT_static, OPT_dynamic))
+    config->staticLink = (arg->getOption().getID() == OPT_static);
+
----------------



================
Comment at: lld/MachO/Writer.cpp:360
+    hdr->count = getFlavorSize() / sizeof(uint32_t);
+    memset(get_thread_state<uint8_t>(buf), 0, getFlavorSize());
+
----------------
if you did `buf = reinterpret_cast<uint8_t *>(hdr + 1);` here, you could replace the calls to `get_thread_state` with just a `reinterpret_cast`.

just a matter of opinion though, I'm fine if you want to keep things as-is :)


================
Comment at: lld/test/MachO/static.s:50
+# CHECK-VLC-NEXT:       count [[ARCH]]_THREAD_STATE64_COUNT
+
+.globl start
----------------
we should add some checks (via `CHECK-NOT`) to make sure we aren't emitting the function starts and other unneeded commands


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

https://reviews.llvm.org/D119668



More information about the llvm-commits mailing list