This is an archive of the discontinued LLVM Phabricator instance.

[clang][driver][darwin] Add driver support for Mac Catalyst
ClosedPublic

Authored by arphaman on Jul 13 2021, 10:22 PM.

Details

Summary

This patch is the last patch in the series of patches for the Mac Catalyst support in clang. It adds driver support for the Mac Catalyst target, as supported by the Apple clang compiler. It depends on https://reviews.llvm.org/D105257

Diff Detail

Event Timeline

arphaman created this revision.Jul 13 2021, 10:22 PM
arphaman requested review of this revision.Jul 13 2021, 10:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2021, 10:22 PM
dexonsmith accepted this revision.Jul 14 2021, 12:54 PM

LGTM! (Maybe leave a couple of days in case others have comments.)

This revision is now accepted and ready to land.Jul 14 2021, 12:54 PM
This revision was landed with ongoing or failed builds.Jul 22 2021, 10:20 AM
This revision was automatically updated to reflect the committed changes.

Hi. I think this patch may have led to the test failure we're seeing on our clang builders (https://luci-milo.appspot.com/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8840986998954824016):

Command Output (stderr):
--
/b/s/w/ir/x/w/llvm-project/clang/test/Driver/darwin-ld.c:146:29: error: LINK_VERSION_MIN_MACABI: expected string not found in input
// LINK_VERSION_MIN_MACABI: "-maccatalyst_version_min" "13.1.0"
                            ^
<stdin>:5:15: note: scanning from here
 "/usr/bin/ld" "-demangle" "-lto_library" "/b/s/w/ir/x/w/staging/llvm_build/lib/libLTO.dylib" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-o" "a.out" "-lcrt1.10.6.o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/darwin-ld.c.tmp.o" "-lSystem"
              ^
<stdin>:5:118: note: possible intended match here
 "/usr/bin/ld" "-demangle" "-lto_library" "/b/s/w/ir/x/w/staging/llvm_build/lib/libLTO.dylib" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-o" "a.out" "-lcrt1.10.6.o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/darwin-ld.c.tmp.o" "-lSystem"
                                                                                                                     ^

Input file: <stdin>
Check file: /b/s/w/ir/x/w/llvm-project/clang/test/Driver/darwin-ld.c

-dump-input=help explains the following input dump.

Input was:
<<<<<<
             1: Fuchsia clang version 13.0.0 (https://llvm.googlesource.com/a/llvm-project ae4e8f7d528f650e0f2730a7f166fb0ef7e31588) 
             2: Target: x86_64-apple-darwin10 
             3: Thread model: posix 
             4: InstalledDir: /b/s/w/ir/x/w/staging/llvm_build/bin 
             5:  "/usr/bin/ld" "-demangle" "-lto_library" "/b/s/w/ir/x/w/staging/llvm_build/lib/libLTO.dylib" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-o" "a.out" "-lcrt1.10.6.o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/darwin-ld.c.tmp.o" "-lSystem" 
check:146'0                   X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:146'1                                                                                                                          ?                                                                                                                                                                possible intended match
             6: Fuchsia clang version 13.0.0 (https://llvm.googlesource.com/a/llvm-project ae4e8f7d528f650e0f2730a7f166fb0ef7e31588) 
check:146'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             7: Target: x86_64-apple-macosx10.7 
check:146'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             8: Thread model: posix 
check:146'0     ~~~~~~~~~~~~~~~~~~~~
             9: InstalledDir: /b/s/w/ir/x/w/staging/llvm_build/bin 
check:146'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            10:  "/usr/bin/ld" "-demangle" "-lto_library" "/b/s/w/ir/x/w/staging/llvm_build/lib/libLTO.dylib" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.7.0" "-o" "a.out" "-lcrt1.10.6.o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/darwin-ld.c.tmp.o" "-lSystem" 
check:146'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
>>>>>>

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  Clang :: Driver/darwin-ld.c

Would you mind taking a look and sending out a fix or revert?

Hi. I think this patch may have led to the test failure we're seeing on our clang builders (https://luci-milo.appspot.com/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8840986998954824016):

Command Output (stderr):
--
/b/s/w/ir/x/w/llvm-project/clang/test/Driver/darwin-ld.c:146:29: error: LINK_VERSION_MIN_MACABI: expected string not found in input
// LINK_VERSION_MIN_MACABI: "-maccatalyst_version_min" "13.1.0"
                            ^
<stdin>:5:15: note: scanning from here
 "/usr/bin/ld" "-demangle" "-lto_library" "/b/s/w/ir/x/w/staging/llvm_build/lib/libLTO.dylib" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-o" "a.out" "-lcrt1.10.6.o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/darwin-ld.c.tmp.o" "-lSystem"
              ^
<stdin>:5:118: note: possible intended match here
 "/usr/bin/ld" "-demangle" "-lto_library" "/b/s/w/ir/x/w/staging/llvm_build/lib/libLTO.dylib" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-o" "a.out" "-lcrt1.10.6.o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/darwin-ld.c.tmp.o" "-lSystem"
                                                                                                                     ^

Input file: <stdin>
Check file: /b/s/w/ir/x/w/llvm-project/clang/test/Driver/darwin-ld.c

-dump-input=help explains the following input dump.

Input was:
<<<<<<
             1: Fuchsia clang version 13.0.0 (https://llvm.googlesource.com/a/llvm-project ae4e8f7d528f650e0f2730a7f166fb0ef7e31588) 
             2: Target: x86_64-apple-darwin10 
             3: Thread model: posix 
             4: InstalledDir: /b/s/w/ir/x/w/staging/llvm_build/bin 
             5:  "/usr/bin/ld" "-demangle" "-lto_library" "/b/s/w/ir/x/w/staging/llvm_build/lib/libLTO.dylib" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-o" "a.out" "-lcrt1.10.6.o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/darwin-ld.c.tmp.o" "-lSystem" 
check:146'0                   X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:146'1                                                                                                                          ?                                                                                                                                                                possible intended match
             6: Fuchsia clang version 13.0.0 (https://llvm.googlesource.com/a/llvm-project ae4e8f7d528f650e0f2730a7f166fb0ef7e31588) 
check:146'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             7: Target: x86_64-apple-macosx10.7 
check:146'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             8: Thread model: posix 
check:146'0     ~~~~~~~~~~~~~~~~~~~~
             9: InstalledDir: /b/s/w/ir/x/w/staging/llvm_build/bin 
check:146'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            10:  "/usr/bin/ld" "-demangle" "-lto_library" "/b/s/w/ir/x/w/staging/llvm_build/lib/libLTO.dylib" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.7.0" "-o" "a.out" "-lcrt1.10.6.o" "/b/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver/Output/darwin-ld.c.tmp.o" "-lSystem" 
check:146'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
>>>>>>

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  Clang :: Driver/darwin-ld.c

Would you mind taking a look and sending out a fix or revert?

Sure, I'll take a look.

I think this should be fixed if I add -fuse-ld= to the invocation. Let me commit that fix to see if it's fixed.

I think this should be fixed in 40d2d0c41298f1d8a178216e2534b29e3128cf37.

Thanks. Confirmed the test passes locally.