Skip to content

Commit 5f2ee82

Browse files
committed
Address review comments
1 parent ffbc37f commit 5f2ee82

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lld/ELF/Relocations.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,9 @@ static unsigned handleAArch64PAuthTlsRelocation(InputSectionBase *sec,
13231323
unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type,
13241324
uint64_t offset, Symbol &sym,
13251325
int64_t addend) {
1326-
if (ctx.arg.emachine == EM_AARCH64)
1326+
bool isAArch64 = ctx.arg.emachine == EM_AARCH64;
1327+
1328+
if (isAArch64)
13271329
if (unsigned processed = handleAArch64PAuthTlsRelocation(
13281330
sec, expr, type, offset, sym, addend))
13291331
return processed;
@@ -1362,10 +1364,10 @@ unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type,
13621364
// R_RISCV_TLSDESC_{LOAD_LO12,ADD_LO12_I,CALL} reference a label. Do not
13631365
// set NEEDS_TLSDESC on the label.
13641366
if (expr != R_TLSDESC_CALL) {
1365-
if (!isRISCV || type == R_RISCV_TLSDESC_HI20)
1366-
sym.setFlags(
1367-
NEEDS_TLSDESC |
1368-
(ctx.arg.emachine == EM_AARCH64 ? NEEDS_TLSDESC_NONAUTH : 0));
1367+
if (isAArch64)
1368+
sym.setFlags(NEEDS_TLSDESC | NEEDS_TLSDESC_NONAUTH);
1369+
else if (!isRISCV || type == R_RISCV_TLSDESC_HI20)
1370+
sym.setFlags(NEEDS_TLSDESC);
13691371
sec->addReloc({expr, type, offset, addend, &sym});
13701372
}
13711373
return 1;

0 commit comments

Comments
 (0)