[lld] r345204 - Add a comment for PPC64 .toc and GNU relro.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 24 14:59:48 PDT 2018
Author: ruiu
Date: Wed Oct 24 14:59:48 2018
New Revision: 345204
URL: http://llvm.org/viewvc/llvm-project?rev=345204&view=rev
Log:
Add a comment for PPC64 .toc and GNU relro.
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=345204&r1=345203&r2=345204&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Oct 24 14:59:48 2018
@@ -673,6 +673,11 @@ static bool isRelroSection(const OutputS
if (In.Got && Sec == In.Got->getParent())
return true;
+ // .toc is a GOT-ish section for PowerPC64. Their contents are accessed
+ // through r2 register, which is reserved for that purpose. Since r2 is used
+ // for accessing .got as well, .got and .toc need to be close enough in the
+ // virtual address space. Usually, .toc comes just after .got. Since we place
+ // .got into RELRO, .toc needs to be placed into RELRO too.
if (Sec->Name.equals(".toc"))
return true;
More information about the llvm-commits
mailing list