aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/TargetLoweringObjectFile.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-31 20:52:39 +0000
committerChris Lattner <sabre@nondot.org>2009-07-31 20:52:39 +0000
commit26630c1180502d07c9b2b4a9a4ba06bc5ddf180b (patch)
tree29c36c86ec272ac013e35f333ae760fc558b941e /lib/Target/TargetLoweringObjectFile.cpp
parentcc726599ae7d44ad962696f523eb91675d338b96 (diff)
move emitUsedDirectiveFor to TargetLoweringObjectFile and rename it to
indicate that it is a predicate, not an emitter. This eliminates TAI dependencies on Mangler and GlobalValue. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77726 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetLoweringObjectFile.cpp')
-rw-r--r--lib/Target/TargetLoweringObjectFile.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index 36fda0b958..9ba12bb218 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/lib/Target/TargetLoweringObjectFile.cpp
@@ -585,6 +585,29 @@ getSectionForMergeableConstant(SectionKind Kind) const {
return ReadOnlySection; // .const
}
+/// shouldEmitUsedDirectiveFor - This hook allows targets to selectively decide
+/// not to emit the UsedDirective for some symbols in llvm.used.
+// FIXME: REMOVE this (rdar://7071300)
+bool TargetLoweringObjectFileMachO::
+shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const {
+ /// On Darwin, internally linked data beginning with "L" or "l" does not have
+ /// the directive emitted (this occurs in ObjC metadata).
+ if (!GV) return false;
+
+ // Check whether the mangled name has the "Private" or "LinkerPrivate" prefix.
+ if (GV->hasLocalLinkage() && !isa<Function>(GV)) {
+ // FIXME: ObjC metadata is currently emitted as internal symbols that have
+ // \1L and \0l prefixes on them. Fix them to be Private/LinkerPrivate and
+ // this horrible hack can go away.
+ const std::string &Name = Mang->getMangledName(GV);
+ if (Name[0] == 'L' || Name[0] == 'l')
+ return false;
+ }
+
+ return true;
+}
+
+
//===----------------------------------------------------------------------===//
// COFF
//===----------------------------------------------------------------------===//