llvm.org GIT mirror llvm / 42f80af
toELFSymIter and getSymbol are now the same thing. Merge them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244482 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 4 years ago
1 changed file(s) with 10 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
238238 return *EF.getSection(Rel.d.a);
239239 }
240240
241 const Elf_Sym *toELFSymIter(DataRefImpl Sym) const {
242 return EF.template getEntry(Sym.d.a, Sym.d.b);
243 }
244
245241 DataRefImpl toDRI(const Elf_Shdr *SymTable, unsigned SymbolNum) const {
246242 DataRefImpl DRI;
247243 if (!SymTable) {
302298 const Elf_Rel *getRel(DataRefImpl Rel) const;
303299 const Elf_Rela *getRela(DataRefImpl Rela) const;
304300
305 const Elf_Sym *getSymbol(DataRefImpl Symb) const;
301 const Elf_Sym *getSymbol(DataRefImpl Sym) const {
302 return EF.template getEntry(Sym.d.a, Sym.d.b);
303 }
306304
307305 basic_symbol_iterator symbol_begin_impl() const override;
308306 basic_symbol_iterator symbol_end_impl() const override;
349347
350348 template
351349 ErrorOr ELFObjectFile::getSymbolName(DataRefImpl Sym) const {
352 const Elf_Sym *ESym = toELFSymIter(Sym);
350 const Elf_Sym *ESym = getSymbol(Sym);
353351 const Elf_Shdr *SymTableSec = *EF.getSection(Sym.d.a);
354352 const Elf_Shdr *StringTableSec = *EF.getSection(SymTableSec->sh_link);
355353 StringRef SymTable = *EF.getStringTable(StringTableSec);
410408
411409 template
412410 uint32_t ELFObjectFile::getSymbolAlignment(DataRefImpl Symb) const {
413 const Elf_Sym *Sym = toELFSymIter(Symb);
411 const Elf_Sym *Sym = getSymbol(Symb);
414412 if (Sym->st_shndx == ELF::SHN_COMMON)
415413 return Sym->st_value;
416414 return 0;
418416
419417 template
420418 uint64_t ELFObjectFile::getSymbolSize(DataRefImpl Sym) const {
421 return toELFSymIter(Sym)->st_size;
419 return getSymbol(Sym)->st_size;
422420 }
423421
424422 template
425423 uint64_t ELFObjectFile::getCommonSymbolSizeImpl(DataRefImpl Symb) const {
426 return toELFSymIter(Symb)->st_size;
424 return getSymbol(Symb)->st_size;
427425 }
428426
429427 template
430428 uint8_t ELFObjectFile::getSymbolOther(DataRefImpl Symb) const {
431 return toELFSymIter(Symb)->st_other;
429 return getSymbol(Symb)->st_other;
432430 }
433431
434432 template
435433 uint8_t ELFObjectFile::getSymbolELFType(DataRefImpl Symb) const {
436 return toELFSymIter(Symb)->getType();
434 return getSymbol(Symb)->getType();
437435 }
438436
439437 template
460458
461459 template
462460 uint32_t ELFObjectFile::getSymbolFlags(DataRefImpl Sym) const {
463 const Elf_Sym *ESym = toELFSymIter(Sym);
461 const Elf_Sym *ESym = getSymbol(Sym);
464462
465463 uint32_t Result = SymbolRef::SF_None;
466464
708706 if (getRelSection(Rel)->sh_type != ELF::SHT_RELA)
709707 return object_error::parse_failed;
710708 return (int64_t)getRela(Rel)->r_addend;
711 }
712
713 template
714 const typename ELFFile::Elf_Sym *
715 ELFObjectFile::getSymbol(DataRefImpl Symb) const {
716 return &*toELFSymIter(Symb);
717709 }
718710
719711 template