xref: /llvm-project/clang/test/CodeGen/PowerPC/aix-constructor-attribute.c (revision 39db5e1ed87363a9ffea81e53520b542201b3262)
1*39db5e1eSNikita Popov // RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -emit-llvm \
2f563bd74SQiu Chaofan // RUN:     -fno-use-cxa-atexit < %s |\
3f563bd74SQiu Chaofan // RUN:   FileCheck %s
4*39db5e1eSNikita Popov // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -emit-llvm \
5f563bd74SQiu Chaofan // RUN:     -fno-use-cxa-atexit < %s | \
6f563bd74SQiu Chaofan // RUN:   FileCheck %s
7f563bd74SQiu Chaofan 
8*39db5e1eSNikita Popov // CHECK: @llvm.global_ctors = appending global [3 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @foo3, ptr null }, { i32, ptr, ptr } { i32 180, ptr @foo2, ptr null }, { i32, ptr, ptr } { i32 180, ptr @foo, ptr null }]
9f563bd74SQiu Chaofan 
101ea58437SAaron Ballman int foo(void) __attribute__((constructor(180)));
111ea58437SAaron Ballman int foo2(void) __attribute__((constructor(180)));
121ea58437SAaron Ballman int foo3(void) __attribute__((constructor(65535)));
13f563bd74SQiu Chaofan 
foo3(void)141ea58437SAaron Ballman int foo3(void) {
15f563bd74SQiu Chaofan   return 3;
16f563bd74SQiu Chaofan }
17f563bd74SQiu Chaofan 
foo2(void)181ea58437SAaron Ballman int foo2(void) {
19f563bd74SQiu Chaofan   return 2;
20f563bd74SQiu Chaofan }
21f563bd74SQiu Chaofan 
foo(void)221ea58437SAaron Ballman int foo(void) {
23f563bd74SQiu Chaofan   return 1;
24f563bd74SQiu Chaofan }
25