102 lines · plain
1## Test relocation specifiers with different behaviors with non-PIC and PIC.2! RUN: llvm-mc %s -triple=sparcv9 --position-independent -filetype=obj | llvm-readobj -r - | FileCheck --check-prefix=PIC %s3! RUN: llvm-mc %s -triple=sparcv9 -filetype=obj | llvm-readobj -r - | FileCheck --check-prefix=NOPIC %s4 5! PIC: .rela.text {6! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x47! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x88! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x09! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x010! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT22 AGlobalVar 0x011! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT10 AGlobalVar 0x012! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT22 AGlobalVar 0x013! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT10 AGlobalVar 0x014! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT22 .LC0 0x015! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT10 .LC0 0x016! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_WPLT30 bar 0x017! PIC: 0x{{[0-9,A-F]+}} R_SPARC_GOT13 value 0x018! PIC: ]19 20! NOPIC: .rela.text {21! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x422! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_ 0x823! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x024! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_ 0x025! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 AGlobalVar 0x026! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 AGlobalVar 0x027! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 AGlobalVar 0x028! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 AGlobalVar 0x029! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 .rodata 0x030! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 .rodata 0x031! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_WDISP30 bar 0x032! NOPIC: 0x{{[0-9,A-F]+}} R_SPARC_13 value 0x033! NOPIC: ]34 35 .section ".rodata"36 .align 837.LC0:38 .asciz "string"39 .section ".text"40 .text41 .globl foo42 .align 443 .type foo,@function44foo:45 .cfi_startproc46 save %sp, -176, %sp47 .cfi_def_cfa_register %fp48 .cfi_window_save49 .cfi_register 15, 3150.Ltmp4:51 call .Ltmp552.Ltmp6:53 sethi %hi(_GLOBAL_OFFSET_TABLE_+(.Ltmp6-.Ltmp4)), %i154.Ltmp5:55 or %i1, %lo(_GLOBAL_OFFSET_TABLE_+(.Ltmp5-.Ltmp4)), %i156 set _GLOBAL_OFFSET_TABLE_, %i157 add %i1, %o7, %i158 sethi %hi(AGlobalVar), %i259 add %i2, %lo(AGlobalVar), %i260 set AGlobalVar, %i261 ldx [%i1+%i2], %i362 ldx [%i3], %i363 sethi %hi(.LC0), %i264 add %i2, %lo(.LC0), %i265 ldx [%i1+%i2], %i466 call bar67 add %i0, %i1, %o068 ret69 restore %g0, %o0, %o070.Ltmp7:71 .size foo, .Ltmp7-foo72 .cfi_endproc73 74 .type AGlobalVar,@object ! @AGlobalVar75 .section .bss,#alloc,#write76 .globl AGlobalVar77 .align 878AGlobalVar:79 .xword 0 ! 0x080 .size AGlobalVar, 881 82 .section ".text"83 .text84 .globl pic1385 .align 486 .type pic13,@function87pic13:88 save %sp, -128, %sp89.Ltmp0:90 call .Ltmp191.Ltmp2:92 sethi %hi(_GLOBAL_OFFSET_TABLE_+(.Ltmp2-.Ltmp0)), %i093.Ltmp1:94 or %i0, %lo(_GLOBAL_OFFSET_TABLE_+(.Ltmp1-.Ltmp0)), %i095 add %i0, %o7, %i096 ldx [%i0+value], %i097 ld [%i0], %i098 ret99 restore100.Lfunc_end0:101 .size pic13, .Lfunc_end0-pic13102