Skip to content

Commit

Permalink
[ELF][PPC64] Use the regular placement for .branch_lt
Browse files Browse the repository at this point in the history
The currently rule places .branch_lt after .data, which does not make
sense. The original contributor probably wanted to place .branch_lt
before .got/.toc, but failed to notice that .got/.toc are RELRO and
placed earlier.

Remove the special case so that .branch_lt is actually closer to .toc,
alleviating the distance issue.
  • Loading branch information
MaskRay committed Sep 14, 2023
1 parent a700ed6 commit e057d89
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lld/ELF/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,12 +941,10 @@ static unsigned getSectionRank(const OutputSection &osec) {
// their coverage by a single signed 16-bit offset from the TOC base
// pointer.
StringRef name = osec.name;
if (name == ".branch_lt")
if (name == ".got")
rank |= 1;
else if (name == ".got")
rank |= 2;
else if (name == ".toc")
rank |= 4;
rank |= 2;
}

if (config->emachine == EM_MIPS) {
Expand Down

0 comments on commit e057d89

Please sign in to comment.