Home | History | Annotate | Download | only in Sparc
      1 ! RUN: llvm-mc %s -arch=sparcv9 --position-independent -filetype=obj | llvm-readobj -r | FileCheck --check-prefix=PIC %s
      2 ! RUN: llvm-mc %s -arch=sparcv9 -filetype=obj | llvm-readobj -r | FileCheck --check-prefix=NOPIC %s
      3 
      4 
      5 ! PIC:      Relocations [
      6 ! PIC-NOT:    0x{{[0-9,A-F]+}} R_SPARC_WPLT30 .text 0xC
      7 ! PIC:        0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x4
      8 ! PIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x8
      9 ! PIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x0
     10 ! PIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x0
     11 ! PIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_GOT22 AGlobalVar 0x0
     12 ! PIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_GOT10 AGlobalVar 0x0
     13 ! PIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_GOT22 AGlobalVar 0x0
     14 ! PIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_GOT10 AGlobalVar 0x0
     15 ! PIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_GOT22 .LC0 0x0
     16 ! PIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_GOT10 .LC0 0x0
     17 ! PIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_WPLT30 bar 0x0
     18 ! PIC:        0x{{[0-9,A-F]+}} R_SPARC_GOT13 value 0x0
     19 ! PIC:      ]
     20 
     21 ! NOPIC:      Relocations [
     22 ! NOPIC-NOT:    0x{{[0-9,A-F]+}} R_SPARC_WPLT30 .text 0xC
     23 ! NOPIC:        0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x4
     24 ! NOPIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_ 0x8
     25 ! NOPIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x0
     26 ! NOPIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_ 0x0
     27 ! NOPIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_HI22 AGlobalVar 0x0
     28 ! NOPIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_LO10 AGlobalVar 0x0
     29 ! NOPIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_HI22 AGlobalVar 0x0
     30 ! NOPIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_LO10 AGlobalVar 0x0
     31 ! NOPIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_HI22 .rodata 0x0
     32 ! NOPIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_LO10 .rodata 0x0
     33 ! NOPIC-NEXT:   0x{{[0-9,A-F]+}} R_SPARC_WDISP30 bar 0x0
     34 ! NOPIC:        0x{{[0-9,A-F]+}} R_SPARC_13 value 0x0
     35 ! NOPIC:      ]
     36 
     37         .section        ".rodata"
     38         .align 8
     39 .LC0:
     40         .asciz   "string"
     41         .section ".text"
     42         .text
     43         .globl  foo
     44         .align  4
     45         .type   foo,@function
     46 foo:
     47         .cfi_startproc
     48         save %sp, -176, %sp
     49         .cfi_def_cfa_register %fp
     50         .cfi_window_save
     51         .cfi_register 15, 31
     52 .Ltmp4:
     53         call .Ltmp5
     54 .Ltmp6:
     55         sethi %hi(_GLOBAL_OFFSET_TABLE_+(.Ltmp6-.Ltmp4)), %i1
     56 .Ltmp5:
     57         or %i1, %lo(_GLOBAL_OFFSET_TABLE_+(.Ltmp5-.Ltmp4)), %i1
     58         set _GLOBAL_OFFSET_TABLE_, %i1
     59         add %i1, %o7, %i1
     60         sethi %hi(AGlobalVar), %i2
     61         add %i2, %lo(AGlobalVar), %i2
     62         set AGlobalVar, %i2
     63         ldx [%i1+%i2], %i3
     64         ldx [%i3], %i3
     65         sethi %hi(.LC0), %i2
     66         add %i2, %lo(.LC0), %i2
     67         ldx [%i1+%i2], %i4
     68         call bar
     69         add %i0, %i1, %o0
     70         ret
     71         restore %g0, %o0, %o0
     72 .Ltmp7:
     73         .size   foo, .Ltmp7-foo
     74         .cfi_endproc
     75 
     76         .type   AGlobalVar,@object      ! @AGlobalVar
     77         .section        .bss,#alloc,#write
     78         .globl  AGlobalVar
     79         .align  8
     80 AGlobalVar:
     81         .xword  0                       ! 0x0
     82         .size   AGlobalVar, 8
     83 
     84         .section ".text"
     85         .text
     86         .globl  pic13
     87         .align  4
     88         .type   pic13,@function
     89 pic13:
     90         save %sp, -128, %sp
     91 .Ltmp0:
     92         call .Ltmp1
     93 .Ltmp2:
     94         sethi %hi(_GLOBAL_OFFSET_TABLE_+(.Ltmp2-.Ltmp0)), %i0
     95 .Ltmp1:
     96         or %i0, %lo(_GLOBAL_OFFSET_TABLE_+(.Ltmp1-.Ltmp0)), %i0
     97         add %i0, %o7, %i0
     98         ldx [%i0+value], %i0
     99         ld [%i0], %i0
    100         ret
    101         restore
    102 .Lfunc_end0:
    103         .size pic13, .Lfunc_end0-pic13
    104