1 # RUN: rm -rf %t && mkdir -p %t && cd %t
2 # RUN: llvm-mc -triple=x86_64-unknown-freebsd -filetype=obj -o t.o %s
3 # RUN: llvm-rtdyld -triple=x86_64-unknown-linux -verify -check=%s t.o -dummy-extern=extern_data=0x4200000000
5 # Generated from this C source:
7 # static int static_data[10];
8 # int global_data[10] = {1, 2};
9 # extern int extern_data[10];
11 # int *lea_static_data() { return &static_data[0]; }
12 # int *lea_global_data() { return &global_data[0]; }
13 # int *lea_extern_data() { return &extern_data[0]; }
17 .globl lea_static_data # -- Begin function lea_static_data
19 .type lea_static_data,@function
20 lea_static_data
: # @lea_static_data
24 leaq
.Ltmp0(%rip), %rcx
25 # rtdyld-check: decode_operand(lea_static_got, 1) = section_addr(t.o, .got) - lea_static_data
27 movabsq $_GLOBAL_OFFSET_TABLE_-
.Ltmp0, %rax
29 # rtdyld-check: decode_operand(lea_static_gotoff, 1) = static_data - section_addr(t.o, .got)
31 movabsq $static_data@GOTOFF
, %rax
35 .size lea_static_data, .Lfunc_end0-lea_static_data
39 .globl lea_global_data # -- Begin function lea_global_data
41 .type lea_global_data,@function
42 lea_global_data
: # @lea_global_data
46 leaq
.Ltmp1(%rip), %rcx
47 # rtdyld-check: decode_operand(lea_global_got, 1) = section_addr(t.o, .got) - lea_global_data
49 movabsq $_GLOBAL_OFFSET_TABLE_-
.Ltmp1, %rax
51 # rtdyld-check: decode_operand(lea_global_gotoff, 1) = global_data - section_addr(t.o, .got)
53 movabsq $global_data@GOTOFF
, %rax
57 .size lea_global_data, .Lfunc_end1-lea_global_data
61 .globl lea_extern_data # -- Begin function lea_extern_data
63 .type lea_extern_data,@function
64 lea_extern_data
: # @lea_extern_data
68 leaq
.Ltmp2(%rip), %rax
69 # rtdyld-check: decode_operand(lea_extern_got, 1) = section_addr(t.o, .got) - lea_extern_data
71 movabsq $_GLOBAL_OFFSET_TABLE_-
.Ltmp2, %rcx
73 # extern_data is the only thing in the GOT, so it'll be slot 0.
74 # rtdyld-check: decode_operand(lea_extern_gotslot, 1) = 0
76 movabsq $extern_data@GOT
, %rcx
77 movq
(%rax
,%rcx
), %rax
80 .size lea_extern_data, .Lfunc_end2-lea_extern_data
84 .type global_data,@object # @global_data
101 .type static_data,@object # @static_data
103 .comm static_data,40,16