[PATCH] D45788: Mitigate relocation overflow
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 19 10:23:26 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:
> > 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.
================
Comment at: ELF/Writer.cpp:1693-1697
if (Config->Pic)
OS = Out::ElfHeader;
+ OutputSection* p = findSection(".text");
+ if (p)
+ OS = p;
----------------
Please find .text section outside of this lambda to call findSection only once.
p needs to be P by the LLVM coding style. But I prefer Text.
`OutputSection* p` -> `OutputSection *P` by the LLVM coding style.
Please look around to make sure your new code matches with other code in the same file in style.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D45788
More information about the llvm-commits
mailing list