diff options
-rw-r--r-- | lld/ELF/Writer.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 1962e7c20de..4f764593b6b 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -673,6 +673,11 @@ static bool isRelroSection(const OutputSection *Sec) { 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; |