Use the correct ctor/dtor section for dynamic-no-pic.

llvm-svn: 279967
This commit is contained in:
Rafael Espindola 2016-08-29 12:47:22 +00:00
parent 96b52c5a6a
commit 412a529551
2 changed files with 5 additions and 1 deletions

View File

@ -474,7 +474,7 @@ TargetLoweringObjectFileMachO::TargetLoweringObjectFileMachO()
void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
const TargetMachine &TM) {
TargetLoweringObjectFile::Initialize(Ctx, TM);
if (!TM.isPositionIndependent()) {
if (TM.getRelocationModel() == Reloc::Static) {
StaticCtorSection = Ctx.getMachOSection("__TEXT", "__constructor", 0,
SectionKind::getData());
StaticDtorSection = Ctx.getMachOSection("__TEXT", "__destructor", 0,

View File

@ -1,4 +1,6 @@
; RUN: llc < %s -mtriple=arm-apple-darwin | FileCheck %s -check-prefix=DARWIN
; RUN: llc < %s -mtriple=arm-apple-darwin -relocation-model=dynamic-no-pic | FileCheck %s --check-prefix=DARWIN
; RUN: llc < %s -mtriple=arm-apple-darwin -relocation-model=static | FileCheck %s -check-prefix=DARWIN-STATIC
; RUN: llc < %s -mtriple=arm-linux-gnu | FileCheck %s -check-prefix=ELF
; RUN: llc < %s -mtriple=arm-linux-gnueabi | FileCheck %s -check-prefix=GNUEABI
@ -6,6 +8,8 @@
; DARWIN: .long _f151
; DARWIN-NEXT: .long _f152
; DARWIN-STATIC: .section __TEXT,__constructor
; ELF: .section .ctors.65384,"aw",%progbits
; ELF: .long f151
; ELF: .section .ctors.65383,"aw",%progbits