summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/IR/Mangler.h6
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp9
-rw-r--r--llvm/lib/IR/Mangler.cpp10
3 files changed, 12 insertions, 13 deletions
diff --git a/llvm/include/llvm/IR/Mangler.h b/llvm/include/llvm/IR/Mangler.h
index 1e6b5b1dca0..b44d1c8c232 100644
--- a/llvm/include/llvm/IR/Mangler.h
+++ b/llvm/include/llvm/IR/Mangler.h
@@ -52,9 +52,11 @@ public:
/// If the global variable doesn't have a name, this fills in a unique name
/// for the global.
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
- bool CannotUsePrivateLabel) const;
+ bool CannotUsePrivateLabel,
+ bool ForceNonPrivate = false) const;
void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
- bool CannotUsePrivateLabel) const;
+ bool CannotUsePrivateLabel,
+ bool ForceNonPrivate = false) const;
/// Print the appropriate prefix and the specified name as the global variable
/// name. GVName must not be empty.
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 5a8367eea77..10729cd81a5 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -960,13 +960,8 @@ void TargetLoweringObjectFileCOFF::getNameWithPrefix(
((isa<Function>(GV) && TM.getFunctionSections()) ||
(isa<GlobalVariable>(GV) && TM.getDataSections()))) {
SmallString<256> Tmp;
- Mang.getNameWithPrefix(Tmp, GV, /*CannotUsePrivateLabel=*/false);
- if (Tmp.startswith(".L"))
- OutName.append(Tmp.begin() + 2, Tmp.end());
- else if (Tmp.startswith("L"))
- OutName.append(Tmp.begin() + 1, Tmp.end());
- else
- OutName.append(Tmp.begin(), Tmp.end());
+ Mang.getNameWithPrefix(Tmp, GV, CannotUsePrivateLabel, /*ForceNonPrivate=*/true);
+ OutName.append(Tmp.begin(), Tmp.end());
return;
}
Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp
index a0e1b25056c..2ba5998c805 100644
--- a/llvm/lib/IR/Mangler.cpp
+++ b/llvm/lib/IR/Mangler.cpp
@@ -91,9 +91,10 @@ static void addByteCountSuffix(raw_ostream &OS, const Function *F,
}
void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
- bool CannotUsePrivateLabel) const {
+ bool CannotUsePrivateLabel,
+ bool ForceNonPrivate) const {
ManglerPrefixTy PrefixTy = Mangler::Default;
- if (GV->hasPrivateLinkage()) {
+ if (GV->hasPrivateLinkage() && !ForceNonPrivate) {
if (CannotUsePrivateLabel)
PrefixTy = Mangler::LinkerPrivate;
else
@@ -152,7 +153,8 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
const GlobalValue *GV,
- bool CannotUsePrivateLabel) const {
+ bool CannotUsePrivateLabel,
+ bool ForceNonPrivate) const {
raw_svector_ostream OS(OutName);
- getNameWithPrefix(OS, GV, CannotUsePrivateLabel);
+ getNameWithPrefix(OS, GV, CannotUsePrivateLabel, ForceNonPrivate);
}
OpenPOWER on IntegriCloud