@@ -401,14 +401,14 @@ static bool isIFunc(const MCSymbolELF *Symbol) {
401
401
mergeTypeForSet (Symbol->getType (), ELF::STT_GNU_IFUNC) !=
402
402
ELF::STT_GNU_IFUNC)
403
403
return false ;
404
- Symbol = &cast< MCSymbolELF>(Value->getSymbol ());
404
+ Symbol = &static_cast < const MCSymbolELF & >(Value->getSymbol ());
405
405
}
406
406
return true ;
407
407
}
408
408
409
409
void ELFWriter::writeSymbol (SymbolTableWriter &Writer, uint32_t StringIndex,
410
410
ELFSymbolData &MSD) {
411
- const auto &Symbol = cast< MCSymbolELF>(*MSD.Symbol );
411
+ auto &Symbol = static_cast < const MCSymbolELF & >(*MSD.Symbol );
412
412
const MCSymbolELF *Base =
413
413
cast_or_null<MCSymbolELF>(Asm.getBaseSymbol (Symbol));
414
414
@@ -446,7 +446,7 @@ void ELFWriter::writeSymbol(SymbolTableWriter &Writer, uint32_t StringIndex,
446
446
const MCSymbolELF *Sym = &Symbol;
447
447
while (Sym->isVariable ()) {
448
448
if (auto *Expr = dyn_cast<MCSymbolRefExpr>(Sym->getVariableValue ())) {
449
- Sym = cast< MCSymbolELF>(&Expr->getSymbol ());
449
+ Sym = static_cast < const MCSymbolELF * >(&Expr->getSymbol ());
450
450
if (!Sym->getSize ())
451
451
continue ;
452
452
ESize = Sym->getSize ();
@@ -523,7 +523,7 @@ void ELFWriter::computeSymbolTable(const RevGroupMapTy &RevGroupMap) {
523
523
// Add the data for the symbols.
524
524
bool HasLargeSectionIndex = false ;
525
525
for (auto It : llvm::enumerate (Asm.symbols ())) {
526
- const auto &Symbol = cast< MCSymbolELF>(It.value ());
526
+ auto &Symbol = static_cast < const MCSymbolELF & >(It.value ());
527
527
if (!isInSymtab (Symbol))
528
528
continue ;
529
529
@@ -533,7 +533,7 @@ void ELFWriter::computeSymbolTable(const RevGroupMapTy &RevGroupMap) {
533
533
}
534
534
535
535
ELFSymbolData MSD;
536
- MSD.Symbol = cast< MCSymbolELF>(&Symbol);
536
+ MSD.Symbol = static_cast < const MCSymbolELF * >(&Symbol);
537
537
MSD.Order = It.index ();
538
538
539
539
bool Local = Symbol.getBinding () == ELF::STB_LOCAL;
@@ -1175,7 +1175,7 @@ void ELFObjectWriter::executePostLayoutBinding() {
1175
1175
// versions declared with @@@ to be renamed.
1176
1176
for (const Symver &S : Symvers) {
1177
1177
StringRef AliasName = S.Name ;
1178
- const auto &Symbol = cast< MCSymbolELF>(*S.Sym );
1178
+ auto &Symbol = static_cast < const MCSymbolELF & >(*S.Sym );
1179
1179
size_t Pos = AliasName.find (' @' );
1180
1180
assert (Pos != StringRef::npos);
1181
1181
@@ -1185,8 +1185,8 @@ void ELFObjectWriter::executePostLayoutBinding() {
1185
1185
if (Rest.starts_with (" @@@" ))
1186
1186
Tail = Rest.substr (Symbol.isUndefined () ? 2 : 1 );
1187
1187
1188
- auto *Alias =
1189
- cast<MCSymbolELF>( Asm->getContext ().getOrCreateSymbol (Prefix + Tail));
1188
+ auto *Alias = static_cast <MCSymbolELF *>(
1189
+ Asm->getContext ().getOrCreateSymbol (Prefix + Tail));
1190
1190
Asm->registerSymbol (*Alias);
1191
1191
const MCExpr *Value = MCSymbolRefExpr::create (&Symbol, Asm->getContext ());
1192
1192
Alias->setVariableValue (Value);
@@ -1218,7 +1218,8 @@ void ELFObjectWriter::executePostLayoutBinding() {
1218
1218
}
1219
1219
1220
1220
for (const MCSymbol *&Sym : AddrsigSyms) {
1221
- if (const MCSymbol *R = Renames.lookup (cast<MCSymbolELF>(Sym)))
1221
+ if (const MCSymbol *R =
1222
+ Renames.lookup (static_cast <const MCSymbolELF *>(Sym)))
1222
1223
Sym = R;
1223
1224
if (Sym->isInSection () && Sym->getName ().starts_with (" .L" ))
1224
1225
Sym = Sym->getSection ().getBeginSymbol ();
@@ -1234,7 +1235,7 @@ void ELFObjectWriter::executePostLayoutBinding() {
1234
1235
continue ;
1235
1236
auto *Expr = Alias->getVariableValue ();
1236
1237
if (const auto *Inner = dyn_cast<MCSymbolRefExpr>(Expr)) {
1237
- auto &Sym = cast< MCSymbolELF>(Inner->getSymbol ());
1238
+ auto &Sym = static_cast < const MCSymbolELF & >(Inner->getSymbol ());
1238
1239
if (Asm->registerSymbol (Sym))
1239
1240
Sym.setBinding (ELF::STB_WEAK);
1240
1241
}
@@ -1328,7 +1329,7 @@ void ELFObjectWriter::recordRelocation(const MCFragment &F,
1328
1329
uint64_t FixupOffset = Asm->getFragmentOffset (F) + Fixup.getOffset ();
1329
1330
uint64_t Addend = Target.getConstant ();
1330
1331
if (auto *RefB = Target.getSubSym ()) {
1331
- const auto &SymB = cast< MCSymbolELF>(*RefB);
1332
+ auto &SymB = static_cast < const MCSymbolELF & >(*RefB);
1332
1333
if (SymB.isUndefined ()) {
1333
1334
Ctx.reportError (Fixup.getLoc (),
1334
1335
Twine (" symbol '" ) + SymB.getName () +
@@ -1363,7 +1364,7 @@ void ELFObjectWriter::recordRelocation(const MCFragment &F,
1363
1364
!mc::isRelocRelocation (Fixup.getKind ());
1364
1365
if (UseSectionSym && useSectionSymbol (Target, SymA, Addend, Type)) {
1365
1366
Addend += Asm->getSymbolOffset (*SymA);
1366
- SymA = cast< MCSymbolELF>(SecA->getBeginSymbol ());
1367
+ SymA = static_cast < const MCSymbolELF * >(SecA->getBeginSymbol ());
1367
1368
} else if (const MCSymbolELF *R = Renames.lookup (SymA)) {
1368
1369
SymA = R;
1369
1370
}
@@ -1383,7 +1384,7 @@ bool ELFObjectWriter::usesRela(const MCTargetOptions *TO,
1383
1384
1384
1385
bool ELFObjectWriter::isSymbolRefDifferenceFullyResolvedImpl (
1385
1386
const MCSymbol &SA, const MCFragment &FB, bool InSet, bool IsPCRel) const {
1386
- const auto &SymA = cast< MCSymbolELF>(SA);
1387
+ auto &SymA = static_cast < const MCSymbolELF & >(SA);
1387
1388
if (IsPCRel) {
1388
1389
assert (!InSet);
1389
1390
if (SymA.getBinding () != ELF::STB_LOCAL ||
0 commit comments