Skip to content

Commit 1de737f

Browse files
committed
Add function sections test
1 parent 439d0ca commit 1de737f

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public typealias Void = ()
2+
3+
public func func1() -> Void {}
4+
5+
public func func2() -> Void {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import FunctionSections
2+
3+
func1()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// REQUIRES: OS=linux-gnu || OS=linux-androideabi || OS=linux-android || OS=freebsd
2+
// RUN: %empty-directory(%t)
3+
// RUN: %target-build-swift -Xfrontend -function-sections -emit-module -emit-library -static -parse-stdlib %S/Inputs/FunctionSections.swift
4+
// RUN: %target-build-swift -Xlinker --gc-sections -Xlinker -Map=%t/../../FunctionSections.map -I%t/../.. -L%t/../.. -lFunctionSections %S/Inputs/FunctionSectionsUse.swift
5+
// RUN: %FileCheck %s < %t/../../FunctionSections.map
6+
7+
// CHECK: Discarded input sections
8+
// CHECK: .text.$s16FunctionSections5func2yyF
9+
// CHECK: Memory map
10+
// CHECK: .text.$s16FunctionSections5func1yyF
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift -Xfrontend -function-sections -emit-library -emit-ir -static -parse-stdlib %S/Inputs/FunctionSections.swift | %FileCheck %s
3+
4+
// CHECK: define {{(dllexport |protected )?}}swiftcc void @"$s16FunctionSections5func1yyF"() #0 {
5+
// CHECK: entry:
6+
// CHECK: ret void
7+
// CHECK: }
8+
9+
// CHECK: define {{(dllexport |protected )?}}swiftcc void @"$s16FunctionSections5func2yyF"() #0 {
10+
// CHECK: entry:
11+
// CHECK: ret void
12+
// CHECK: }

0 commit comments

Comments
 (0)