I'm doing some security research on macOS, and have a case where I have a binary, compiled from Swift, that I want to run with the DYLD_INSERT_LIBRARIES
option (or at least something that achieves the same thing). Putting the library I want to insert in the same Swift package (as a different target) and defining it as a dependency of the executable target "works" but it seems to insert the library at a later stage that DYLD_INSERT_LIBRARIES
does. I can observe this through a custom interposing shim I made firing off multiple times when the library is inserted with DYLD_INSERT_LIBRARIES
, but not when it's linked through the dependencies
option in Package.swift
.
Is there an equivalent way to DYLD_INSERT_LIBRARIES
to insert libraries at compile-time (perhaps through custom linker flags) that can be achieved through the use of Package.swift
? Also, is there any good documentation on all this?