Skip to content

Commit

Permalink
[ELF] - refactor of code in RelocationSection<ELFT>::writeTo()
Browse files Browse the repository at this point in the history
Just a little reformat of 'if' conditions, NFC.

Differential revision: http://reviews.llvm.org/D15453

llvm-svn: 255626
  • Loading branch information
George Rimar committed Dec 15, 2015
1 parent 28c7541 commit e355642
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions lld/ELF/OutputSections.cpp
Expand Up @@ -264,21 +264,19 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) {
bool LazyReloc = Body && Target->supportsLazyRelocations() &&
Target->relocNeedsPlt(Type, *Body);

if (CanBePreempted) {
unsigned GotReloc =
Body->isTLS() ? Target->getTlsGotReloc() : Target->getGotReloc();
if (NeedsGot)
P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
LazyReloc ? Target->getPltReloc() : GotReloc,
Config->Mips64EL);
else
P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
NeedsCopy ? Target->getCopyReloc()
: Target->getDynReloc(Type),
Config->Mips64EL);
} else {
P->setSymbolAndType(0, Target->getRelativeReloc(), Config->Mips64EL);
}
unsigned Sym = CanBePreempted ? Body->getDynamicSymbolTableIndex() : 0;
unsigned Rel;
if (!CanBePreempted)
Rel = Target->getRelativeReloc();
else if (LazyReloc)
Rel = Target->getPltReloc();
else if (NeedsGot)
Rel = Body->isTLS() ? Target->getTlsGotReloc() : Target->getGotReloc();
else if (NeedsCopy)
Rel = Target->getCopyReloc();
else
Rel = Target->getDynReloc(Type);
P->setSymbolAndType(Sym, Rel, Config->Mips64EL);

if (NeedsGot) {
if (LazyReloc)
Expand Down

0 comments on commit e355642

Please sign in to comment.