mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Embedded] Identify more places to emit symbols even with deferred code generation
Deferred code generation only produces symbols when they are needed. Expand this out to cover more of the cases where we need them: * @c/@_cdecl with and without @implementation * @_expose(Cxx) and @_expose(Wasm) * @_section and @_used * (already present) the main entry point Part of the Embedded Swift linkage model. Also fixes #74328 / rdar://147207945 along the way.
This commit is contained in:
@@ -1069,6 +1069,18 @@ SILFunction::isPossiblyUsedExternally() const {
|
||||
if (markedAsUsed())
|
||||
return true;
|
||||
|
||||
// If this function is exposed to a foreign language, it can be used
|
||||
// externally (by that language).
|
||||
if (auto decl = getDeclRef().getDecl()) {
|
||||
if (SILDeclRef::declExposedToForeignLanguage(decl))
|
||||
return true;
|
||||
}
|
||||
|
||||
// If this function was explicitly placed in a section or given a WebAssembly
|
||||
// export, it can be used externally.
|
||||
if (!Section.empty() || !WasmExportName.empty())
|
||||
return true;
|
||||
|
||||
if (shouldBePreservedForDebugger())
|
||||
return true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user