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

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 05:28:10 PDT 2015


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

        .set    macro
        .set    reorder
        .end    g
        .size   g, .-g
        .hidden f

$ objdump -dr test.o
Disassembly of section .text.g:

00000000 <g>:
   0:   3c1c0000        lui     gp,0x0
                        0: R_MIPS_HI16  _gp_disp
   4:   279c0000        addiu   gp,gp,0
                        4: R_MIPS_LO16  _gp_disp
   8:   0399e021        addu    gp,gp,t9
   c:   8f990000        lw      t9,0(gp)
                        c: R_MIPS_GOT16 f
  10:   03200008        jr      t9
                        10: R_MIPS_JALR f
  14:   00000000        nop

-- 
Simon Atanasyan


More information about the llvm-commits mailing list