[llvm-dev] LLD (macOS) usage?

Don Hinton via llvm-dev llvm-dev at lists.llvm.org
Sun Jan 7 10:53:36 PST 2018


My case is slightly different in that I only use it for cross compiling
clang from osx to linux, but to work around cmake issues, I have to set
CLANG_DEFAULT_LINKER=lld.  That means it's only really usable when passing
a non-darwin -target, e.g., "x86_64-unknown-linux-gnu".

This also means you can't use it for Native tools so you need to pass them
as well.

On Sun, Jan 7, 2018 at 10:37 AM, Saleem Abdulrasool <compnerd at compnerd.org>
wrote:

> MachO support in lld is not really ready for real world usage.  It was
> able to bootstrap itself a couple of years ago, but, it has not really been
> maintained or further developed since.  I would recommend that you use ld64
> if you are intending to build MachO binaries.
>
>
> On Jan 7, 2018, at 9:57 AM, Don Hinton via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
> I'm seeing something similar.
>
> clang is using HOST_LINK_VERSION, obtained from ld64, as the default for
> -mlinker-version.  This causes Darwin.cpp to add the arguments you are
> seeing, but not handled by lld.  Perhaps -fuse-ld should be considered in
> addition to -mlinker-version when adding these arguments.
>
> As a workaround, you can try passing -mlinker-version.  Looks like
> anything < 133 will work, including 0.
>
> hth...
> don
>
>
>
> On Thu, Jan 4, 2018 at 1:14 AM, Julio César Rocha via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> 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.
>>
>> Please help?
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180107/59c5859e/attachment.html>


More information about the llvm-dev mailing list