Skip to content
  • Simon Atanasyan's avatar
    [ELF][MIPS] Calculate relocations agains _gp_disp / __gnu_local_gp using dedicated 'expressions' · d34a3631
    Simon Atanasyan authored
    The patch introduces two new relocations expressions R_MIPS_GOT_GP and
    R_MIPS_GOT_GP_PC. The first one represents a current value of `_gp`
    pointer and used to calculate relocations against the `__gnu_local_gp`
    symbol. The second one represents the offset between the beginning of
    the function and the `_gp` pointer's value.
    
    There are two motivations for introducing new expressions:
    - It's better to keep all non-trivial relocation calculations in the
      single place - `getRelocTargetVA` function.
    - Relocations against both `_gp_disp` and `__gnu_local_gp` symbols
      depend on the `_gp` value. It's a magical value points to the "middle"
      of GOT. Now all relocations use a common `_gp` value. But in fact,
      under some conditions each input file might require its own `_gp`
      value. I'm going to implement it in the future patches. So it's
      better to make `MipsGotSection` responsible for calculation of
      the `_gp` value.
    
    llvm-svn: 298306
    d34a3631
Loading