[PATCH] D81919: [MIPS64] Workaround fixup_Mips_32 for getExprOpValue

hev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 03:50:12 PDT 2020


hev added a comment.

It is not enough to just skip the generation of fixup, because we did not calculate the sub-expression of operand 3 of the daddiu instruction, so after linking, the immediate encoding of daddiu is also incorrect:

test.S:

      .text
      .global main
  main:
      nop
      daddiu $4, $4, main - .

compile to object file:

  llvm-mc -triple mips64el-unknown-linux-gnu -filetype obj -o test.o test.S

objdump test.o:

  objdump -r -d test.o



  test.o:     file format elf64-tradlittlemips
  
  
  Disassembly of section .text:
  
  0000000000000000 <main>:
     0:	00000000 	nop
     4:	64840000 	daddiu	a0,a0,0  # NOTE: zero imm and **no** relocation record

link:

  gcc -o test test.o

objdump test:

  objdump -d test



  0000000120000a70 <main>:                   
     120000a70:   00000000    nop            
     120000a74:   64840000    daddiu  a0,a0,0 # NOTE: still zero :(
      ...          


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81919/new/

https://reviews.llvm.org/D81919





More information about the llvm-commits mailing list