diff options
author | John McCall <rjmccall@apple.com> | 2011-09-19 18:05:26 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-09-19 18:05:26 +0000 |
commit | 28a5b326e1cfaf610f361e774dcedad2ec56f294 (patch) | |
tree | 2050ec91cd99476c187f84080ff008dcff2bd813 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 264abdecf0b5e026ad610b9551bb63b5541052f0 (diff) | |
download | bcm5719-llvm-28a5b326e1cfaf610f361e774dcedad2ec56f294.tar.gz bcm5719-llvm-28a5b326e1cfaf610f361e774dcedad2ec56f294.zip |
In apple-kext mode, use external linkage for explicit template instantiations
instead of internal linkage.
llvm-svn: 140030
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 19c3b064d65..917f4b7545a 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -400,7 +400,12 @@ CodeGenModule::getFunctionLinkage(const FunctionDecl *D) { // definition somewhere else, so we can use available_externally linkage. if (Linkage == GVA_C99Inline) return llvm::Function::AvailableExternallyLinkage; - + + // Note that Apple's kernel linker doesn't support symbol + // coalescing, so we need to avoid linkonce and weak linkages there. + // Normally, this means we just map to internal, but for explicit + // instantiations we'll map to external. + // In C++, the compiler has to emit a definition in every translation unit // that references the function. We should use linkonce_odr because // a) if all references in this translation unit are optimized away, we @@ -419,7 +424,7 @@ CodeGenModule::getFunctionLinkage(const FunctionDecl *D) { if (Linkage == GVA_ExplicitTemplateInstantiation) return !Context.getLangOptions().AppleKext ? llvm::Function::WeakODRLinkage - : llvm::Function::InternalLinkage; + : llvm::Function::ExternalLinkage; // Otherwise, we have strong external linkage. assert(Linkage == GVA_StrongExternal); |