forked from OSchip/llvm-project
LTO: Use the correct mangler function in LTOCodeGenerator::applyScopeRestrictions().
We need to use the overload of Mangler::getNameWithPrefix that takes a GlobalValue in order to mangle in the stdcall stack byte count for Windows targets. Differential Revision: https://reviews.llvm.org/D25529 llvm-svn: 284040
This commit is contained in:
parent
2f159a265a
commit
46aafc16e8
|
@ -410,6 +410,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
|
||||||
|
|
||||||
// Declare a callback for the internalize pass that will ask for every
|
// Declare a callback for the internalize pass that will ask for every
|
||||||
// candidate GlobalValue if it can be internalized or not.
|
// candidate GlobalValue if it can be internalized or not.
|
||||||
|
Mangler Mang;
|
||||||
SmallString<64> MangledName;
|
SmallString<64> MangledName;
|
||||||
auto mustPreserveGV = [&](const GlobalValue &GV) -> bool {
|
auto mustPreserveGV = [&](const GlobalValue &GV) -> bool {
|
||||||
// Unnamed globals can't be mangled, but they can't be preserved either.
|
// Unnamed globals can't be mangled, but they can't be preserved either.
|
||||||
|
@ -421,8 +422,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
|
||||||
// underscore.
|
// underscore.
|
||||||
MangledName.clear();
|
MangledName.clear();
|
||||||
MangledName.reserve(GV.getName().size() + 1);
|
MangledName.reserve(GV.getName().size() + 1);
|
||||||
Mangler::getNameWithPrefix(MangledName, GV.getName(),
|
Mang.getNameWithPrefix(MangledName, &GV, /*CannotUsePrivateLabel=*/false);
|
||||||
MergedModule->getDataLayout());
|
|
||||||
return MustPreserveSymbols.count(MangledName);
|
return MustPreserveSymbols.count(MangledName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
; RUN: llvm-as < %s > %t
|
||||||
|
; RUN: llvm-lto -exported-symbol=_DllMain@12 -filetype=asm -o - %t | FileCheck %s
|
||||||
|
|
||||||
|
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
|
||||||
|
target triple = "i386-pc-windows-msvc19.0.23918"
|
||||||
|
|
||||||
|
; CHECK: .globl _DllMain@12
|
||||||
|
define x86_stdcallcc i32 @DllMain(i8* %module, i32 %reason, i8* %reserved) {
|
||||||
|
ret i32 1
|
||||||
|
}
|
Loading…
Reference in New Issue