[lld] r316003 - [mips] Provide more detailed comment. NFC
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 17 07:39:03 PDT 2017
Author: atanasyan
Date: Tue Oct 17 07:39:03 2017
New Revision: 316003
URL: http://llvm.org/viewvc/llvm-project?rev=316003&view=rev
Log:
[mips] Provide more detailed comment. NFC
Modified:
lld/trunk/ELF/Relocations.cpp
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=316003&r1=316002&r2=316003&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Tue Oct 17 07:39:03 2017
@@ -304,8 +304,14 @@ static RelType getMipsPairType(RelType T
case R_MIPS_HI16:
return R_MIPS_LO16;
case R_MIPS_GOT16:
- // I don't know why these relocations had to be defined like this,
- // but they are handled differently when they refer to local symbols.
+ // In case of global symbol, the R_MIPS_GOT16 relocation does not
+ // have a pair. Each global symbol has a unique entry in the GOT
+ // and a corresponding instruction with help of the R_MIPS_GOT16
+ // relocation loads an address of the symbol. In case of local
+ // symbol, the R_MIPS_GOT16 relocation creates a GOT entry to hold
+ // the high 16 bits of the symbol's value. A paired R_MIPS_LO16
+ // relocations handle low 16 bits of the address. That allows
+ // to allocate only one GOT entry for every 64 KBytes of local data.
return IsLocal ? R_MIPS_LO16 : R_MIPS_NONE;
case R_MICROMIPS_GOT16:
return IsLocal ? R_MICROMIPS_LO16 : R_MIPS_NONE;
More information about the llvm-commits
mailing list