aboutsummaryrefslogtreecommitdiff
path: root/test/MC/Sparc/sparc-pic.s
blob: 5a34d309899eb2db0e4f11cb586cffd3ed42c43d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
! RUN: llvm-mc %s -arch=sparcv9 --relocation-model=pic -filetype=obj | llvm-readobj -r | FileCheck %s


! CHECK:      Relocations [
! CHECK-NOT:    0x{{[0-9,A-F]+}} R_SPARC_WPLT30 .text 0xC
! CHECK:        0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x4
! CHECK-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x8
! CHECK-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_GOT22 AGlobalVar 0x0
! CHECK-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_GOT10 AGlobalVar 0x0
! CHECK-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_WPLT30 bar 0x0
! CHECK:      ]

        .text
        .globl  foo
        .align  4
        .type   foo,@function
foo:
        .cfi_startproc
        save %sp, -176, %sp
        .cfi_def_cfa_register %fp
        .cfi_window_save
        .cfi_register 15, 31
.Ltmp4:
        call .Ltmp5
.Ltmp6:
        sethi %hi(_GLOBAL_OFFSET_TABLE_+(.Ltmp6-.Ltmp4)), %i1
.Ltmp5:
        or %i1, %lo(_GLOBAL_OFFSET_TABLE_+(.Ltmp5-.Ltmp4)), %i1
        add %i1, %o7, %i1
        sethi %hi(AGlobalVar), %i2
        add %i2, %lo(AGlobalVar), %i2
        ldx [%i1+%i2], %i1
        ldx [%i1], %i1
        call bar
        add %i0, %i1, %o0
        ret
        restore %g0, %o0, %o0
.Ltmp7:
        .size   foo, .Ltmp7-foo
        .cfi_endproc

        .type   AGlobalVar,@object      ! @AGlobalVar
        .section        .bss,#alloc,#write
        .globl  AGlobalVar
        .align  8
AGlobalVar:
        .xword  0                       ! 0x0
        .size   AGlobalVar, 8