Ad-hoc code signature anomaly on arm64 macOS

I just added ad-hoc code signing to the new LLD MachO port: https://reviews.llvm.org/D96164

Observe what happens for a simple “hello world” test program:

  1. Build with ld64.lld.darwinnew

  2. Attempt to run. It dies immediately with SIGKILL

  3. Wait a few hours

  4. The same program now runs

  5. Rebuild as in step (1). cmp(1) says it is byte-for-byte identical with the program built at step (1).

  6. Attempt to run. It dies immediately with SIGKILL

  7. Use cp(1) to copy the program built in step (5)

  8. The step (5) program continues to die with SIGKILL, while the copy from step (7) runs

WTF?!

G