Skip to content

Commit aa5458e

Browse files
committed
[Test] Fix function_sections test to support different linkers.
`gold` and `lld` produce map files in different formats; this test can and should work for both of them. rdar://123504095
1 parent b37cd62 commit aa5458e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
// REQUIRES: OS=linux-gnu || OS=freebsd
22
// RUN: %empty-directory(%t)
33
// 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
4+
// RUN: %target-build-swift -Xlinker -v -Xlinker --gc-sections -Xlinker -Map=%t/../../FunctionSections.map -I%t/../.. -L%t/../.. -lFunctionSections %S/Inputs/FunctionSectionsUse.swift 2>&1 | sed 's/.*\(gold\|LLD\).*/\1/g' | tr "[:lower:]" "[:upper:]" > %t/../../Linker.txt
5+
// RUN: %FileCheck --check-prefix $(cat %t/../../Linker.txt) %s < %t/../../FunctionSections.map
66

7-
// CHECK: Discarded input sections
8-
// CHECK: .text.$s16FunctionSections5func2yyF
9-
// CHECK: Memory map
10-
// CHECK: .text.$s16FunctionSections5func1yyF
7+
// GOLD: Discarded input sections
8+
// GOLD: .text.$s16FunctionSections5func2yyF
9+
// GOLD: Memory map
10+
// GOLD: .text.$s16FunctionSections5func1yyF
11+
12+
// LLD: .text.$s16FunctionSections5func1yyF
13+
// LLD-NOT: .text.$s16FunctionSections5func2yyF

0 commit comments

Comments
 (0)