[PATCH] D45788: Mitigate relocation overflow

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 16:13:15 PDT 2018


ruiu added inline comments.


================
Comment at: ELF/Writer.cpp:722
+  // Place sections with PROGBITS closer.
+  if (Sec->Type == SHT_PROGBITS && !isRelroSection(Sec))
+    Rank |= RF_PROGBITS;
----------------
shenhan wrote:
> 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.
Doesn't that mean that the priority you gave to RF_NON_TLS_BSS_RO is not appropriate? If you give it lower priority than the RELRO priority (i.e. RF_NON_TLS_BSS_RO), it should automatically work, no?


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45788





More information about the llvm-commits mailing list