summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/TargetMachine.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2015-01-09 18:55:42 +0000
committerLang Hames <lhames@gmail.com>2015-01-09 18:55:42 +0000
commit1e923ec1225be4d1c48db75ef8c84866abef75ba (patch)
tree95f2ff912b1233641708a503d5f7e3482d1b90d2 /llvm/lib/Target/TargetMachine.cpp
parentd527199c378995a3f9d1fdfc45689a77999e53e4 (diff)
downloadbcm5719-llvm-1e923ec1225be4d1c48db75ef8c84866abef75ba.tar.gz
bcm5719-llvm-1e923ec1225be4d1c48db75ef8c84866abef75ba.zip
Recommit r224935 with a fix for the ObjC++/AArch64 bug that that revision
introduced. A test case for the bug was already committed in r225385. Patch by Rafael Espindola. llvm-svn: 225534
Diffstat (limited to 'llvm/lib/Target/TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/TargetMachine.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index 309e1bf2786..b3ff0010c43 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -21,6 +21,7 @@
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCCodeGenInfo.h"
#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Support/CommandLine.h"
@@ -169,6 +170,19 @@ void TargetMachine::setDataSections(bool V) {
Options.DataSections = V;
}
+static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo,
+ const MCSection &Section) {
+ if (!AsmInfo.isSectionAtomizableBySymbols(Section))
+ return true;
+
+ // If it is not dead stripped, it is safe to use private labels.
+ const MCSectionMachO &SMO = cast<MCSectionMachO>(Section);
+ if (SMO.hasAttribute(MachO::S_ATTR_NO_DEAD_STRIP))
+ return true;
+
+ return false;
+}
+
void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name,
const GlobalValue *GV, Mangler &Mang,
bool MayAlwaysUsePrivate) const {
@@ -182,7 +196,7 @@ void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name,
const TargetLoweringObjectFile &TLOF =
getSubtargetImpl()->getTargetLowering()->getObjFileLowering();
const MCSection *TheSection = TLOF.SectionForGlobal(GV, GVKind, Mang, *this);
- bool CannotUsePrivateLabel = TLOF.isSectionAtomizableBySymbols(*TheSection);
+ bool CannotUsePrivateLabel = !canUsePrivateLabel(*AsmInfo, *TheSection);
Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel);
}
OpenPOWER on IntegriCloud