Locksleyu
Locksleyu

Reputation: 5345

LC_LOAD_DYLINKER and custom linker on IOS

While looking through the list of LC_ commands supported by Mach-O files I noticed the LC_LOAD_DYLINKER command, which specifies which dynamic linker to use.

On IOS, this seems to always point to the same location, the standard DYLD on the device.

I was curious whether a custom linker is supported on IOS using this command, and if so are they any guidelines for creating one? Has anyone done this before?

Upvotes: 2

Views: 796

Answers (1)

zneak
zneak

Reputation: 138041

There is no other public dynamic linker on iOS, and probably no other private dynamic linker either. Mac OS X only has dyld. Most people wouldn't benefit from making a new dynamic linker, especially considering that:

  • loading applications is a critical task;
  • loading applications is complex;
  • the dynamic linker must be able to load libraries without the help of any shared library, including libSystem.so, which exposes the C standard library and the POSIX API;
  • Apple's dyld works just fine.

Linux is in a similar situation, with ELF executables having an interp section that specifies the path to the expected dynamic linker (if any). While this would allow you to create your dynamic linker if you felt like it, in practice, most modern x86 systems only have two: one for 32-bit applications, and one for 64-bit applications (which are really just two builds of the same program). Since libc has to be loaded from a dynamic linker, libc projects tend to include one; but the task is fundamental enough that there aren't a lot of them around. I'm only aware of libc's ld and musl's ld-musl.

Upvotes: 3

Related Questions