[PATCH] D15760: [ELF][MIPS] Implement R_MIPS_GPREL16/R_MIPS_GPREL32 relocation
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 23 14:29:18 PST 2015
atanasyan created this revision.
atanasyan added reviewers: ruiu, rafael.
atanasyan added a subscriber: llvm-commits.
atanasyan set the repository for this revision to rL LLVM.
atanasyan added a project: lld.
The R_MIPS_GPREL16 / R_MIPS_GPREL32 relocations use the following expressions for calculations:
```
local symbol: S + A + GP0 - GP
global symbol: S + A - GP
GP - Represents the final gp value, i.e. _gp symbol
GP0 - Represents the gp value used to create the relocatable object
```
The GP0 value is taken from the .reginfo data section defined by an object file. To implement that I keep a reference to `MipsReginfoInputSection`
in the `ObjectFile` class. This reference is used by the `ObjectFile::getMipsGp0` method to return the GP0 value.
Repository:
rL LLVM
http://reviews.llvm.org/D15760
Files:
ELF/InputFiles.cpp
ELF/InputFiles.h
ELF/InputSection.cpp
ELF/InputSection.h
ELF/Target.cpp
test/ELF/mips-gprel32-relocs.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15760.43558.patch
Type: text/x-patch
Size: 5094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151223/0a4e6eb7/attachment.bin>
More information about the llvm-commits
mailing list