[LLVMdev] Hwo to guess PC-relative offset

HEITZMANN Frédéric 218168 frederic.heitzmann at cea.fr
Tue Jun 30 06:23:03 PDT 2015


> De : Joerg Sonnenberger [mailto:joerg at britannica.bec.de]
> 
> Well, MCFixup is what a relocation is represented as internally. They get
> resolved to a fixed value and replaced, if evaluateAsAbsolute is true.
> 

Hi Joerg,

Actually it fails to get resolved to a fixed value.
When I compile to .o then objdump it I can see that a symbol holding the constant value was created in .rodata.cst4 section.
Since it is not in .text section, it sound logical that llvm cannot resolved it at assemble time.

Is there a way to tell llvm to put the constant in .text section ?

$ cat imm.c
int imm32(){
  return 0x04050607;
}

$ llvm-objdump -disassemble -s imm.o
[...]
Contents of section .rodata.cst4:
 0000 07060504
[...]





More information about the llvm-dev mailing list