[llvm] r279967 - Use the correct ctor/dtor section for dynamic-no-pic.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 29 05:47:22 PDT 2016
Author: rafael
Date: Mon Aug 29 07:47:22 2016
New Revision: 279967
URL: http://llvm.org/viewvc/llvm-project?rev=279967&view=rev
Log:
Use the correct ctor/dtor section for dynamic-no-pic.
Modified:
llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/trunk/test/CodeGen/ARM/ctor_order.ll
Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=279967&r1=279966&r2=279967&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Mon Aug 29 07:47:22 2016
@@ -474,7 +474,7 @@ TargetLoweringObjectFileMachO::TargetLow
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,
Modified: llvm/trunk/test/CodeGen/ARM/ctor_order.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ctor_order.ll?rev=279967&r1=279966&r2=279967&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/ctor_order.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/ctor_order.ll Mon Aug 29 07:47:22 2016
@@ -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
More information about the llvm-commits
mailing list