[PATCH] D21297: [ELF][MIPS] Support GOT entries for non-preemptible symbols with different addends

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 07:31:17 PDT 2016


atanasyan added a comment.

In http://reviews.llvm.org/D21297#457462, @rafael wrote:

> What exactly is the rule for mips? Is a R_MIPS_SOMETHING_GOT with an
>  addend of X supposed to mean "got_entry(foo + X)"? Is that always the
>  case? Only for some relocations? Only when foo is local?


In general all MIPS GOT related relocations against (S+A) expect that corresponding GOT entry contain a real address of S + A. For example, here is a quote from R_MIPS_GOT_DISP relocation result description:

  The offset into the global offset table at which the address of the relocation entry symbol, adjusted by the addend, resides during execution.

In fact compilers/assemblers generate GOT related relocations for non-preemptible symbols because in that case they know what happens at the S+A address. I do not know why does compiler require allocation of additional GOT entry instead of adding addend to the result of GOT entry reading. Maybe the idea is to escape additional instructions.

On my test base I have never seen a GOT relocation against preemptible symbol with addend, but I am going to add `fatal` call to catch such case.


Repository:
  rL LLVM

http://reviews.llvm.org/D21297





More information about the llvm-commits mailing list