mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #85776 from DougGregor/extern-global-variables-embedded
[Embedded] Only strip "external" from global variables that have definitions
This commit is contained in:
@@ -522,7 +522,8 @@ void SILLinkerVisitor::visitGlobalAddrInst(GlobalAddrInst *GAI) {
|
||||
// In Embedded Swift, we want to actually link globals from other modules too,
|
||||
// so strip "external" from the linkage.
|
||||
SILGlobalVariable *G = GAI->getReferencedGlobal();
|
||||
G->setLinkage(stripExternalFromLinkage(G->getLinkage()));
|
||||
if (G->isDefinition())
|
||||
G->setLinkage(stripExternalFromLinkage(G->getLinkage()));
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -21,8 +21,12 @@ public func publicFuncInAModule() {
|
||||
@usableFromInline
|
||||
internal func internalFuncInAModule() {
|
||||
some_c_api()
|
||||
_ = globalVariable
|
||||
}
|
||||
|
||||
@_extern(c)
|
||||
var globalVariable: Int
|
||||
|
||||
// BEGIN Main.swift
|
||||
|
||||
import MyModule
|
||||
|
||||
Reference in New Issue
Block a user