[PATCH] D45788: Mitigate relocation overflow

Han Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 10:06:53 PDT 2018


shenhan added inline comments.


================
Comment at: ELF/Writer.cpp:722
+  // Place sections with PROGBITS closer.
+  if (Sec->Type == SHT_PROGBITS && !isRelroSection(Sec))
+    Rank |= RF_PROGBITS;
----------------
ruiu wrote:
> What is this isRelroSection condition for?
This is used to skip reordering for relro sections, because these to be put into RelRo segment must be contiguous, otherwise lld complains. 


================
Comment at: ELF/Writer.cpp:1694
+      OutputSection* p = findSection(".text");
+      if (p) OS = p;
       addOptionalRegular(Start, OS, 0);
----------------
ruiu wrote:
> 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.
Done clang-format.

In some cases, Config->ImageBase is too small, like I see 0x1000. And 0x1000 is still too far away from some .text sections.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45788





More information about the llvm-commits mailing list