struct DarwinTargetAsmInfo : public TargetAsmInfo {
explicit DarwinTargetAsmInfo(const TargetMachine &TM);
- virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
- Mangler *Mang) const;
};
}
namespace llvm {
template <typename T> class SmallVectorImpl;
class TargetMachine;
- class GlobalValue;
- class Mangler;
// DWARF encoding query type
namespace DwarfEncoding {
/// length.
virtual unsigned getInlineAsmLength(const char *Str) const;
- /// emitUsedDirectiveFor - This hook allows targets to selectively decide
- /// not to emit the UsedDirective for some symbols in llvm.used.
-// FIXME: REMOVE this (rdar://7071300)
- virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
- Mangler *) const {
- return (GV!=0);
- }
-
/// PreferredEHDataFormat - This hook allows the target to select data
/// format used for encoding pointers in exception handling data. Reason is
/// 0 for data, 1 for code labels, 2 for function pointers. Global is true
const MCSection *getTextSection() const { return TextSection; }
const MCSection *getDataSection() const { return DataSection; }
+ /// shouldEmitUsedDirectiveFor - This hook allows targets to selectively
+ /// decide not to emit the UsedDirective for some symbols in llvm.used.
+ /// FIXME: REMOVE this (rdar://7071300)
+ virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV,
+ Mangler *) const {
+ return (GV!=0);
+ }
/// getSectionForMergeableConstant - Given a mergeable constant with the
/// specified size and relocation information, return a section that it
virtual const MCSection *
getSectionForMergeableConstant(SectionKind Kind) 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)
+ virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV,
+ Mangler *) const;
};
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
const GlobalValue *GV =
dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());
- if (GV && TAI->emitUsedDirectiveFor(GV, Mang)) {
+ if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, Mang)) {
O << Directive;
EmitConstantValueOnly(InitList->getOperand(i));
O << '\n';
DwarfMacroInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
}
-/// emitUsedDirectiveFor - On Darwin, internally linked data beginning with
-/// the PrivateGlobalPrefix or the LinkerPrivateGlobalPrefix does not have the
-/// directive emitted (this occurs in ObjC metadata).
-bool DarwinTargetAsmInfo::emitUsedDirectiveFor(const GlobalValue* GV,
- Mangler *Mang) const {
- 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;
-}
-
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
//===----------------------------------------------------------------------===//