forked from OSchip/llvm-project
parent
719dc7c436
commit
4d24127ae0
|
@ -70,7 +70,7 @@ template <class ELFT> std::error_code DynamicFile<ELFT>::doParse() {
|
||||||
// it exists.
|
// it exists.
|
||||||
for (auto i = obj.begin_dynamic_symbols(), e = obj.end_dynamic_symbols();
|
for (auto i = obj.begin_dynamic_symbols(), e = obj.end_dynamic_symbols();
|
||||||
i != e; ++i) {
|
i != e; ++i) {
|
||||||
auto name = obj.getSymbolName(i);
|
auto name = obj.getSymbolName(i, true);
|
||||||
if ((ec = name.getError()))
|
if ((ec = name.getError()))
|
||||||
return ec;
|
return ec;
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ std::error_code ELFFile<ELFT>::createSymbolsFromAtomizableSections() {
|
||||||
for (; SymI != SymE; ++SymI) {
|
for (; SymI != SymE; ++SymI) {
|
||||||
const Elf_Shdr *section = _objFile->getSection(&*SymI);
|
const Elf_Shdr *section = _objFile->getSection(&*SymI);
|
||||||
|
|
||||||
auto symbolName = _objFile->getSymbolName(SymI);
|
auto symbolName = _objFile->getSymbolName(SymI, false);
|
||||||
if (std::error_code ec = symbolName.getError())
|
if (std::error_code ec = symbolName.getError())
|
||||||
return ec;
|
return ec;
|
||||||
|
|
||||||
|
@ -264,11 +264,11 @@ template <class ELFT> std::error_code ELFFile<ELFT>::createAtoms() {
|
||||||
// Contains a list of comdat sections for a group.
|
// Contains a list of comdat sections for a group.
|
||||||
for (auto &i : _sectionSymbols) {
|
for (auto &i : _sectionSymbols) {
|
||||||
const Elf_Shdr *section = i.first;
|
const Elf_Shdr *section = i.first;
|
||||||
std::vector<Elf_Sym_Iter> &symbols = i.second;
|
std::vector<const Elf_Sym *> &symbols = i.second;
|
||||||
|
|
||||||
// Sort symbols by position.
|
// Sort symbols by position.
|
||||||
std::stable_sort(symbols.begin(), symbols.end(),
|
std::stable_sort(symbols.begin(), symbols.end(),
|
||||||
[this](Elf_Sym_Iter a, Elf_Sym_Iter b) {
|
[this](const Elf_Sym *a, const Elf_Sym *b) {
|
||||||
return getSymbolValue(&*a) < getSymbolValue(&*b);
|
return getSymbolValue(&*a) < getSymbolValue(&*b);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ template <class ELFT> std::error_code ELFFile<ELFT>::createAtoms() {
|
||||||
auto symbol = *si;
|
auto symbol = *si;
|
||||||
StringRef symbolName = "";
|
StringRef symbolName = "";
|
||||||
if (symbol->getType() != llvm::ELF::STT_SECTION) {
|
if (symbol->getType() != llvm::ELF::STT_SECTION) {
|
||||||
auto symName = _objFile->getSymbolName(symbol);
|
auto symName = _objFile->getSymbolName(symbol, false);
|
||||||
if (std::error_code ec = symName.getError())
|
if (std::error_code ec = symName.getError())
|
||||||
return ec;
|
return ec;
|
||||||
symbolName = *symName;
|
symbolName = *symName;
|
||||||
|
@ -486,7 +486,8 @@ std::error_code ELFFile<ELFT>::handleSectionGroup(
|
||||||
}
|
}
|
||||||
const Elf_Sym *symbol = _objFile->getSymbol(section->sh_info);
|
const Elf_Sym *symbol = _objFile->getSymbol(section->sh_info);
|
||||||
const Elf_Shdr *symtab = _objFile->getSection(section->sh_link);
|
const Elf_Shdr *symtab = _objFile->getSection(section->sh_link);
|
||||||
ErrorOr<StringRef> symbolName = _objFile->getSymbolName(symtab, symbol);
|
const Elf_Shdr *strtab = _objFile->getSection(symtab->sh_link);
|
||||||
|
ErrorOr<StringRef> symbolName = _objFile->getSymbolName(strtab, symbol);
|
||||||
if (std::error_code ec = symbolName.getError())
|
if (std::error_code ec = symbolName.getError())
|
||||||
return ec;
|
return ec;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ template <class ELFT> class ELFFile : public SimpleFile {
|
||||||
typedef llvm::object::Elf_Shdr_Impl<ELFT> Elf_Shdr;
|
typedef llvm::object::Elf_Shdr_Impl<ELFT> Elf_Shdr;
|
||||||
typedef llvm::object::Elf_Rel_Impl<ELFT, false> Elf_Rel;
|
typedef llvm::object::Elf_Rel_Impl<ELFT, false> Elf_Rel;
|
||||||
typedef llvm::object::Elf_Rel_Impl<ELFT, true> Elf_Rela;
|
typedef llvm::object::Elf_Rel_Impl<ELFT, true> Elf_Rela;
|
||||||
typedef typename llvm::object::ELFFile<ELFT>::Elf_Sym_Iter Elf_Sym_Iter;
|
|
||||||
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rela_Iter Elf_Rela_Iter;
|
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rela_Iter Elf_Rela_Iter;
|
||||||
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rel_Iter Elf_Rel_Iter;
|
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rel_Iter Elf_Rel_Iter;
|
||||||
typedef typename llvm::object::ELFFile<ELFT>::Elf_Word Elf_Word;
|
typedef typename llvm::object::ELFFile<ELFT>::Elf_Word Elf_Word;
|
||||||
|
@ -200,7 +199,7 @@ protected:
|
||||||
/// Determines if the target wants to create an atom for a section that has no
|
/// Determines if the target wants to create an atom for a section that has no
|
||||||
/// symbol references.
|
/// symbol references.
|
||||||
bool handleSectionWithNoSymbols(const Elf_Shdr *shdr,
|
bool handleSectionWithNoSymbols(const Elf_Shdr *shdr,
|
||||||
std::vector<Elf_Sym_Iter> &syms) const {
|
std::vector<const Elf_Sym *> &syms) const {
|
||||||
return shdr &&
|
return shdr &&
|
||||||
(shdr->sh_type == llvm::ELF::SHT_PROGBITS ||
|
(shdr->sh_type == llvm::ELF::SHT_PROGBITS ||
|
||||||
shdr->sh_type == llvm::ELF::SHT_INIT_ARRAY ||
|
shdr->sh_type == llvm::ELF::SHT_INIT_ARRAY ||
|
||||||
|
@ -348,7 +347,8 @@ protected:
|
||||||
|
|
||||||
/// \brief the section and the symbols that are contained within it to create
|
/// \brief the section and the symbols that are contained within it to create
|
||||||
/// used to create atoms
|
/// used to create atoms
|
||||||
llvm::MapVector<const Elf_Shdr *, std::vector<Elf_Sym_Iter>> _sectionSymbols;
|
llvm::MapVector<const Elf_Shdr *, std::vector<const Elf_Sym *>>
|
||||||
|
_sectionSymbols;
|
||||||
|
|
||||||
/// \brief Sections that have merge string property
|
/// \brief Sections that have merge string property
|
||||||
std::vector<const Elf_Shdr *> _mergeStringSections;
|
std::vector<const Elf_Shdr *> _mergeStringSections;
|
||||||
|
|
Loading…
Reference in New Issue