diff options
| author | Venkatraman Govindaraju <venkatra@cs.wisc.edu> | 2014-03-01 05:07:21 +0000 |
|---|---|---|
| committer | Venkatraman Govindaraju <venkatra@cs.wisc.edu> | 2014-03-01 05:07:21 +0000 |
| commit | 9fc29098dfa684de53dd180aa93e94c39c388631 (patch) | |
| tree | 9b0c0cb624d550bfb5131cb0da76491101879618 /llvm/test/MC/Sparc | |
| parent | 552d9e49d9431b8529e6ed6988d9531b9a1aa81f (diff) | |
| download | bcm5719-llvm-9fc29098dfa684de53dd180aa93e94c39c388631.tar.gz bcm5719-llvm-9fc29098dfa684de53dd180aa93e94c39c388631.zip | |
[Sparc] Teach SparcAsmParser to emit correct relocations for PIC code.
llvm-svn: 202571
Diffstat (limited to 'llvm/test/MC/Sparc')
| -rw-r--r-- | llvm/test/MC/Sparc/sparc-pic.s | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/llvm/test/MC/Sparc/sparc-pic.s b/llvm/test/MC/Sparc/sparc-pic.s new file mode 100644 index 00000000000..83c2966e597 --- /dev/null +++ b/llvm/test/MC/Sparc/sparc-pic.s @@ -0,0 +1,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 + .globl AGlobalVar + .align 8 +AGlobalVar: + .xword 0 ! 0x0 + .size AGlobalVar, 8 + |

