brintos

brintos / llvm-project-archived public Read only

0
0
Text · 780 B · cf4d07a Raw
37 lines · plain
1// Test that basic ELF static initializers work. The main function in this2// test returns the value of 'x', which is initially 1 in the data section,3// and reset to 0 if the _static_init function is run. If the static initializer4// does not run then main will return 1, causing the test to be treated as a5// failure.6//7// RUN: %clang -c -o %t %s8// RUN: %llvm_jitlink %t9 10	.text11 12	.globl	main13	.p2align	4, 0x9014main:                                   # @main15	movq	x@GOTPCREL(%rip), %rax16	movl	(%rax), %eax17	retq18 19# static initializer sets the value of 'x' to zero.20 21	.p2align	4, 0x9022static_init:23	movq	x@GOTPCREL(%rip), %rax24	movl	$0, (%rax)25	retq26 27	.data28	.globl	x29	.p2align	230x:31	.long	132	.size	x, 433 34	.section	.init_array,"aw",@init_array35	.p2align	336	.quad	static_init37