Skip to content

Commit 09c12c9

Browse files
authored
Merge pull request #32146 from apple/tensorflow-merge
Merge 2020-06-02 into tensorflow
2 parents 91d4726 + c74d9e3 commit 09c12c9

File tree

445 files changed

+12125
-1714
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

445 files changed

+12125
-1714
lines changed

CMakeLists.txt

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -153,24 +153,20 @@ set(SWIFT_COMPILER_VERSION "" CACHE STRING
153153
set(CLANG_COMPILER_VERSION "" CACHE STRING
154154
"The internal version of the Clang compiler")
155155

156-
# Indicate whether Swift should attempt to use the lld linker.
157-
if(CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
158-
set(SWIFT_ENABLE_LLD_LINKER_default TRUE)
156+
# Which default linker to use. Prefer LLVM_USE_LINKER if it set, otherwise use
157+
# our own defaults. This should only be possible in a unified (not stand alone)
158+
# build environment.
159+
if(LLVM_USE_LINKER)
160+
set(SWIFT_USE_LINKER_default "${LLVM_USE_LINKER}")
161+
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
162+
set(SWIFT_USE_LINKER_default "lld")
163+
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
164+
set(SWIFT_USE_LINKER_default "")
159165
else()
160-
set(SWIFT_ENABLE_LLD_LINKER_default FALSE)
166+
set(SWIFT_USE_LINKER_default "gold")
161167
endif()
162-
set(SWIFT_ENABLE_LLD_LINKER ${SWIFT_ENABLE_LLD_LINKER_default} CACHE BOOL
163-
"Enable using the lld linker when available")
164-
165-
# Indicate whether Swift should attempt to use the gold linker.
166-
# This is not used on Darwin.
167-
if(CMAKE_SYSTEM_NAME STREQUAL Darwin OR CMAKE_SYSTEM_NAME STREQUAL Windows)
168-
set(SWIFT_ENABLE_GOLD_LINKER_default FALSE)
169-
else()
170-
set(SWIFT_ENABLE_GOLD_LINKER_default TRUE)
171-
endif()
172-
set(SWIFT_ENABLE_GOLD_LINKER ${SWIFT_ENABLE_GOLD_LINKER_default} CACHE BOOL
173-
"Enable using the gold linker when available")
168+
set(SWIFT_USE_LINKER ${SWIFT_USE_LINKER_default} CACHE STRING
169+
"Build Swift with a non-default linker")
174170

175171
set(SWIFT_TOOLS_ENABLE_LTO OFF CACHE STRING "Build Swift tools with LTO. One
176172
must specify the form of LTO by setting this to one of: 'full', 'thin'. This
@@ -436,6 +432,8 @@ endif()
436432

437433
if(MSVC OR "${CMAKE_SIMULATE_ID}" STREQUAL MSVC)
438434
include(ClangClCompileRules)
435+
elseif(UNIX)
436+
include(UnixCompileRules)
439437
endif()
440438

441439
if(CMAKE_C_COMPILER_ID MATCHES Clang)
@@ -455,19 +453,6 @@ if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
455453
endif()
456454
endif()
457455

458-
#
459-
# Assume a new enough ar to generate the index at construction time. This avoids
460-
# having to invoke ranlib as a secondary command.
461-
#
462-
463-
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
464-
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qs <TARGET> <LINK_FLAGS> <OBJECTS>")
465-
set(CMAKE_C_ARCHIVE_FINISH "")
466-
467-
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
468-
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qs <TARGET> <LINK_FLAGS> <OBJECTS>")
469-
set(CMAKE_CXX_ARCHIVE_FINISH "")
470-
471456
#
472457
# Include CMake modules
473458
#

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
| **Ubuntu 16.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04)|
1212
| **Ubuntu 18.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04)|
1313
| **Ubuntu 20.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04)|
14-
| **CentOS 8** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-centos-8/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|
14+
| **CentOS 8** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-centos-8/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|[![Build Status](https://ci.swift.org/job/oss-swift-package-centos-8/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|
1515
| **Amazon Linux 2** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-amazon-linux-2/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-amazon-linux-2)|[![Build Status](https://ci.swift.org/job/oss-swift-package-amazon-linux-2/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-amazon-linux-2)|
1616

1717
**Swift Community-Hosted CI Platforms**
@@ -94,6 +94,9 @@ Once you are able to build things successfully and have a compile-test-debug
9494
loop going, check out the [development tips](docs/DevelopmentTips.md) for
9595
better productivity while working on the compiler.
9696

97+
You can also skim [docs/README.md](/docs/README.md) to understand what
98+
high-level documentation is available.
99+
97100
### System Requirements
98101

99102
macOS and Ubuntu Linux LTS 18.04 are the current supported host development
@@ -158,8 +161,6 @@ with version 2 shipped with Ubuntu.
158161

159162
**Note:** For Ubuntu 20.04, use `libpython2-dev` in place of the libpython-dev package above.
160163

161-
Build instructions for Ubuntu 14.04 LTS can be found [here](docs/Ubuntu14.md).
162-
163164
### Getting Sources for Swift and Related Projects
164165

165166
First, create a directory for all of the Swift sources:

cmake/modules/AddSwift.cmake

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function(_add_host_variant_c_compile_link_flags name)
116116
if(SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID)
117117
# lld can handle targeting the android build. However, if lld is not
118118
# enabled, then fallback to the linker included in the android NDK.
119-
if(NOT SWIFT_ENABLE_LLD_LINKER)
119+
if(NOT SWIFT_USE_LINKER STREQUAL "lld")
120120
swift_android_tools_path(${SWIFT_HOST_VARIANT_ARCH} tools_path)
121121
target_compile_options(${name} PRIVATE -B${tools_path})
122122
endif()
@@ -368,12 +368,9 @@ function(_add_host_variant_link_flags target)
368368
endif()
369369

370370
if(NOT SWIFT_COMPILER_IS_MSVC_LIKE)
371-
if(SWIFT_ENABLE_LLD_LINKER)
371+
if(SWIFT_USE_LINKER)
372372
target_link_options(${target} PRIVATE
373-
-fuse-ld=lld$<$<STREQUAL:${CMAKE_HOST_SYSTEM_NAME},Windows>:.exe>)
374-
elseif(SWIFT_ENABLE_GOLD_LINKER)
375-
target_link_options(${target} PRIVATE
376-
-fuse-ld=gold$<$<STREQUAL:${CMAKE_HOST_SYSTEM_NAME},Windows>:.exe>)
373+
-fuse-ld=${SWIFT_USE_LINKER}$<$<STREQUAL:${CMAKE_HOST_SYSTEM_NAME},Windows>:.exe>)
377374
endif()
378375
endif()
379376

@@ -520,7 +517,6 @@ function(add_swift_host_library name)
520517
endif()
521518

522519
set_target_properties(${name} PROPERTIES
523-
CXX_STANDARD 14
524520
NO_SONAME YES)
525521
endif()
526522

@@ -550,14 +546,10 @@ function(add_swift_host_library name)
550546
"LINKER:-current_version,${SWIFT_COMPILER_VERSION}")
551547
endif()
552548

553-
set(DEPLOYMENT_VERSION "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
554-
# MSVC, clang-cl, gcc don't understand -target.
555-
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT SWIFT_COMPILER_IS_MSVC_LIKE)
556-
get_target_triple(target target_variant "${SWIFT_HOST_VARIANT_SDK}" "${SWIFT_HOST_VARIANT_ARCH}"
557-
MACCATALYST_BUILD_FLAVOR ""
558-
DEPLOYMENT_VERSION "${DEPLOYMENT_VERSION}")
559-
target_link_options(${name} PRIVATE -target;${target})
560-
endif()
549+
get_target_triple(target target_variant "${SWIFT_HOST_VARIANT_SDK}" "${SWIFT_HOST_VARIANT_ARCH}"
550+
MACCATALYST_BUILD_FLAVOR ""
551+
DEPLOYMENT_VERSION "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
552+
target_link_options(${name} PRIVATE -target;${target})
561553
endif()
562554

563555
add_dependencies(dev ${name})

cmake/modules/AddSwiftUnittests.cmake

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,9 @@ function(add_swift_unittest test_dirname)
5757
_ENABLE_EXTENDED_ALIGNED_STORAGE)
5858
endif()
5959

60-
find_program(LDLLD_PATH "ld.lld")
61-
# Strangely, macOS finds lld and then can't find it when using -fuse-ld=
62-
if(SWIFT_ENABLE_LLD_LINKER AND LDLLD_PATH AND NOT APPLE)
60+
if(SWIFT_USE_LINKER)
6361
set_property(TARGET "${test_dirname}" APPEND_STRING PROPERTY
64-
LINK_FLAGS " -fuse-ld=lld")
65-
elseif(SWIFT_ENABLE_GOLD_LINKER AND
66-
"${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_OBJECT_FORMAT}" STREQUAL "ELF")
67-
set_property(TARGET "${test_dirname}" APPEND_STRING PROPERTY
68-
LINK_FLAGS " -fuse-ld=gold")
62+
LINK_FLAGS " -fuse-ld=${SWIFT_USE_LINKER}")
6963
endif()
7064

7165
if(SWIFT_ANALYZE_CODE_COVERAGE)

cmake/modules/UnixCompileRules.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
#
3+
# Assume a new enough ar to generate the index at construction time. This avoids
4+
# having to invoke ranlib as a secondary command.
5+
#
6+
7+
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
8+
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qs <TARGET> <LINK_FLAGS> <OBJECTS>")
9+
set(CMAKE_C_ARCHIVE_FINISH "")
10+
11+
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
12+
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qs <TARGET> <LINK_FLAGS> <OBJECTS>")
13+
set(CMAKE_CXX_ARCHIVE_FINISH "")

0 commit comments

Comments
 (0)