[llvm-dev] Contributing LLD for Mach-O

Fangrui Song via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 2 14:11:25 PST 2020

On 2020-03-02, Shoaib Meenai wrote:
>We are committed to maintaining this. I believe there are some people who use the old port right now though, so I'd want us to be a bit more feature complete before we take over the Darwin flavor (e.g. we should at least be able to self-host).

Thanks for the commitment. I know close to zero about Mach-O, but I'll try following your development.

You may already have known this, but the following two talks are helpful.


>On 2/28/20, 10:40 PM, "Fangrui Song" <maskray at google.com> wrote:
>    On 2020-02-28, James Y Knight via llvm-dev wrote:
>    >Nice!
>    >
>    >Your plan sounds great, and it'll be awesome to finally have a good MachO
>    >LLD available.
>    >
>    >On Fri, Feb 28, 2020 at 4:32 PM Shoaib Meenai via llvm-dev <
>    >llvm-dev at lists.llvm.org> wrote:
>    >
>    >> Hi all,
>    >>
>    >> We’re planning to contribute a new implementation of LLD for Mach-O, using
>    >> the same design as the COFF and ELF ports. This design has proven to work
>    >> very well for those ports, and we’re keen to explore it for Mach-O as well.
>    >> Our work is based on an initial prototype created by Peter Collingbourne
>    >> and Rui Ueyama.
>    >>
>    >> Our initial commit is up for review at https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D75382&d=DwIDaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=ewsOF79X4LajoVfIDFOIrBvc7WiqUQNo7sNMnNPG48I&s=5X09zpWtQuKwp-Fsb1NHCSVFTJ3-63Gy1PcucIjSQTQ&e= .
>    >> We’ve intentionally stripped down this initial commit as much as possible
>    >> to ease reviewing; we’ve kept it to the absolute minimum needed to produce
>    >> and test a working macOS x86-64 executable for that prints “Hello World”
>    >> via a syscall. We have several short-term follow-ups planned to add
>    >> important functionality, such as linking against archives, universal
>    >> binaries, dylibs, and tbd files, performing subsection splitting
>    >> (atomization), and producing dylibs. The follow-ups should give a good
>    >> sense of the overall design while still keeping each piece easily
>    >> reviewable and testable individually. Our end goal is to create a
>    >> full-featured Mach-O linker, and we’ll be working toward that goal over the
>    >> next several months (and years, in all likelihood). We’d appreciate
>    >> feedback and reviews.
>    The existing Mach-O port https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D38290-23882910&d=DwIDaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=ewsOF79X4LajoVfIDFOIrBvc7WiqUQNo7sNMnNPG48I&s=9tPjw9s64q0kszjhd9Yj4Shpc8NOYMOacqCyrWH5h5A&e=
>    had been unmaintained when the ld64.lld alias was added.
>    If Jez and the team are committed to maintain the new Mach-O port and we
>    think the existing port is a dead end, we may assign the flavor `darwin` to
>    it (`lld -flavor darwin`) and rename the existing flavor to `darwin-old` or
>    `darwin-legacy`.

More information about the llvm-dev mailing list