@@ -121,7 +121,7 @@ struct ELFWriter {
121
121
} Mode;
122
122
123
123
uint64_t symbolValue (const MCSymbol &Sym);
124
- bool isInSymtab (const MCSymbolELF &Symbol, bool Used, bool Renamed );
124
+ bool isInSymtab (const MCSymbolELF &Symbol);
125
125
126
126
// / Helper struct for containing some precomputed information on symbols.
127
127
struct ELFSymbolData {
@@ -469,7 +469,7 @@ void ELFWriter::writeSymbol(SymbolTableWriter &Writer, uint32_t StringIndex,
469
469
IsReserved);
470
470
}
471
471
472
- bool ELFWriter::isInSymtab (const MCSymbolELF &Symbol, bool Used, bool Renamed ) {
472
+ bool ELFWriter::isInSymtab (const MCSymbolELF &Symbol) {
473
473
if (Symbol.isVariable ()) {
474
474
const MCExpr *Expr = Symbol.getVariableValue ();
475
475
// Target Expressions that are always inlined do not appear in the symtab
@@ -479,27 +479,18 @@ bool ELFWriter::isInSymtab(const MCSymbolELF &Symbol, bool Used, bool Renamed) {
479
479
// The .weakref alias does not appear in the symtab.
480
480
if (Symbol.isWeakref ())
481
481
return false ;
482
- }
483
-
484
- if (Used)
485
- return true ;
486
482
487
- if (Renamed)
488
- return false ;
489
-
490
- if (Symbol.isVariable () && Symbol.isUndefined ()) {
491
- // FIXME: this is here just to diagnose the case of a var = commmon_sym.
492
- Asm.getBaseSymbol (Symbol);
493
- return false ;
483
+ if (Symbol.isUndefined ()) {
484
+ // FIXME: this is here just to diagnose the case of a var = commmon_sym.
485
+ Asm.getBaseSymbol (Symbol);
486
+ return false ;
487
+ }
494
488
}
495
489
496
490
if (Symbol.isTemporary ())
497
491
return false ;
498
492
499
- if (Symbol.getType () == ELF::STT_SECTION)
500
- return false ;
501
-
502
- return true ;
493
+ return Symbol.getType () != ELF::STT_SECTION;
503
494
}
504
495
505
496
void ELFWriter::computeSymbolTable (const RevGroupMapTy &RevGroupMap) {
@@ -531,8 +522,7 @@ void ELFWriter::computeSymbolTable(const RevGroupMapTy &RevGroupMap) {
531
522
const auto &Symbol = cast<MCSymbolELF>(It.value ());
532
523
bool Used = Symbol.isUsedInReloc ();
533
524
bool isSignature = Symbol.isSignature ();
534
- if (!isInSymtab (Symbol, Used || isSignature,
535
- OWriter.Renames .count (&Symbol)))
525
+ if (!(Used || (!OWriter.Renames .count (&Symbol) && isInSymtab (Symbol))))
536
526
continue ;
537
527
538
528
if (Symbol.isTemporary () && Symbol.isUndefined ()) {
0 commit comments