diff options
author | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2007-03-05 17:59:58 +0000 |
---|---|---|
committer | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2007-03-05 17:59:58 +0000 |
commit | f10769dda7cd35ad257bfeedbcd4e8d13243133f (patch) | |
tree | fab9b7500bb7bd7c8697f38efd8212139f431f0d /llvm | |
parent | 9bf52a72d129efea94748368ab6ae5fe41c2af0f (diff) | |
download | bcm5719-llvm-f10769dda7cd35ad257bfeedbcd4e8d13243133f.tar.gz bcm5719-llvm-f10769dda7cd35ad257bfeedbcd4e8d13243133f.zip |
Use init_array/fini_array sections for static contructors/destructors when the ABI is AAPCS.
Fix SingleSource/Regression/C/ConstructorDestructorAttributes test on arm-linux-gnueabi.
llvm-svn: 34931
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp | 9 | ||||
-rw-r--r-- | llvm/test/CodeGen/ARM/ctors_dtors.ll | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp b/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp index b4948c5b5b5..ff6de2eee40 100644 --- a/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp +++ b/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp @@ -58,8 +58,13 @@ ARMTargetAsmInfo::ARMTargetAsmInfo(const ARMTargetMachine &TM) { } else { PrivateGlobalPrefix = ".L"; WeakRefDirective = "\t.weak\t"; - StaticCtorsSection = "\t.section .ctors,\"aw\",%progbits"; - StaticDtorsSection = "\t.section .dtors,\"aw\",%progbits"; + if (Subtarget->isAAPCS_ABI()) { + StaticCtorsSection = "\t.section .init_array,\"aw\",%init_array"; + StaticDtorsSection = "\t.section .fini_array,\"aw\",%fini_array"; + } else { + StaticCtorsSection = "\t.section .ctors,\"aw\",%progbits"; + StaticDtorsSection = "\t.section .dtors,\"aw\",%progbits"; + } } ZeroDirective = "\t.space\t"; diff --git a/llvm/test/CodeGen/ARM/ctors_dtors.ll b/llvm/test/CodeGen/ARM/ctors_dtors.ll index b4cdf27b3cc..709fb2bb323 100644 --- a/llvm/test/CodeGen/ARM/ctors_dtors.ll +++ b/llvm/test/CodeGen/ARM/ctors_dtors.ll @@ -1,8 +1,10 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm && ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | grep '\.mod_init_func' && ; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | grep '\.mod_term_func' && -; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep '\.section \.ctors,"aw",.progbits' && -; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep '\.section \.dtors,"aw",.progbits' +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux-gnu | grep '\.section \.ctors,"aw",.progbits' && +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux-gnu | grep '\.section \.dtors,"aw",.progbits' && +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux-gnueabi | grep '\.section \.init_array,"aw",.init_array' && +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux-gnueabi | grep '\.section \.fini_array,"aw",.fini_array' %llvm.global_ctors = appending global [1 x { int, void ()* }] [ { int, void ()* } { int 65535, void ()* %__mf_init } ] ; <[1 x { int, void ()* }]*> [#uses=0] %llvm.global_dtors = appending global [1 x { int, void ()* }] [ { int, void ()* } { int 65535, void ()* %__mf_fini } ] ; <[1 x { int, void ()* }]*> [#uses=0] |