Skip to content

Commit 2b876c0

Browse files
committed
Merge pull request #2418 from apple/make-microstdlib-executable
Make the MicroStdlib test executable
2 parents cb0b2d4 + 1d23085 commit 2b876c0

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
int _TMBi32_;
2+
int _TMBi64_;
3+
int _TMBi8_;
4+
void _swift_getEnumCaseSinglePayload(void) {}
5+
void _swift_getGenericMetadata(void) {}
6+
void _swift_slowAlloc(void) {}
7+
void _swift_slowDealloc(void) {}
8+
void _swift_storeEnumTagSinglePayload(void) {}
9+
void swift_allocateGenericValueMetadata(void) {}
10+
void swift_initEnumValueWitnessTableSinglePayload(void) {}
11+

validation-test/stdlib/MicroStdlib.swift renamed to validation-test/stdlib/MicroStdlib/Inputs/Swift.swift

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// RUN: rm -rf %t
2-
// RUN: mkdir %t
3-
// RUN: %target-build-swift -c -force-single-frontend-invocation -parse-as-library -parse-stdlib -module-name Swift -emit-module -emit-module-path %t/Swift.swiftmodule -o %t/Swift.o %s
4-
// RUN: ls %t/Swift.swiftmodule
5-
// RUN: ls %t/Swift.swiftdoc
6-
// RUN: ls %t/Swift.o
7-
// REQUIRES: executable_test
8-
91
//
102
// A bare-bones Swift standard library
113
//
@@ -90,6 +82,18 @@ public struct UnsafeMutablePointer<T> {
9082
public typealias CInt = Int32
9183
public typealias CChar = Int8
9284

85+
@_silgen_name("putchar")
86+
public func putchar(_: CChar)
87+
88+
public func printHello() {
89+
putchar(0x48)
90+
putchar(0x65)
91+
putchar(0x6c)
92+
putchar(0x6c)
93+
putchar(0x6f)
94+
putchar(0x0a)
95+
}
96+
9397
//public var C_ARGC: CInt = CInt()
9498

9599
//public var C_ARGV: UnsafeMutablePointer<UnsafeMutablePointer<Int8>> = UnsafeMutablePointer()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
printHello()
2+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: rm -rf %t
2+
// RUN: mkdir %t
3+
// RUN: %target-build-swift -c -force-single-frontend-invocation -parse-as-library -parse-stdlib -module-name Swift -emit-module -emit-module-path %t/Swift.swiftmodule -o %t/Swift.o %S/Inputs/Swift.swift
4+
// RUN: ls %t/Swift.swiftmodule
5+
// RUN: ls %t/Swift.swiftdoc
6+
// RUN: ls %t/Swift.o
7+
// RUN: %target-clang -x c -c %S/Inputs/RuntimeStubs.c -o %t/RuntimeStubs.o
8+
// RUN: %target-build-swift -I %t -module-name main -o %t/hello %S/Inputs/main.swift %t/Swift.o %t/RuntimeStubs.o
9+
// RUN: %target-run %t/hello | FileCheck %s
10+
// REQUIRES: executable_test
11+
// CHECK: Hello
12+

0 commit comments

Comments
 (0)