summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2015-12-15 08:23:08 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2015-12-15 08:23:08 +0000
commite3556420c1c02f1e34ad87acac458348e7d29389 (patch)
tree22cf569ddc04285ec9c0f7fd9c70f33cd321cfd2
parent28c75417b2c48780432eaf5eb35cf7c0a2ad5217 (diff)
downloadbcm5719-llvm-e3556420c1c02f1e34ad87acac458348e7d29389.tar.gz
bcm5719-llvm-e3556420c1c02f1e34ad87acac458348e7d29389.zip
[ELF] - refactor of code in RelocationSection<ELFT>::writeTo()
Just a little reformat of 'if' conditions, NFC. Differential revision: http://reviews.llvm.org/D15453 llvm-svn: 255626
-rw-r--r--lld/ELF/OutputSections.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index c64610fe80b..d28df76b7a5 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -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)
OpenPOWER on IntegriCloud