[PATCH] D45788: Mitigate relocation overflow

Han Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 11:17:03 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:
> shenhan wrote:
> > 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. 
> How did it work before this patch? I thought that all relro sections are progbits sections, so setting PF_PROGBITS to everybody doesn't change the existing behavior. It is confusing if you don't set RF_PROGBITS to everybody unconditionally.
Most of relro have PROGBITS, but ".dynamic" & ".tbss" don't. So the condition test is to keep those 2 sections contiguous with other relro sections.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45788





More information about the llvm-commits mailing list