mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Expose function sections option (#28088)
* Expose separate function sections option to compiler * Add function sections test
This commit is contained in:
committed by
Saleem Abdulrasool
parent
d8cc616602
commit
eed6a4eb94
5
test/LinkerSections/Inputs/FunctionSections.swift
Normal file
5
test/LinkerSections/Inputs/FunctionSections.swift
Normal file
@@ -0,0 +1,5 @@
|
||||
public typealias Void = ()
|
||||
|
||||
public func func1() -> Void {}
|
||||
|
||||
public func func2() -> Void {}
|
||||
3
test/LinkerSections/Inputs/FunctionSectionsUse.swift
Normal file
3
test/LinkerSections/Inputs/FunctionSectionsUse.swift
Normal file
@@ -0,0 +1,3 @@
|
||||
import FunctionSections
|
||||
|
||||
func1()
|
||||
10
test/LinkerSections/function_sections.swift
Normal file
10
test/LinkerSections/function_sections.swift
Normal file
@@ -0,0 +1,10 @@
|
||||
// REQUIRES: OS=linux-gnu || OS=linux-androideabi || OS=linux-android || OS=freebsd
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-build-swift -Xfrontend -function-sections -emit-module -emit-library -static -parse-stdlib %S/Inputs/FunctionSections.swift
|
||||
// RUN: %target-build-swift -Xlinker --gc-sections -Xlinker -Map=%t/../../FunctionSections.map -I%t/../.. -L%t/../.. -lFunctionSections %S/Inputs/FunctionSectionsUse.swift
|
||||
// RUN: %FileCheck %s < %t/../../FunctionSections.map
|
||||
|
||||
// CHECK: Discarded input sections
|
||||
// CHECK: .text.$s16FunctionSections5func2yyF
|
||||
// CHECK: Memory map
|
||||
// CHECK: .text.$s16FunctionSections5func1yyF
|
||||
12
test/LinkerSections/function_sections_ir_check.swift
Normal file
12
test/LinkerSections/function_sections_ir_check.swift
Normal file
@@ -0,0 +1,12 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-build-swift -Xfrontend -function-sections -emit-library -emit-ir -static -parse-stdlib %S/Inputs/FunctionSections.swift | %FileCheck %s
|
||||
|
||||
// CHECK: define {{(dllexport |protected )?}}swiftcc void @"$s16FunctionSections5func1yyF"() #0 {
|
||||
// CHECK: entry:
|
||||
// CHECK: ret void
|
||||
// CHECK: }
|
||||
|
||||
// CHECK: define {{(dllexport |protected )?}}swiftcc void @"$s16FunctionSections5func2yyF"() #0 {
|
||||
// CHECK: entry:
|
||||
// CHECK: ret void
|
||||
// CHECK: }
|
||||
Reference in New Issue
Block a user