@@ -1323,7 +1323,9 @@ static unsigned handleAArch64PAuthTlsRelocation(InputSectionBase *sec,
13231323unsigned 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