diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2015-07-01 02:10:26 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2015-07-01 02:10:26 +0000 |
commit | 8fabc1b47d0237f363c1a34dc5de744973c74891 (patch) | |
tree | 32d3aa3ed5c02d5567c4866fda8cac696b415e65 /clang/lib/CodeGen/ItaniumCXXABI.cpp | |
parent | 035f6dc9d1abe3ee88b6df1e5e46ee4c46d33da8 (diff) | |
download | bcm5719-llvm-8fabc1b47d0237f363c1a34dc5de744973c74891.tar.gz bcm5719-llvm-8fabc1b47d0237f363c1a34dc5de744973c74891.zip |
CodeGen: Do not give local-linkage functions externally available linkage, even temporarily.
When an internal-linkage thunk is code gen'd, CodeGenVTables::emitThunk
will first be called with ForVTable=true (which incorrectly set the
thunk's linkage to available_externally under the Itanium ABI) and later
with ForVTable=false (which reset it to internal). Because we will always
see a call with ForVTable=false, this incorrect linkage never ended up in
the final IR. However, the temporary presence of this linkage caused us
to give such functions a comdat as a result of code introduced in r241102.
To avoid this, check that the thunk is externally visible before giving it
available_externally linkage.
llvm-svn: 241136
Diffstat (limited to 'clang/lib/CodeGen/ItaniumCXXABI.cpp')
-rw-r--r-- | clang/lib/CodeGen/ItaniumCXXABI.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index d7dfe8bfa20..fa86e52ec80 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -219,7 +219,7 @@ public: bool ReturnAdjustment) override { // Allow inlining of thunks by emitting them with available_externally // linkage together with vtables when needed. - if (ForVTable) + if (ForVTable && !Thunk->hasLocalLinkage()) Thunk->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage); } |