Skip to content

Commit b76aace

Browse files
committed
[ELF] Simplify isStaticLinkTimeConstant. NFC
1 parent ff846fc commit b76aace

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lld/ELF/Relocations.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -224,20 +224,16 @@ static bool isRelExpr(RelExpr expr) {
224224
static bool isStaticLinkTimeConstant(RelExpr e, RelType type, const Symbol &sym,
225225
InputSectionBase &s, uint64_t relOff) {
226226
// These expressions always compute a constant
227-
if (oneof<R_DTPREL, R_GOTPLT, R_GOT_OFF, R_TLSLD_GOT_OFF,
228-
R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOTREL, R_MIPS_GOT_OFF,
229-
R_MIPS_GOT_OFF32, R_MIPS_GOT_GP_PC, R_MIPS_TLSGD,
227+
if (oneof<R_DTPREL, R_GOTPLT, R_GOT_OFF, R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOTREL,
228+
R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32, R_MIPS_GOT_GP_PC,
230229
R_AARCH64_GOT_PAGE_PC, R_GOT_PC, R_GOTONLY_PC, R_GOTPLTONLY_PC,
231-
R_PLT_PC, R_PLT_GOTPLT, R_TLSGD_GOT, R_TLSGD_GOTPLT, R_TLSGD_PC,
232-
R_PPC32_PLTREL, R_PPC64_CALL_PLT, R_PPC64_RELAX_TOC, R_RISCV_ADD,
233-
R_TLSDESC_CALL, R_TLSDESC_PC, R_TLSDESC_GOTPLT,
234-
R_AARCH64_TLSDESC_PAGE, R_TLSLD_HINT, R_TLSIE_HINT,
235-
R_AARCH64_GOT_PAGE>(e))
230+
R_PLT_PC, R_PLT_GOTPLT, R_PPC32_PLTREL, R_PPC64_CALL_PLT,
231+
R_PPC64_RELAX_TOC, R_RISCV_ADD, R_AARCH64_GOT_PAGE>(e))
236232
return true;
237233

238234
// These never do, except if the entire file is position dependent or if
239235
// only the low bits are used.
240-
if (e == R_GOT || e == R_PLT || e == R_TLSDESC)
236+
if (e == R_GOT || e == R_PLT)
241237
return target->usesOnlyLowPageBits(type) || !config->isPic;
242238

243239
if (sym.isPreemptible)
@@ -1293,7 +1289,10 @@ handleTlsRelocation(RelType type, Symbol &sym, InputSectionBase &c,
12931289
if (!sym.isInGot())
12941290
addTpOffsetGotEntry(sym);
12951291
// R_GOT may not be a link-time constant.
1296-
processRelocAux<ELFT>(c, expr, type, offset, sym, addend);
1292+
if (expr == R_GOT)
1293+
processRelocAux<ELFT>(c, expr, type, offset, sym, addend);
1294+
else
1295+
c.relocations.push_back({expr, type, offset, addend, &sym});
12971296
}
12981297
return 1;
12991298
}

0 commit comments

Comments
 (0)