mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-18 13:34:04 +00:00
Darwin -static should codegen static ctors / dtors to .constructor / .destructor sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33657 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c322a9ac14
commit
b267ca17d1
@ -714,8 +714,16 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
|
||||
if (!I->hasInitializer()) // External global require no code
|
||||
continue;
|
||||
|
||||
if (EmitSpecialLLVMGlobal(I))
|
||||
if (EmitSpecialLLVMGlobal(I)) {
|
||||
if (Subtarget->isTargetDarwin() &&
|
||||
TM.getRelocationModel() == Reloc::Static) {
|
||||
if (I->getName() == "llvm.global_ctors")
|
||||
O << ".reference .constructors_used\n";
|
||||
else if (I->getName() == "llvm.global_dtors")
|
||||
O << ".reference .destructors_used\n";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string name = Mang->getValueName(I);
|
||||
Constant *C = I->getInitializer();
|
||||
|
@ -28,8 +28,13 @@ ARMTargetAsmInfo::ARMTargetAsmInfo(const ARMTargetMachine &TM) {
|
||||
JumpTableDataSection = ".const";
|
||||
CStringSection = "\t.cstring";
|
||||
HasDotTypeDotSizeDirective = false;
|
||||
StaticCtorsSection = ".mod_init_func";
|
||||
StaticDtorsSection = ".mod_term_func";
|
||||
if (TM.getRelocationModel() == Reloc::Static) {
|
||||
StaticCtorsSection = ".constructor";
|
||||
StaticDtorsSection = ".destructor";
|
||||
} else {
|
||||
StaticCtorsSection = ".mod_init_func";
|
||||
StaticDtorsSection = ".mod_term_func";
|
||||
}
|
||||
|
||||
// In non-PIC modes, emit a special label before jump tables so that the
|
||||
// linker can perform more accurate dead code stripping.
|
||||
|
@ -855,8 +855,15 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
|
||||
if (!I->hasInitializer()) continue; // External global require no code
|
||||
|
||||
// Check to see if this is a special global used by LLVM, if so, emit it.
|
||||
if (EmitSpecialLLVMGlobal(I))
|
||||
if (EmitSpecialLLVMGlobal(I)) {
|
||||
if (TM.getRelocationModel() == Reloc::Static) {
|
||||
if (I->getName() == "llvm.global_ctors")
|
||||
O << ".reference .constructors_used\n";
|
||||
else if (I->getName() == "llvm.global_dtors")
|
||||
O << ".reference .destructors_used\n";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string name = Mang->getValueName(I);
|
||||
|
||||
|
@ -53,8 +53,13 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
|
||||
JumpTableDataSection = ".const";
|
||||
GlobalDirective = "\t.globl\t";
|
||||
CStringSection = "\t.cstring";
|
||||
StaticCtorsSection = ".mod_init_func";
|
||||
StaticDtorsSection = ".mod_term_func";
|
||||
if (TM.getRelocationModel() == Reloc::Static) {
|
||||
StaticCtorsSection = ".constructor";
|
||||
StaticDtorsSection = ".destructor";
|
||||
} else {
|
||||
StaticCtorsSection = ".mod_init_func";
|
||||
StaticDtorsSection = ".mod_term_func";
|
||||
}
|
||||
UsedDirective = "\t.no_dead_strip\t";
|
||||
WeakRefDirective = "\t.weak_reference\t";
|
||||
HiddenDirective = "\t.private_extern\t";
|
||||
|
@ -134,8 +134,16 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
|
||||
continue; // External global require no code
|
||||
|
||||
// Check to see if this is a special global used by LLVM, if so, emit it.
|
||||
if (EmitSpecialLLVMGlobal(I))
|
||||
if (EmitSpecialLLVMGlobal(I)) {
|
||||
if (Subtarget->isTargetDarwin() &&
|
||||
TM.getRelocationModel() == Reloc::Static) {
|
||||
if (I->getName() == "llvm.global_ctors")
|
||||
O << ".reference .constructors_used\n";
|
||||
else if (I->getName() == "llvm.global_dtors")
|
||||
O << ".reference .destructors_used\n";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string name = Mang->getValueName(I);
|
||||
Constant *C = I->getInitializer();
|
||||
|
@ -59,8 +59,13 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
|
||||
LCOMMDirective = "\t.lcomm\t";
|
||||
COMMDirectiveTakesAlignment = false;
|
||||
HasDotTypeDotSizeDirective = false;
|
||||
StaticCtorsSection = ".mod_init_func";
|
||||
StaticDtorsSection = ".mod_term_func";
|
||||
if (TM.getRelocationModel() == Reloc::Static) {
|
||||
StaticCtorsSection = ".constructor";
|
||||
StaticDtorsSection = ".destructor";
|
||||
} else {
|
||||
StaticCtorsSection = ".mod_init_func";
|
||||
StaticDtorsSection = ".mod_term_func";
|
||||
}
|
||||
InlineAsmStart = "# InlineAsm Start";
|
||||
InlineAsmEnd = "# InlineAsm End";
|
||||
SetDirective = "\t.set";
|
||||
|
Loading…
x
Reference in New Issue
Block a user