OSDN Git Service

Fix UseInitArray option for MIPS target.
authorLogan Chien <tzuhsiang.chien@gmail.com>
Wed, 5 Sep 2012 06:17:17 +0000 (06:17 +0000)
committerLogan Chien <tzuhsiang.chien@gmail.com>
Wed, 5 Sep 2012 06:17:17 +0000 (06:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163193 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsTargetObjectFile.cpp
test/CodeGen/Mips/init-array.ll [new file with mode: 0644]

index a7fb454..1f5e34f 100644 (file)
@@ -26,6 +26,7 @@ SSThreshold("mips-ssection-threshold", cl::Hidden,
 
 void MipsTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
   TargetLoweringObjectFileELF::Initialize(Ctx, TM);
+  InitializeELF(TM.Options.UseInitArray);
 
   SmallDataSection =
     getContext().getELFSection(".sdata", ELF::SHT_PROGBITS,
diff --git a/test/CodeGen/Mips/init-array.ll b/test/CodeGen/Mips/init-array.ll
new file mode 100644 (file)
index 0000000..f96ce26
--- /dev/null
@@ -0,0 +1,14 @@
+; RUN: llc -mtriple mipsel-unknown-linux -use-init-array < %s | FileCheck  %s
+
+target triple = "mipsel-unknown-linux"
+
+@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @test }]
+; CHECK: .section
+; CHECK: .init_array
+; CHECK-NOT: .ctors
+; CHECK: .4byte test
+
+define internal void @test() section ".text.startup" {
+entry:
+  ret void
+}