[llvm-dev] Fwd: LLD (macOS) usage?

Shoaib Meenai via llvm-dev llvm-dev at lists.llvm.org
Sun Jan 7 22:18:34 PST 2018

I believe what's happening here is that clang translates the -fuse-ld=lld into calling the ld.lld executable, which is actually the ELF LLD linker, not the Mach-O one. On 6.0, the Mach-O linker symlink is called ld64.lld instead (and clang has been changed to call out to that name) to disambiguate the two. For 5.0, I'm not sure how best to force the Mach-O linker (I'm not familiar with how the distribution is laid out).

As Saleem said though, Mach-O LLD isn't really ready yet, so you're better off using ld64 (the default linker).

From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Julio César Rocha via llvm-dev <llvm-dev at lists.llvm.org>
Reply-To: Julio César Rocha <julioc.rocha at gmail.com>
Date: Sunday, January 7, 2018 at 7:17 AM
To: "llvm-dev at lists.llvm.org" <llvm-dev at lists.llvm.org>
Subject: [llvm-dev] Fwd: LLD (macOS) usage?

Hi. I'm using LLVM 5.0.1 on macOS 10.12.

I have a very simple program (program.c):
int main() {}

When attempting to compile with LLD, I get this output:
$ clang -fuse-ld=lld program.c
/opt/llvm/5.0.1/bin/ld.lld: error: unknown argument: -no_deduplicate
/opt/llvm/5.0.1/bin/ld.lld: error: unknown argument: -dynamic
/opt/llvm/5.0.1/bin/ld.lld: error: unknown argument: -arch
/opt/llvm/5.0.1/bin/ld.lld: error: unknown emulation: acosx_version_min
/opt/llvm/5.0.1/bin/ld.lld: error: unable to find library -lto_library
/opt/llvm/5.0.1/bin/ld.lld: error: /opt/llvm/5.0.1/lib/libLTO.dylib: invalid data encoding
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)

Looks like the flags passed to the linker are just wrong, but can't find any relevant documentation at llvm.org/docs<https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=u7AStivTiQUkhMKu66ZUkCBZPZEq4EYZ0fP-0tIofUw&s=KYkQl_-tlad-fETHEsTQO9QhksIQ7vvHuBrL_1DXAQw&e=>.

Please help?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180108/0967a3e2/attachment.html>

More information about the llvm-dev mailing list