[PATCH] D32543: [X86] Clang option -fuse-init-array has no effect when generating for MCU target
Andrei via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 4 12:43:00 PDT 2017
AndreiGrischenko updated this revision to Diff 97866.
AndreiGrischenko added a comment.
Thanks Craig for the good advice. You are right I can check llc with MCU triple using option -use-ctors. Please see updated patch.
https://reviews.llvm.org/D32543
Files:
llvm/lib/Target/X86/X86TargetMachine.cpp
llvm/test/CodeGen/X86/constructor.ll
Index: llvm/lib/Target/X86/X86TargetMachine.cpp
===================================================================
--- llvm/lib/Target/X86/X86TargetMachine.cpp
+++ llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -87,7 +87,7 @@
if (TT.isOSFreeBSD())
return llvm::make_unique<X86FreeBSDTargetObjectFile>();
- if (TT.isOSLinux() || TT.isOSNaCl())
+ if (TT.isOSLinux() || TT.isOSNaCl() || TT.isOSIAMCU())
return llvm::make_unique<X86LinuxNaClTargetObjectFile>();
if (TT.isOSFuchsia())
return llvm::make_unique<X86FuchsiaTargetObjectFile>();
Index: llvm/test/CodeGen/X86/constructor.ll
===================================================================
--- llvm/test/CodeGen/X86/constructor.ll
+++ llvm/test/CodeGen/X86/constructor.ll
@@ -3,6 +3,8 @@
; RUN: llc -mtriple x86_64-pc-linux < %s | FileCheck --check-prefix=INIT-ARRAY %s
; RUN: llc -mtriple x86_64-unknown-freebsd < %s | FileCheck --check-prefix=INIT-ARRAY %s
; RUN: llc -mtriple x86_64-unknown-nacl < %s | FileCheck --check-prefix=NACL %s
+; RUN: llc -mtriple i586-intel-elfiamcu -use-ctors < %s | FileCheck %s --check-prefix=MCU-CTORS
+; RUN: llc -mtriple i586-intel-elfiamcu < %s | FileCheck %s --check-prefix=MCU-INIT-ARRAY
@llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* null}, { i32, void ()*, i8* } { i32 15, void ()* @g, i8* @v }]
@v = weak_odr global i8 0
@@ -37,3 +39,6 @@
; NACL-NEXT: .section .init_array,"aw", at init_array
; NACL-NEXT: .p2align 2
; NACL-NEXT: .long f
+
+; MCU-CTORS: .section .ctors,"aw", at progbits
+; MCU-INIT-ARRAY: .section .init_array,"aw", at init_array
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32543.97866.patch
Type: text/x-patch
Size: 1671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170504/3f73c336/attachment.bin>
More information about the llvm-commits
mailing list