Skip to content

Commit 1f46c56

Browse files
authored
Merge pull request #4927 from eeckstein/fix-linkage
2 parents ff4f2ce + fd61338 commit 1f46c56

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

include/swift/SIL/SILFunction.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ class SILFunction
358358
case PublicClass:
359359
if (L == SILLinkage::Private || L == SILLinkage::Hidden)
360360
return SILLinkage::Public;
361+
if (L == SILLinkage::PrivateExternal || L == SILLinkage::HiddenExternal)
362+
return SILLinkage::PublicExternal;
361363
break;
362364
}
363365
return L;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
open class Base {
3+
private func privateFunc() -> Int {
4+
return 27
5+
}
6+
internal func internalFunc() -> Int {
7+
return 28
8+
}
9+
10+
private var privateVar: Int = 29
11+
internal var internalVar: Int = 30
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: rm -rf %t && mkdir -p %t
2+
// RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/BaseModule.%target-dylib-extension
3+
// RUN: %target-build-swift -I %t %s %t/BaseModule.%target-dylib-extension -o %t/a.out
4+
5+
// Check if the program can be linked without undefined symbol errors.
6+
7+
import BaseModule
8+
9+
public class Derived : Base {
10+
}
11+
12+
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// RUN: %target-build-swift -emit-module -emit-library %S/Inputs/public_var_private_setter.swift
22
// RUN: %target-build-swift -I . -L . -lpublic_var_private_setter %s -o use_public_var_private_setter
33

4-
// On Linux, the linker step of this test fails with "Bad value", specifically:
5-
// "hidden symbol `_TFC25public_var_private_setter9BaseClasscfT_S0_' isn't defined".
6-
// XFAIL: linux
7-
84
import public_var_private_setter
95

106
class Class: BaseClass {}

0 commit comments

Comments
 (0)