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") }

0 commit comments

Comments
 (0)