Skip to content

Commit ea6295e

Browse files
authored
Merge pull request #71392 from kubamracek/revert-embedded-defines
Revert "Merge pull request #71278 from kubamracek/embedded-no-mach-defines"
2 parents 2072bf8 + dba8d5d commit ea6295e

File tree

13 files changed

+22
-30
lines changed

13 files changed

+22
-30
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -631,14 +631,6 @@ importer::getNormalInvocationArguments(
631631
});
632632
}
633633

634-
// To support -apple-none, -apple-none-macho, -unknown-none-wasm triples.
635-
if (triple.getVendor() == llvm::Triple::VendorType::Apple) {
636-
invocationArgStrs.insert(invocationArgStrs.end(), {"-D__APPLE__"});
637-
}
638-
if (triple.isOSBinFormatMachO()) {
639-
invocationArgStrs.insert(invocationArgStrs.end(), {"-D__MACH__"});
640-
}
641-
642634
if (triple.isOSWindows()) {
643635
switch (triple.getArch()) {
644636
default: llvm_unreachable("unsupported Windows architecture");

stdlib/public/Concurrency/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB AND SWIFT_SHOULD_BUILD_EMBEDDED_CONCURRENC
218218
if(NOT "${mod}" MATCHES "-macos$")
219219
continue()
220220
endif()
221-
set(extra_c_compile_flags -ffreestanding)
222-
set(extra_swift_compile_flags -Xcc -ffreestanding)
221+
set(extra_c_compile_flags -D__MACH__ -D__APPLE__ -ffreestanding)
222+
set(extra_swift_compile_flags -Xcc -D__MACH__ -Xcc -D__APPLE__ -Xcc -ffreestanding)
223223
endif()
224224

225225
set(SWIFT_SDK_embedded_ARCH_${mod}_MODULE "${mod}")

stdlib/public/Platform/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
113113
Darwin.swift.gyb
114114

115115
SWIFT_COMPILE_FLAGS
116-
-Xcc -ffreestanding -enable-experimental-feature Embedded
116+
-Xcc -D__MACH__ -Xcc -D__APPLE__ -Xcc -ffreestanding -enable-experimental-feature Embedded
117117
C_COMPILE_FLAGS
118-
-ffreestanding
118+
-D__MACH__ -D__APPLE__ -ffreestanding
119119
MODULE_DIR "${CMAKE_BINARY_DIR}/lib/swift/embedded"
120120
SDK "embedded"
121121
ARCHITECTURE "${arch}"

stdlib/public/SwiftShims/swift/shims/Visibility.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
// right for Windows, we have everything set up to get it right on
135135
// other targets as well, and doing so lets the compiler use more
136136
// efficient symbol access patterns.
137-
#if defined(__MACH__) || defined(__wasm__)
137+
#if defined(__MACH__) || defined(__wasi__)
138138

139139
// On Mach-O and WebAssembly, we use non-hidden visibility. We just use
140140
// default visibility on both imports and exports, both because these

stdlib/public/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
422422
${SWIFTLIB_EMBEDDED_SOURCES}
423423
GYB_SOURCES ${SWIFTLIB_EMBEDDED_GYB_SOURCES}
424424
SWIFT_COMPILE_FLAGS
425-
${swift_stdlib_compile_flags} -Xcc -ffreestanding -enable-experimental-feature Embedded
425+
${swift_stdlib_compile_flags} -Xcc -D__MACH__ -Xcc -D__APPLE__ -Xcc -ffreestanding -enable-experimental-feature Embedded
426426
-Xfrontend -enable-ossa-modules
427427
MODULE_DIR "${CMAKE_BINARY_DIR}/lib/swift/embedded"
428428
SDK "embedded"

test/embedded/fragile-reference.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2-
// RUN: %target-swift-frontend -target arm64-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
1+
// RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2+
// RUN: %target-swift-frontend -target arm64-apple-none-macho -module-name main -parse-as-library -Xcc -D__MACH__ -Xcc -D__arm64__ -Xcc -D__APPLE__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
33
// REQUIRES: swift_in_compiler
44
// REQUIRES: OS=macosx || OS=linux-gnu
55
// REQUIRES: CODEGENERATOR=ARM

test/embedded/ouroboros-bug.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// code, but in the embedded Swift's runtime that's somewhat reasonable thing
44
// to do (but is to be avoided because of this).
55

6-
// RUN: %target-swift-frontend -target armv7-apple-none-macho -assert-config Debug -Osize -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
7-
// RUN: %target-swift-frontend -target arm64-apple-none-macho -assert-config Debug -Osize -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
6+
// RUN: %target-swift-frontend -target armv7-apple-none-macho -assert-config Debug -Osize -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
7+
// RUN: %target-swift-frontend -target arm64-apple-none-macho -assert-config Debug -Osize -Xcc -D__MACH__ -Xcc -D__arm64__ -Xcc -D__APPLE__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
88

99
// REQUIRES: swift_in_compiler
1010
// REQUIRES: optimized_stdlib

test/embedded/stdlib-array.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2-
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
1+
// RUN: %target-swift-frontend -target armv7-apple-none-macho -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2+
// RUN: %target-swift-frontend -target arm64-apple-none-macho -Xcc -D__MACH__ -Xcc -D__arm64__ -Xcc -D__APPLE__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
33

44
// REQUIRES: swift_in_compiler
55
// REQUIRES: optimized_stdlib

test/embedded/stdlib-basic.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2-
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
1+
// RUN: %target-swift-frontend -target armv7-apple-none-macho -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2+
// RUN: %target-swift-frontend -target arm64-apple-none-macho -Xcc -D__MACH__ -Xcc -D__arm64__ -Xcc -D__APPLE__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
33

44
// REQUIRES: swift_in_compiler
55
// REQUIRES: CODEGENERATOR=ARM

test/embedded/stdlib-dictionary.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2-
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
1+
// RUN: %target-swift-frontend -target armv7-apple-none-macho -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2+
// RUN: %target-swift-frontend -target arm64-apple-none-macho -Xcc -D__MACH__ -Xcc -D__arm64__ -Xcc -D__APPLE__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
33

44
// REQUIRES: swift_in_compiler
55
// REQUIRES: optimized_stdlib

test/embedded/stdlib-random.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2-
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
1+
// RUN: %target-swift-frontend -target armv7-apple-none-macho -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2+
// RUN: %target-swift-frontend -target arm64-apple-none-macho -Xcc -D__MACH__ -Xcc -D__arm64__ -Xcc -D__APPLE__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
33

44
// REQUIRES: swift_in_compiler
55
// REQUIRES: optimized_stdlib

test/embedded/stdlib-set.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2-
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
1+
// RUN: %target-swift-frontend -target armv7-apple-none-macho -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2+
// RUN: %target-swift-frontend -target arm64-apple-none-macho -Xcc -D__MACH__ -Xcc -D__arm64__ -Xcc -D__APPLE__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
33

44
// REQUIRES: swift_in_compiler
55
// REQUIRES: optimized_stdlib

test/embedded/stdlib-types.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2-
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
1+
// RUN: %target-swift-frontend -target armv7-apple-none-macho -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
2+
// RUN: %target-swift-frontend -target arm64-apple-none-macho -Xcc -D__MACH__ -Xcc -D__arm64__ -Xcc -D__APPLE__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
33

44
// REQUIRES: swift_in_compiler
55
// REQUIRES: optimized_stdlib

0 commit comments

Comments
 (0)