@@ -22,16 +22,16 @@ struct BPOrdererELF;
2222}
2323template <> struct lld ::BPOrdererTraits<struct BPOrdererELF > {
2424 using Section = elf::InputSectionBase;
25- using Symbol = elf::Symbol ;
25+ using Defined = elf::Defined ;
2626};
2727namespace {
2828struct BPOrdererELF : lld::BPOrderer<BPOrdererELF> {
2929 static uint64_t getSize (const Section &sec) { return sec.getSize (); }
3030 static bool isCodeSection (const Section &sec) {
3131 return sec.flags & llvm::ELF::SHF_EXECINSTR;
3232 }
33- static SmallVector<Symbol *, 0 > getSymbols (const Section &sec) {
34- SmallVector<Symbol *, 0 > symbols;
33+ static SmallVector<Defined *, 0 > getSymbols (const Section &sec) {
34+ SmallVector<Defined *, 0 > symbols;
3535 for (auto *sym : sec.file ->getSymbols ())
3636 if (auto *d = llvm::dyn_cast_or_null<Defined>(sym))
3737 if (d->size > 0 && d->section == &sec)
@@ -56,17 +56,9 @@ struct BPOrdererELF : lld::BPOrderer<BPOrdererELF> {
5656 hashes.erase (std::unique (hashes.begin (), hashes.end ()), hashes.end ());
5757 }
5858
59- static llvm::StringRef getSymName (const Symbol &sym) { return sym.getName (); }
60- static uint64_t getSymValue (const Symbol &sym) {
61- if (auto *d = dyn_cast<Defined>(&sym))
62- return d->value ;
63- return 0 ;
64- }
65- static uint64_t getSymSize (const Symbol &sym) {
66- if (auto *d = dyn_cast<Defined>(&sym))
67- return d->size ;
68- return 0 ;
69- }
59+ static StringRef getSymName (const Defined &sym) { return sym.getName (); }
60+ static uint64_t getSymValue (const Defined &sym) { return sym.value ; }
61+ static uint64_t getSymSize (const Defined &sym) { return sym.size ; }
7062};
7163} // namespace
7264
0 commit comments