/// HasMachoZeroFillDirective - True if this is a MachO target that supports
/// the macho-specific .zerofill directive for emitting BSS Symbols.
- bool HasMachoZeroFillDirective; // Default is false.
+ bool HasMachoZeroFillDirective; // Default is false.
+
+ /// HasStaticCtorDtorReferenceInStaticMode - True if the compiler should
+ /// emit a ".reference .constructors_used" or ".reference .destructors_used"
+ /// directive after the a static ctor/dtor list. This directive is only
+ /// emitted in Static relocation model.
+ bool HasStaticCtorDtorReferenceInStaticMode; // Default is false.
/// NeedsSet - True if target asm treats expressions in data directives
/// as linktime-relocatable. For assembly-time computation, we need to
// Accessors.
//
bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; }
-
+ bool hasStaticCtorDtorReferenceInStaticMode() const {
+ return HasStaticCtorDtorReferenceInStaticMode;
+ }
const char *getNonexecutableStackDirective() const {
return NonexecutableStackDirective;
}
OutStreamer.SwitchSection(getObjFileLowering().getStaticCtorSection());
EmitAlignment(Align, 0);
EmitXXStructorList(GV->getInitializer());
+
+ if (TM.getRelocationModel() == Reloc::Static &&
+ MAI->hasStaticCtorDtorReferenceInStaticMode())
+ O << ".reference .constructors_used\n";
return true;
}
OutStreamer.SwitchSection(getObjFileLowering().getStaticDtorSection());
EmitAlignment(Align, 0);
EmitXXStructorList(GV->getInitializer());
+
+ if (TM.getRelocationModel() == Reloc::Static &&
+ MAI->hasStaticCtorDtorReferenceInStaticMode())
+ O << ".reference .destructors_used\n";
return true;
}
MCAsmInfo::MCAsmInfo() {
HasMachoZeroFillDirective = false;
+ HasStaticCtorDtorReferenceInStaticMode = false;
NonexecutableStackDirective = 0;
NeedsSet = false;
MaxInstLength = 4;
LCOMMDirective = "\t.lcomm\t";
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
HasMachoZeroFillDirective = true; // Uses .zerofill
+ HasStaticCtorDtorReferenceInStaticMode = true;
SetDirective = "\t.set";
ProtectedDirective = "\t.globl\t";
HasDotTypeDotSizeDirective = false;
return;
// Check to see if this is a special global used by LLVM, if so, emit it.
-
- if (EmitSpecialLLVMGlobal(GVar)) {
- if (Subtarget->isTargetDarwin() &&
- TM.getRelocationModel() == Reloc::Static) {
- if (GVar->getName() == "llvm.global_ctors")
- O << ".reference .constructors_used\n";
- else if (GVar->getName() == "llvm.global_dtors")
- O << ".reference .destructors_used\n";
- }
+ if (EmitSpecialLLVMGlobal(GVar))
return;
- }
MCSymbol *GVarSym = GetGlobalValueSymbol(GVar);
return; // External global require no code
// Check to see if this is a special global used by LLVM, if so, emit it.
- if (EmitSpecialLLVMGlobal(GVar)) {
- if (TM.getRelocationModel() == Reloc::Static) {
- if (GVar->getName() == "llvm.global_ctors")
- O << ".reference .constructors_used\n";
- else if (GVar->getName() == "llvm.global_dtors")
- O << ".reference .destructors_used\n";
- }
+ if (EmitSpecialLLVMGlobal(GVar))
return;
- }
MCSymbol *GVarSym = GetGlobalValueSymbol(GVar);
printVisibility(GVarSym, GVar->getVisibility());
return; // External global require no code
// Check to see if this is a special global used by LLVM, if so, emit it.
- if (EmitSpecialLLVMGlobal(GVar)) {
- if (Subtarget->isTargetDarwin() &&
- TM.getRelocationModel() == Reloc::Static) {
- if (GVar->getName() == "llvm.global_ctors")
- O << ".reference .constructors_used\n";
- else if (GVar->getName() == "llvm.global_dtors")
- O << ".reference .destructors_used\n";
- }
+ if (EmitSpecialLLVMGlobal(GVar))
return;
- }
const TargetData *TD = TM.getTargetData();