[lld] r289550 - Refactor duplicated expression. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 08:59:19 PST 2016
Author: rafael
Date: Tue Dec 13 10:59:19 2016
New Revision: 289550
URL: http://llvm.org/viewvc/llvm-project?rev=289550&view=rev
Log:
Refactor duplicated expression. NFC.
Modified:
lld/trunk/ELF/Relocations.cpp
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=289550&r1=289549&r2=289550&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Tue Dec 13 10:59:19 2016
@@ -150,6 +150,7 @@ static unsigned handleTlsRelocation(uint
return handleNoRelaxTlsRelocation<ELFT>(In<ELFT>::MipsGot, Type, Body, C,
Offset, Addend, Expr);
+ bool IsPreemptible = isPreemptible(Body, Type);
if ((Expr == R_TLSDESC || Expr == R_TLSDESC_PAGE || Expr == R_TLSDESC_CALL) &&
Config->Shared) {
if (In<ELFT>::Got->addDynTlsEntry(Body)) {
@@ -195,7 +196,7 @@ static unsigned handleTlsRelocation(uint
// If the symbol is preemptible we need the dynamic linker to write
// the offset too.
uintX_t OffsetOff = Off + (uintX_t)sizeof(uintX_t);
- if (isPreemptible(Body, Type))
+ if (IsPreemptible)
In<ELFT>::RelaDyn->addReloc({Target->TlsOffsetRel, In<ELFT>::Got,
OffsetOff, false, &Body, 0});
else
@@ -208,7 +209,7 @@ static unsigned handleTlsRelocation(uint
// Global-Dynamic relocs can be relaxed to Initial-Exec or Local-Exec
// depending on the symbol being locally defined or not.
- if (isPreemptible(Body, Type)) {
+ if (IsPreemptible) {
C.Relocations.push_back(
{Target->adjustRelaxExpr(Type, nullptr, R_RELAX_TLS_GD_TO_IE), Type,
Offset, Addend, &Body});
@@ -228,8 +229,7 @@ static unsigned handleTlsRelocation(uint
// Initial-Exec relocs can be relaxed to Local-Exec if the symbol is locally
// defined.
- if (Target->isTlsInitialExecRel(Type) && !Config->Shared &&
- !isPreemptible(Body, Type)) {
+ if (Target->isTlsInitialExecRel(Type) && !Config->Shared && !IsPreemptible) {
C.Relocations.push_back(
{R_RELAX_TLS_IE_TO_LE, Type, Offset, Addend, &Body});
return 1;
More information about the llvm-commits
mailing list