[llvm-dev] [lld] Well lld support some advanced features like gnu linker in macOS?

Shoaib Meenai via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 15 09:17:54 PST 2017


Additionally, those errors sound like you invoked the ELF port of LLD. In 6.0, the Mach-O will be called ld64.lld (and clang's linker selection logic has been updated accordingly), so that the ELF and Mach-O ports can be disambiguated.



ld64 is pretty modern/performant in my experience, which might be part of the reason the LLD Mach-O efforts have stalled. Even if that port were revived, its command line interface would probably mirror ld64's and not GNU ld's, so you may not get the options you're looking for.



I just did a bit of experimentation, and it appears that ld64 doesn't appear to care about the ordering of static libraries on the command line, in which case --start-group and --end-group are unnecessary. I couldn't find any direct analog to --as-needed, but you can build a dynamic library with -mark_dead_strippable_dylib, which achieves a similar effect of only pulling in that library when functions from it are referenced.



On 12/15/17, 7:23 AM, "llvm-dev on behalf of Rafael Avila de Espindola via llvm-dev" <llvm-dev-bounces at lists.llvm.org on behalf of llvm-dev at lists.llvm.org> wrote:



    I don't think the MachO side of lld is currently being developed.



    Cheers,

    Rafael



    gao ge via llvm-dev <llvm-dev at lists.llvm.org> writes:



    > Hi, llvm developers. I can't find a lld-dev mail list, so just mail to here.

    >

    > ld in macOS is legacy, lld a more modern linker. I have test,

    > `-fuse-ld=lld, -Wl,--as-needed `, but its output is:

    >

    > /usr/local/bin/ld.lld: error: unknown argument: -dynamic

    >

    > /usr/local/bin/ld.lld: error: unknown argument: -arch

    >

    > /usr/local/bin/ld.lld: error: unknown argument: -search_paths_first

    >

    > /usr/local/bin/ld.lld: error: unknown emulation: acosx_version_min

    >

    > /usr/local/bin/ld.lld: error: unable to find library -lto_library

    >

    > /usr/local/bin/ld.lld: error:

    > /usr/local/Cellar/llvm/5.0.0/lib/libLTO.dylib: invalid data encoding

    >

    > Seems lld is working in progress. I hope lld will support some advanced

    > features like `--as-need` `--start-group` `--end-group` flags in macOS,

    > they are very useful !

    > _______________________________________________

    > LLVM Developers mailing list

    > llvm-dev at lists.llvm.org

    > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=sUJnDNx4gQ64N6rHycf6XJwzJSeZ0mpqGdg_5E4c9fA&s=Naf9UDCLMNvcxtPBnIIh-mrPkC0TtPtCbf2GWX6xnSg&e=

    _______________________________________________

    LLVM Developers mailing list

    llvm-dev at lists.llvm.org

    https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=sUJnDNx4gQ64N6rHycf6XJwzJSeZ0mpqGdg_5E4c9fA&s=Naf9UDCLMNvcxtPBnIIh-mrPkC0TtPtCbf2GWX6xnSg&e=


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171215/d9a8d862/attachment.html>


More information about the llvm-dev mailing list