[PATCH] D56920: [PPC64] Sort .toc sections accessed with small code model relocs close to the .got

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 22 18:00:46 PST 2019


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: ELF/Writer.cpp:1254
 
+  if (Config->EMachine == EM_PPC64 && Name == ".toc") {
+    if (Script->HasSectionsCommand)
----------------
Can you add a comment describing what this code does? It doesn't have to be a complete explanation because you already added it to InputFiles.h, but something like this would help readers of the code:

  .toc is allocated just after .got and is accessed using GOT-relative relocations. The addressable range is [.got, .got + 0xFFFC] if an object file is compiled with the small code model. To reduce the risk of relocation overflow, .toc contents are sorted so that sections having smaller relocation offsets are at beginning of .toc.


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56920/new/

https://reviews.llvm.org/D56920





More information about the llvm-commits mailing list