[PATCH] D45788: Mitigate relocation overflow

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 18 15:51:44 PDT 2018


ruiu added inline comments.


================
Comment at: ELF/Writer.cpp:721-722
 
+  // Place sections with PROGBITS closer.
+  if (Sec->Type == SHT_PROGBITS && !isRelroSection(Sec))
+    Rank |= RF_PROGBITS;
----------------
Please expand the comment to explain that we want to put progbits sections closer so that relocations as an effort to prevent relocation overflow between these sections.


================
Comment at: ELF/Writer.cpp:722
+  // Place sections with PROGBITS closer.
+  if (Sec->Type == SHT_PROGBITS && !isRelroSection(Sec))
+    Rank |= RF_PROGBITS;
----------------
What is this isRelroSection condition for?


================
Comment at: ELF/Writer.cpp:1694
+      OutputSection* p = findSection(".text");
+      if (p) OS = p;
       addOptionalRegular(Start, OS, 0);
----------------
Please use clang-format.

I think that Config->ImageBase is a better default value than an address of .text section because a section whose name is .text may not exist.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45788





More information about the llvm-commits mailing list