[llvm-bugs] [Bug 34792] New: clang passes meaningless flags to lld when targeting MacOS

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 30 23:44:20 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34792

            Bug ID: 34792
           Summary: clang passes meaningless flags to lld when targeting
                    MacOS
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: llvm-bugs at lists.llvm.org

Unpack the official Clang 5 .tar.xz from http://releases.llvm.org/download.html
and try to use it with the bundled copy of LLD:

$ ~/clang+llvm-5.0.0-x86_64-apple-darwin/bin/clang++ numbers.cpp  -fuse-ld=lld  
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error: unknown
argument: -no_deduplicate
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error: unknown
argument: -dynamic
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error: unknown
argument: -arch
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error: unknown
emulation: acosx_version_min
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error: unable
to find library -lto_library
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error:
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/lib/libLTO.dylib: invalid
data encoding
clang-5.0: error: linker command failed with exit code 1 (use -v to see
invocation)

Oops.

>From clang -v, we see that Clang is passing Apple-linker-specific flags to
ld.lld:

 "/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld" -demangle
-lto_library
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/lib/libLTO.dylib
-no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.12.0 -o a.out
/var/folders/00/14vvr000h01000cxqpysvccm004lgg/T/numbers-0d20ee.o -lc++
-lSystem
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/lib/clang/5.0.0/lib/darwin/libclang_rt.osx.a

Either -fuse-ld=lld should not be supported or it should pass meaningful flags.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171001/03902847/attachment.html>


More information about the llvm-bugs mailing list