aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/TargetLoweringObjectFile.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-02 00:34:36 +0000
committerChris Lattner <sabre@nondot.org>2009-08-02 00:34:36 +0000
commit4e7dfafc03188ad9e14e9c3c2b8039224792c5b7 (patch)
treece59a660f6a02724d12ef8bd0397ada94a5325c5 /llvm/lib/Target/TargetLoweringObjectFile.cpp
parentc4d6f83f20b6ab19a13f5e4181ed95256fa106e6 (diff)
downloadllvm-4e7dfafc03188ad9e14e9c3c2b8039224792c5b7.zip
llvm-4e7dfafc03188ad9e14e9c3c2b8039224792c5b7.tar.gz
llvm-4e7dfafc03188ad9e14e9c3c2b8039224792c5b7.tar.bz2
convert ctors/dtors section to be in TLOF instead of
TAI. llvm-svn: 77842
Diffstat (limited to 'llvm/lib/Target/TargetLoweringObjectFile.cpp')
-rw-r--r--llvm/lib/Target/TargetLoweringObjectFile.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index 7c5eaf9..a86946d 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -34,6 +34,8 @@ TargetLoweringObjectFile::TargetLoweringObjectFile() : Ctx(0) {
DataSection = 0;
BSSSection = 0;
ReadOnlySection = 0;
+ StaticCtorSection = 0;
+ StaticDtorSection = 0;
}
TargetLoweringObjectFile::~TargetLoweringObjectFile() {
@@ -295,6 +297,11 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
SectionKind::getMergeableConst8());
MergeableConst16Section = getOrCreateSection(".rodata.cst16", false,
SectionKind::getMergeableConst16());
+
+ StaticCtorSection =
+ getOrCreateSection(".ctors", false, SectionKind::getDataRel());
+ StaticDtorSection =
+ getOrCreateSection(".dtors", false, SectionKind::getDataRel());
}
@@ -517,6 +524,19 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
DataCoalSection = getOrCreateSection("\t__DATA,__datacoal_nt,coalesced",
false,
SectionKind::getDataRel());
+
+ if (TM.getRelocationModel() == Reloc::Static) {
+ StaticCtorSection =
+ getOrCreateSection(".constructor", true, SectionKind::getDataRel());
+ StaticDtorSection =
+ getOrCreateSection(".destructor", true, SectionKind::getDataRel());
+ } else {
+ StaticCtorSection =
+ getOrCreateSection(".mod_init_func", true, SectionKind::getDataRel());
+ StaticDtorSection =
+ getOrCreateSection(".mod_term_func", true, SectionKind::getDataRel());
+ }
+
}
const MCSection *TargetLoweringObjectFileMachO::
@@ -624,6 +644,10 @@ void TargetLoweringObjectFileCOFF::Initialize(MCContext &Ctx,
SectionKind::getText());
DataSection = getOrCreateSection("\t.data", true,
SectionKind::getDataRel());
+ StaticCtorSection =
+ getOrCreateSection(".ctors", false, SectionKind::getDataRel());
+ StaticDtorSection =
+ getOrCreateSection(".dtors", false, SectionKind::getDataRel());
}
void TargetLoweringObjectFileCOFF::