[PATCH] D13104: Mips - Mark the section .eh_frame as writeable for pic

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 06:33:20 PDT 2015


On Mon, Sep 28, 2015 at 03:28:10PM +0300, Simon Atanasyan via llvm-commits wrote:
> On Mon, Sep 28, 2015 at 3:10 PM, Rafael EspĂ­ndola
> <rafael.espindola at gmail.com> wrote:
> >> Yes.
> >>
> >> If you give me example of the code, I will show how it is exactly
> >> translated to an object file.
> >
> > __attribute__((visibility ("hidden"))) void f(void);
> > void g(void) { f(); }
> >
> > Compile with "-Os -S test.c -fPIC -ffunction-sections"
> 
> $ cat test.s
>         .abicalls
>         .section        .text.g,"ax", at progbits
>         .align  2
>         .globl  g
>         .set    nomips16
>         .set    nomicromips
>         .ent    g
>         .type   g, @function
> g:
>         .frame  $sp,0,$31
>         .mask   0x00000000,0
>         .fmask  0x00000000,0
>         .set    noreorder
>         .cpload $25
>         .set    nomacro
>         lw      $25,%got(f)($28)
>         .reloc  1f,R_MIPS_JALR,f
> 1:      jr      $25
>         nop

Small comment: the .reloc allows the linker to patch up the GOT
reference and the indirect jump. This is all quite messy and
overcomplicated IMO, but sadly the reality of ELF MIPS we have to deal
with :(

Joerg


More information about the llvm-commits mailing list