SpilledMango
SpilledMango

Reputation: 615

Link object files without libSystem macOS

I'm writing a compiler for macOS on x86-64, but when I link the object files together, ld says

ld: dynamic main executables must link with libSystem.dylib for inferred architecture x86_64

But since libSystem contains libc, I don't want to use it (it would give me lots of duplicates). How can I get around this?

Upvotes: 5

Views: 1793

Answers (1)

Kamil.S
Kamil.S

Reputation: 5543

Use -macosx_version_min 10.6 as ld parameter. This will generate LC_UNIXTHREAD instead of LC_MAIN in your executable. If you want even more control you'd need to get rid of ld in your chain altogether.

Upvotes: 6

Related Questions