[PATCH] D18349: [ELF][MIPS] Reduce number of redundant entries in the local part of MIPS GOT

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 09:56:32 PDT 2016


rafael added a comment.

OK, I think this is probably fine.

If we want to compute a better result in the future and still support got pointing forward in the file I think we can do:

- Delay the scan just a bit so we know the position of each symbol in its output section.
- Compute the offset in the output section that each got entry will have
- Use that to compute an upper bound on the number of entries.

Can you just upload a new version with the inline comments fixed?


================
Comment at: ELF/OutputSections.cpp:209
@@ +208,3 @@
+  for (const OutputSectionBase<ELFT> *OutSec : MipsOutSections) {
+    // Calculate number of MIPS GOT entries required to store page
+    // addresses of local symbols. We assume that symbols referenced
----------------
The description is not exactly true.

You are computing an upper bound, not the exact number. Given that, you are not assuming that the "relocations are spread" uniformly. It is just that the worst case is for every page in the section to have a relocation pointing at it.

================
Comment at: ELF/Writer.cpp:1096
@@ -1094,1 +1095,3 @@
+  // sections referenced by the GOT is calculated already.
+  // See GotSection::finalize()
   for (OutputSectionBase<ELFT> *Sec : OutputSections)
----------------
Do you have a testcase for this? If not, could you leave it for a follow up patch?


Repository:
  rL LLVM

http://reviews.llvm.org/D18349





More information about the llvm-commits mailing list