1 # RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding \ 2 # RUN: -mattr=micromips | FileCheck %s -check-prefix=CHECK-FIXUP 3 # RUN: llvm-mc %s -filetype=obj -triple=mipsel-unknown-linux \ 4 # RUN: -mattr=micromips | llvm-readobj -r \ 5 # RUN: | FileCheck %s -check-prefix=CHECK-ELF 6 #------------------------------------------------------------------------------ 7 # Check that the assembler can handle the documented syntax 8 # for relocations. 9 #------------------------------------------------------------------------------ 10 # CHECK-FIXUP: lui $2, %hi(_gp_disp) 11 # CHECK-FIXUP: # encoding: [0xa2'A',0x41'A',0x00,0x00] 12 # CHECK-FIXUP: # fixup A - offset: 0, 13 # CHECK-FIXUP: value: _gp_disp@ABS_HI, 14 # CHECK-FIXUP: kind: fixup_MICROMIPS_HI16 15 # CHECK-FIXUP: addiu $2, $2, %lo(_gp_disp) 16 # CHECK-FIXUP: # encoding: [0x42'A',0x30'A',0x00,0x00] 17 # CHECK-FIXUP: # fixup A - offset: 0, 18 # CHECK-FIXUP: value: _gp_disp@ABS_LO, 19 # CHECK-FIXUP: kind: fixup_MICROMIPS_LO16 20 # CHECK-FIXUP: lw $25, %call16(strchr)($gp) 21 # CHECK-FIXUP: # encoding: [0x3c'A',0xff'A',0x00,0x00] 22 # CHECK-FIXUP: # fixup A - offset: 0, 23 # CHECK-FIXUP: value: strchr@GOT_CALL, 24 # CHECK-FIXUP: kind: fixup_MICROMIPS_CALL16 25 # CHECK-FIXUP: lw $3, %got(loop_1)($2) 26 # CHECK-FIXUP: # encoding: [0x62'A',0xfc'A',0x00,0x00] 27 # CHECK-FIXUP: # fixup A - offset: 0, 28 # CHECK-FIXUP: value: loop_1@GOT, 29 # CHECK-FIXUP: kind: fixup_MICROMIPS_GOT16 30 # CHECK-FIXUP: lui $2, %dtprel_hi(_gp_disp) 31 # CHECK-FIXUP: # encoding: [0xa2'A',0x41'A',0x00,0x00] 32 # CHECK-FIXUP: # fixup A - offset: 0, 33 # CHECK-FIXUP: value: _gp_disp@DTPREL_HI, 34 # CHECK-FIXUP: kind: fixup_MICROMIPS_TLS_DTPREL_HI16 35 # CHECK-FIXUP: addiu $2, $2, %dtprel_lo(_gp_disp) 36 # CHECK-FIXUP: # encoding: [0x42'A',0x30'A',0x00,0x00] 37 # CHECK-FIXUP: # fixup A - offset: 0, 38 # CHECK-FIXUP: value: _gp_disp@DTPREL_LO, 39 # CHECK-FIXUP: kind: fixup_MICROMIPS_TLS_DTPREL_LO16 40 # CHECK-FIXUP: lw $3, %got(loop_1)($2) 41 # CHECK-FIXUP: # encoding: [0x62'A',0xfc'A',0x00,0x00] 42 # CHECK-FIXUP: # fixup A - offset: 0, 43 # CHECK-FIXUP: value: loop_1@GOT, 44 # CHECK-FIXUP: kind: fixup_MICROMIPS_GOT16 45 # CHECK-FIXUP: lw $4, %got_disp(loop_2)($3) 46 # CHECK-FIXUP: # encoding: [0x83'A',0xfc'A',0x00,0x00] 47 # CHECK-FIXUP: # fixup A - offset: 0, 48 # CHECK-FIXUP: value: loop_2@GOT_DISP, 49 # CHECK-FIXUP: kind: fixup_MICROMIPS_GOT_DISP 50 # CHECK-FIXUP: lw $5, %got_page(loop_3)($4) 51 # CHECK-FIXUP: # encoding: [0xa4'A',0xfc'A',0x00,0x00] 52 # CHECK-FIXUP: # fixup A - offset: 0, 53 # CHECK-FIXUP: value: loop_3@GOT_PAGE, 54 # CHECK-FIXUP: kind: fixup_MICROMIPS_GOT_PAGE 55 # CHECK-FIXUP: lw $6, %got_ofst(loop_4)($5) 56 # CHECK-FIXUP: # encoding: [0xc5'A',0xfc'A',0x00,0x00] 57 # CHECK-FIXUP: # fixup A - offset: 0, 58 # CHECK-FIXUP: value: loop_4@GOT_OFST, 59 # CHECK-FIXUP: kind: fixup_MICROMIPS_GOT_OFST 60 # CHECK-FIXUP: lui $2, %tprel_hi(_gp_disp) 61 # CHECK-FIXUP: # encoding: [0xa2'A',0x41'A',0x00,0x00] 62 # CHECK-FIXUP: # fixup A - offset: 0, 63 # CHECK-FIXUP: value: _gp_disp@TPREL_HI, 64 # CHECK-FIXUP: kind: fixup_MICROMIPS_TLS_TPREL_HI16 65 # CHECK-FIXUP: addiu $2, $2, %tprel_lo(_gp_disp) 66 # CHECK-FIXUP: # encoding: [0x42'A',0x30'A',0x00,0x00] 67 # CHECK-FIXUP: # fixup A - offset: 0, 68 # CHECK-FIXUP: value: _gp_disp@TPREL_LO, 69 # CHECK-FIXUP: kind: fixup_MICROMIPS_TLS_TPREL_LO16 70 # CHECK-FIXUP: addiu $4, $gp, %tlsgd(a) 71 # CHECK-FIXUP: # encoding: [0x9c'A',0x30'A',0x00,0x00] 72 # CHECK-FIXUP: # fixup A - offset: 0, 73 # CHECK-FIXUP: value: a@TLSGD, kind: fixup_MICROMIPS_TLS_GD 74 # CHECK-FIXUP: addiu $4, $gp, %tlsldm(f.i) 75 # CHECK-FIXUP: # encoding: [0x9c'A',0x30'A',0x00,0x00] 76 # CHECK-FIXUP: # fixup A - offset: 0, 77 # CHECK-FIXUP: value: f.i@TLSLDM, kind: fixup_MICROMIPS_TLS_LDM 78 #------------------------------------------------------------------------------ 79 # Check that the appropriate relocations were created. 80 #------------------------------------------------------------------------------ 81 # CHECK-ELF: Relocations [ 82 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_HI16 83 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_LO16 84 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_CALL16 85 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_GOT16 86 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_TLS_DTPREL_HI16 87 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_TLS_DTPREL_LO16 88 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_GOT16 89 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_GOT_DISP 90 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_GOT_PAGE 91 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_GOT_OFST 92 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_TLS_TPREL_HI16 93 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_TLS_TPREL_LO16 94 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_TLS_GD 95 # CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_TLS_LDM 96 # CHECK-ELF: ] 97 98 lui $2, %hi(_gp_disp) 99 addiu $2, $2, %lo(_gp_disp) 100 lw $25, %call16(strchr)($gp) 101 lw $3, %got(loop_1)($2) 102 lui $2, %dtprel_hi(_gp_disp) 103 addiu $2, $2, %dtprel_lo(_gp_disp) 104 lw $3, %got(loop_1)($2) 105 lw $4, %got_disp(loop_2)($3) 106 lw $5, %got_page(loop_3)($4) 107 lw $6, %got_ofst(loop_4)($5) 108 lui $2, %tprel_hi(_gp_disp) 109 addiu $2, $2, %tprel_lo(_gp_disp) 110 addiu $4, $gp, %tlsgd(a) 111 addiu $4, $gp, %tlsldm(f.i) 112