[lld] r260027 - [ELF][MIPS] Add comments to describe __gnu_local_gp magic symbol
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 7 04:09:41 PST 2016
Author: atanasyan
Date: Sun Feb 7 06:09:40 2016
New Revision: 260027
URL: http://llvm.org/viewvc/llvm-project?rev=260027&view=rev
Log:
[ELF][MIPS] Add comments to describe __gnu_local_gp magic symbol
NFC. Follow-up to r259781.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=260027&r1=260026&r2=260027&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Sun Feb 7 06:09:40 2016
@@ -325,9 +325,12 @@ template <class ELFT> void LinkerDriver:
if (Config->EMachine == EM_MIPS) {
// On MIPS O32 ABI, _gp_disp is a magic symbol designates offset between
- // start of function and gp pointer into GOT. Use 'strong' variant of
- // the addIgnored to prevent '_gp_disp' substitution.
+ // start of function and 'gp' pointer into GOT.
Config->MipsGpDisp = Symtab.addIgnored("_gp_disp");
+ // The __gnu_local_gp is a magic symbol equal to the current value of 'gp'
+ // pointer. This symbol is used in the code generated by .cpload pseudo-op
+ // in case of using -mno-shared option.
+ // https://sourceware.org/ml/binutils/2004-12/msg00094.html
Config->MipsLocalGp = Symtab.addIgnored("__gnu_local_gp");
// Define _gp for MIPS. st_value of _gp symbol will be updated by Writer
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=260027&r1=260026&r2=260027&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Sun Feb 7 06:09:40 2016
@@ -397,8 +397,9 @@ void Writer<ELFT>::scanRelocs(
// linking only.
continue;
if (Body == Config->MipsGpDisp || Body == Config->MipsLocalGp)
- // MIPS _gp_disp designates offset between start of function and gp
- // pointer into GOT therefore any relocations against it do not require
+ // MIPS _gp_disp designates offset between start of function and 'gp'
+ // pointer into GOT. __gnu_local_gp is equal to the current value of
+ // the 'gp'. Therefore any relocations against them do not require
// dynamic relocation.
continue;
}
More information about the llvm-commits
mailing list