@@ -22,16 +22,16 @@ struct BPOrdererELF;
22
22
}
23
23
template <> struct lld ::BPOrdererTraits<struct BPOrdererELF > {
24
24
using Section = elf::InputSectionBase;
25
- using Symbol = elf::Symbol ;
25
+ using Defined = elf::Defined ;
26
26
};
27
27
namespace {
28
28
struct BPOrdererELF : lld::BPOrderer<BPOrdererELF> {
29
29
static uint64_t getSize (const Section &sec) { return sec.getSize (); }
30
30
static bool isCodeSection (const Section &sec) {
31
31
return sec.flags & llvm::ELF::SHF_EXECINSTR;
32
32
}
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;
35
35
for (auto *sym : sec.file ->getSymbols ())
36
36
if (auto *d = llvm::dyn_cast_or_null<Defined>(sym))
37
37
if (d->size > 0 && d->section == &sec)
@@ -56,17 +56,9 @@ struct BPOrdererELF : lld::BPOrderer<BPOrdererELF> {
56
56
hashes.erase (std::unique (hashes.begin (), hashes.end ()), hashes.end ());
57
57
}
58
58
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 ; }
70
62
};
71
63
} // namespace
72
64
0 commit comments