Skip to content

Commit 55b82e9

Browse files
authored
Merge pull request #70058 from apple/revert-69973-embedded-linux
Revert "[embedded] Start building embedded support on Linux/ELF, expand archs of the embedded stdlib to cover common embedded targets"
2 parents ad68322 + 130adac commit 55b82e9

Some content is hidden

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

51 files changed

+104
-90
lines changed

cmake/modules/SwiftSetIfArchBitness.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ function(set_if_arch_bitness var_name)
1111
"${SIA_ARCH}" STREQUAL "x86" OR
1212
"${SIA_ARCH}" STREQUAL "armv5" OR
1313
"${SIA_ARCH}" STREQUAL "armv6" OR
14-
"${SIA_ARCH}" STREQUAL "armv6m" OR
1514
"${SIA_ARCH}" STREQUAL "armv7" OR
1615
"${SIA_ARCH}" STREQUAL "armv7k" OR
1716
"${SIA_ARCH}" STREQUAL "arm64_32" OR
1817
"${SIA_ARCH}" STREQUAL "armv7m" OR
1918
"${SIA_ARCH}" STREQUAL "armv7em" OR
2019
"${SIA_ARCH}" STREQUAL "armv7s" OR
21-
"${SIA_ARCH}" STREQUAL "riscv32" OR
2220
"${SIA_ARCH}" STREQUAL "wasm32" OR
2321
"${SIA_ARCH}" STREQUAL "powerpc")
2422
set("${var_name}" "${SIA_CASE_32_BIT}" PARENT_SCOPE)

stdlib/public/CMakeLists.txt

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ option(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB
138138
"Enable build of the embedded Swift standard library and runtime"
139139
TRUE)
140140

141-
if((NOT SWIFT_HOST_VARIANT STREQUAL "macosx") AND (NOT SWIFT_HOST_VARIANT STREQUAL "linux"))
141+
if(NOT SWIFT_HOST_VARIANT STREQUAL "macosx")
142142
set(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB FALSE)
143143
elseif(NOT SWIFT_INCLUDE_TOOLS)
144144
# Temporarily, only build embedded stdlib when building the compiler, to
@@ -151,36 +151,12 @@ endif()
151151
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
152152
set(EMBEDDED_STDLIB_TARGET_TRIPLES
153153
# arch module_name target triple
154-
"armv6 armv6-apple-none-macho armv6-apple-none-macho"
155-
"armv6m armv6m-apple-none-macho armv6m-apple-none-macho"
156154
"armv7 armv7-apple-none-macho armv7-apple-none-macho"
157-
"armv7em armv7em-apple-none-macho armv7em-apple-none-macho"
158155
"arm64 arm64-apple-none-macho arm64-apple-none-macho"
159-
160-
# the following are all ELF targets
161-
"armv6 armv6-none-none-eabi armv6-none-none-eabi"
162-
"armv6m armv6m-none-none-eabi armv6-none-none-eabi"
163-
"armv7 armv7-none-none-eabi armv7-none-none-eabi"
164-
"armv7em armv7em-none-none-eabi armv7em-none-none-eabi"
165-
"aarch64 aarch64-none-none-elf aarch64-none-none-elf"
166-
"riscv32 riscv32-none-none-eabi riscv32-none-none-eabi"
167-
"riscv64 riscv64-none-none-eabi riscv64-none-none-eabi"
156+
"x86_64 x86_64-apple-macos x86_64-apple-macos10.13"
157+
"arm64 arm64-apple-macos arm64-apple-macos10.13"
158+
"arm64e arm64e-apple-macos arm64e-apple-macos10.13"
168159
)
169-
170-
if (SWIFT_HOST_VARIANT STREQUAL "linux")
171-
set(EMBEDDED_STDLIB_TARGET_TRIPLES ${EMBEDDED_STDLIB_TARGET_TRIPLES}
172-
"${SWIFT_HOST_VARIANT_ARCH} ${SWIFT_HOST_VARIANT_ARCH}-unknown-linux-gnu ${SWIFT_HOST_VARIANT_ARCH}-unknown-linux-gnu"
173-
# In practice this expands to either:
174-
# "x86_64 x86_64-unknown-linux-gnu x86_64-unknown-linux-gnu"
175-
# "aarch64 aarch64-unknown-linux-gnu aarch64-unknown-linux-gnu"
176-
)
177-
elseif (SWIFT_HOST_VARIANT STREQUAL "macosx")
178-
set(EMBEDDED_STDLIB_TARGET_TRIPLES ${EMBEDDED_STDLIB_TARGET_TRIPLES}
179-
"x86_64 x86_64-apple-macos x86_64-apple-macos10.13"
180-
"arm64 arm64-apple-macos arm64-apple-macos10.13"
181-
"arm64e arm64e-apple-macos arm64e-apple-macos10.13"
182-
)
183-
endif()
184160
endif()
185161

186162
if(SWIFT_BUILD_STDLIB)

stdlib/public/Concurrency/CMakeLists.txt

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -198,18 +198,9 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB AND SWIFT_SHOULD_BUILD_EMBEDDED_CONCURRENC
198198
list(GET list 1 mod)
199199
list(GET list 2 triple)
200200

201-
if (SWIFT_HOST_VARIANT STREQUAL "linux")
202-
if(NOT "${mod}" MATCHES "-linux-gnu$")
203-
continue()
204-
endif()
205-
set(extra_c_compile_flags)
206-
set(extra_swift_compile_flags)
207-
elseif (SWIFT_HOST_VARIANT STREQUAL "macosx")
208-
if(NOT "${mod}" MATCHES "-macos$")
209-
continue()
210-
endif()
211-
set(extra_c_compile_flags -D__MACH__ -D__APPLE__ -ffreestanding)
212-
set(extra_swift_compile_flags -Xcc -D__MACH__ -Xcc -D__APPLE__ -Xcc -ffreestanding)
201+
# TODO: Only build embedded Swift Concurrency for macOS, for now.
202+
if(NOT "${mod}" MATCHES "-macos$")
203+
continue()
213204
endif()
214205

215206
set(SWIFT_SDK_embedded_ARCH_${mod}_MODULE "${mod}")
@@ -251,11 +242,12 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB AND SWIFT_SHOULD_BUILD_EMBEDDED_CONCURRENC
251242
TaskCancellation.swift
252243

253244
SWIFT_COMPILE_FLAGS
254-
${extra_swift_compile_flags} -enable-experimental-feature Embedded
245+
-Xcc -D__MACH__ -Xcc -D__APPLE__ -Xcc -ffreestanding -enable-experimental-feature Embedded
255246
-parse-stdlib -DSWIFT_CONCURRENCY_EMBEDDED
256247
${SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS}
257248
C_COMPILE_FLAGS
258-
${extra_c_compile_flags} ${SWIFT_RUNTIME_CONCURRENCY_C_FLAGS} -DSWIFT_CONCURRENCY_EMBEDDED=1
249+
-D__MACH__ -D__APPLE__ -ffreestanding
250+
${SWIFT_RUNTIME_CONCURRENCY_C_FLAGS} -DSWIFT_CONCURRENCY_EMBEDDED=1
259251
MODULE_DIR "${CMAKE_BINARY_DIR}/lib/swift/embedded"
260252
SDK "embedded"
261253
ARCHITECTURE "${mod}"

test/embedded/array-builtins-exec.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
// REQUIRES: swift_in_compiler
77
// REQUIRES: executable_test
88
// REQUIRES: optimized_stdlib
9-
// REQUIRES: OS=macosx || OS=linux-gnu
9+
// REQUIRES: VENDOR=apple
10+
// REQUIRES: OS=macosx
1011

1112
import Builtin
1213

test/embedded/array-to-pointer.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
// REQUIRES: swift_in_compiler
88
// REQUIRES: executable_test
99
// REQUIRES: optimized_stdlib
10-
// REQUIRES: OS=macosx || OS=linux-gnu
10+
// REQUIRES: VENDOR=apple
11+
// REQUIRES: OS=macosx
1112

1213
@_silgen_name("putchar")
1314
func putchar(_: UInt8)

test/embedded/array-zero-size-struct.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
// REQUIRES: swift_in_compiler
44
// REQUIRES: optimized_stdlib
5-
// REQUIRES: OS=macosx || OS=linux-gnu
5+
// REQUIRES: VENDOR=apple
6+
// REQUIRES: OS=macosx
67

78
public struct MyStruct {
89
}

test/embedded/arrays.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
// REQUIRES: swift_in_compiler
88
// REQUIRES: executable_test
99
// REQUIRES: optimized_stdlib
10-
// REQUIRES: OS=macosx || OS=linux-gnu
10+
// REQUIRES: VENDOR=apple
11+
// REQUIRES: OS=macosx
1112

1213
@_silgen_name("putchar")
1314
func putchar(_: UInt8)

test/embedded/class-func.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
// REQUIRES: swift_in_compiler
44
// REQUIRES: executable_test
55
// REQUIRES: optimized_stdlib
6-
// REQUIRES: OS=macosx || OS=linux-gnu
6+
// REQUIRES: VENDOR=apple
7+
// REQUIRES: OS=macosx
78

89
@main
910
struct Main {

test/embedded/classes-arrays.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
// REQUIRES: swift_in_compiler
77
// REQUIRES: executable_test
88
// REQUIRES: optimized_stdlib
9-
// REQUIRES: OS=macosx || OS=linux-gnu
9+
// REQUIRES: VENDOR=apple
10+
// REQUIRES: OS=macosx
1011

1112
class MyClass {
1213
init() { print("MyClass.init") }

test/embedded/classes-stack-promotion.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
// REQUIRES: swift_in_compiler
88
// REQUIRES: executable_test
99
// REQUIRES: optimized_stdlib
10-
// REQUIRES: OS=macosx || OS=linux-gnu
10+
// REQUIRES: VENDOR=apple
11+
// REQUIRES: OS=macosx
1112

1213
public class MyClass {
1314
public init() { print("MyClass.init") }

test/embedded/classes.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
// REQUIRES: swift_in_compiler
77
// REQUIRES: executable_test
88
// REQUIRES: optimized_stdlib
9-
// REQUIRES: OS=macosx || OS=linux-gnu
9+
// REQUIRES: VENDOR=apple
10+
// REQUIRES: OS=macosx
1011

1112
class MyClass {
1213
init() { print("MyClass.init") }

test/embedded/closures-heap.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
// REQUIRES: swift_in_compiler
77
// REQUIRES: executable_test
88
// REQUIRES: optimized_stdlib
9-
// REQUIRES: OS=macosx || OS=linux-gnu
9+
// REQUIRES: VENDOR=apple
10+
// REQUIRES: OS=macosx
1011

1112
public class MyClass {
1213
var handler: (()->())? = nil

test/embedded/collection.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
// REQUIRES: swift_in_compiler
88
// REQUIRES: executable_test
99
// REQUIRES: optimized_stdlib
10-
// REQUIRES: OS=macosx || OS=linux-gnu
10+
// REQUIRES: VENDOR=apple
11+
// REQUIRES: OS=macosx
1112

1213
@_silgen_name("putchar")
1314
func putchar(_: UInt8)

test/embedded/concurrency-actors.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// REQUIRES: executable_test
88
// REQUIRES: swift_in_compiler
99
// REQUIRES: optimized_stdlib
10+
// REQUIRES: VENDOR=apple
1011
// REQUIRES: OS=macosx
1112

1213
import _Concurrency

test/embedded/concurrency-async-let.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// REQUIRES: executable_test
88
// REQUIRES: swift_in_compiler
99
// REQUIRES: optimized_stdlib
10+
// REQUIRES: VENDOR=apple
1011
// REQUIRES: OS=macosx
1112

1213
import _Concurrency

test/embedded/concurrency-builtins.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
// REQUIRES: swift_in_compiler
44
// REQUIRES: optimized_stdlib
5+
// REQUIRES: VENDOR=apple
56
// REQUIRES: OS=macosx
67

78
import Builtin

test/embedded/concurrency-simple.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// REQUIRES: executable_test
88
// REQUIRES: swift_in_compiler
99
// REQUIRES: optimized_stdlib
10+
// REQUIRES: VENDOR=apple
1011
// REQUIRES: OS=macosx
1112

1213
import _Concurrency

test/embedded/custom-print.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
// REQUIRES: swift_in_compiler
77
// REQUIRES: executable_test
8-
// REQUIRES: OS=macosx || OS=linux-gnu
8+
// REQUIRES: VENDOR=apple
9+
// REQUIRES: OS=macosx
910

1011
@_silgen_name("putchar")
1112
func putchar(_: UInt8)

test/embedded/debuginfo.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
// REQUIRES: swift_in_compiler
99
// REQUIRES: optimized_stdlib
10-
// REQUIRES: OS=macosx || OS=linux-gnu
10+
// REQUIRES: VENDOR=apple
11+
// REQUIRES: OS=macosx
1112

1213
public func foo<T>(_ array: inout [T]) {
1314
array.withUnsafeMutableBytes {

test/embedded/deserialize-vtables.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
// REQUIRES: swift_in_compiler
66
// REQUIRES: executable_test
77
// REQUIRES: optimized_stdlib
8-
// REQUIRES: OS=macosx || OS=linux-gnu
8+
// REQUIRES: VENDOR=apple
9+
// REQUIRES: OS=macosx
910

1011
@main
1112
struct Main {

test/embedded/dynamic-self.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// RUN: %target-swift-emit-ir %s -enable-experimental-feature Embedded -parse-as-library -module-name main | %FileCheck %s
22

33
// REQUIRES: swift_in_compiler
4-
// REQUIRES: OS=macosx || OS=linux-gnu
4+
// REQUIRES: VENDOR=apple
5+
// REQUIRES: OS=macosx
56

67
class MyClass {
78
init() {

test/embedded/fno-builtin.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
// REQUIRES: swift_in_compiler
55
// REQUIRES: optimized_stdlib
6-
// REQUIRES: OS=macosx || OS=linux-gnu
6+
// REQUIRES: VENDOR=apple
7+
// REQUIRES: OS=macosx
78

89
public func foo() -> [Int] {
910
var a = [1, 2, 3]

test/embedded/generic-classes-debuginfo.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
// REQUIRES: executable_test
55
// REQUIRES: optimized_stdlib
6-
// REQUIRES: OS=macosx || OS=linux-gnu
6+
// REQUIRES: VENDOR=apple
7+
// REQUIRES: OS=macosx
78

89
struct User {
910
let o: BaseClass

test/embedded/generic-classes.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
// REQUIRES: swift_in_compiler
55
// REQUIRES: executable_test
66
// REQUIRES: optimized_stdlib
7-
// REQUIRES: OS=macosx || OS=linux-gnu
7+
// REQUIRES: VENDOR=apple
8+
// REQUIRES: OS=macosx
89

910
protocol Fooable {
1011
func foo()

test/embedded/lto.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
// REQUIRES: swift_in_compiler
77
// REQUIRES: executable_test
8+
// REQUIRES: VENDOR=apple
89
// REQUIRES: OS=macosx
910

1011
// For LTO, the linker dlopen()'s the libLTO library, which is a scenario that

test/embedded/metatypes.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
// REQUIRES: swift_in_compiler
44
// REQUIRES: optimized_stdlib
5-
// REQUIRES: OS=macosx || OS=linux-gnu
5+
// REQUIRES: VENDOR=apple
6+
// REQUIRES: OS=macosx
67

78
public func sink<T>(t: T) {}
89

test/embedded/modules-classes.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
// REQUIRES: swift_in_compiler
1111
// REQUIRES: executable_test
12-
// REQUIRES: OS=macosx || OS=linux-gnu
12+
// REQUIRES: VENDOR=apple
13+
// REQUIRES: OS=macosx
1314

1415
// BEGIN MyModule.swift
1516

test/embedded/modules-globals-exec.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
// REQUIRES: swift_in_compiler
1111
// REQUIRES: executable_test
12-
// REQUIRES: OS=macosx || OS=linux-gnu
12+
// REQUIRES: VENDOR=apple
13+
// REQUIRES: OS=macosx
1314

1415
// BEGIN MyModule.swift
1516

test/embedded/modules-globals-many.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
// RUN: %target-swift-frontend -emit-ir -I %t %t/Main.swift -enable-experimental-feature Embedded -parse-as-library | %FileCheck %s
88

99
// REQUIRES: swift_in_compiler
10-
// REQUIRES: OS=macosx || OS=linux-gnu
10+
// REQUIRES: VENDOR=apple
11+
// REQUIRES: OS=macosx
1112

1213
// Dependencies look like this:
1314
//
@@ -43,4 +44,4 @@ public func main() {
4344
MyModuleC.foo()
4445
}
4546

46-
// CHECK: @"$s9MyModuleA6globalSivp" = {{.*}}global %TSi zeroinitializer
47+
// CHECK: @"$s9MyModuleA6globalSivp" = global %TSi zeroinitializer

test/embedded/modules-globals.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
// RUN: %target-swift-frontend -emit-ir -I %t %t/Main.swift -enable-experimental-feature Embedded -parse-as-library | %FileCheck %s
66

77
// REQUIRES: swift_in_compiler
8-
// REQUIRES: OS=macosx || OS=linux-gnu
8+
// REQUIRES: VENDOR=apple
9+
// REQUIRES: OS=macosx
910

1011
// BEGIN MyModule.swift
1112

@@ -30,7 +31,7 @@ public func main() {
3031
foo()
3132
}
3233

33-
// CHECK: @"$s4Main022global_in_client_used_c1_D0Sivp" = {{.*}}global %TSi zeroinitializer
34-
// CHECK: @"$s4Main024global_in_client_unused_c1_D0Sivp" = {{.*}}global %TSi zeroinitializer
35-
// CHECK: @"$s8MyModule022global_in_module_used_d1_E0Sivp" = {{.*}}global %TSi zeroinitializer
36-
// CHECK: @"$s8MyModule024global_in_module_unused_d1_E0Sivp" = {{.*}}global %TSi zeroinitializer
34+
// CHECK: @"$s4Main022global_in_client_used_c1_D0Sivp" = global %TSi zeroinitializer
35+
// CHECK: @"$s4Main024global_in_client_unused_c1_D0Sivp" = global %TSi zeroinitializer
36+
// CHECK: @"$s8MyModule022global_in_module_used_d1_E0Sivp" = global %TSi zeroinitializer
37+
// CHECK: @"$s8MyModule024global_in_module_unused_d1_E0Sivp" = global %TSi zeroinitializer

test/embedded/modules-print-exec.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
// REQUIRES: swift_in_compiler
1111
// REQUIRES: executable_test
12-
// REQUIRES: OS=macosx || OS=linux-gnu
12+
// REQUIRES: VENDOR=apple
13+
// REQUIRES: OS=macosx
1314

1415
// BEGIN MyModule.swift
1516

test/embedded/no-autolink.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// RUN: %target-swift-frontend -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
22

33
// REQUIRES: swift_in_compiler
4-
// REQUIRES: OS=macosx || OS=linux-gnu
4+
// REQUIRES: VENDOR=apple
5+
// REQUIRES: OS=macosx
56

67
public func staticstring() -> StaticString {
78
return "hello"

0 commit comments

Comments
 (0)