From ed95fce2287472a7df6171fcdcafe854f3218950 Mon Sep 17 00:00:00 2001 From: Jake Ehrlich Date: Wed, 27 Sep 2017 00:44:00 +0000 Subject: [PATCH] Reland: [llvm-objcopy] Add support for dynamic relocations This change adds support for dynamic relocations (allocated SHT_REL/SHT_RELA sections with a dynamic symbol table as their link). I had to reland this because of a I wasn't initilizing some pointers. llvm-svn: 314263 --- llvm/tools/llvm-objcopy/Object.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/llvm/tools/llvm-objcopy/Object.h b/llvm/tools/llvm-objcopy/Object.h index 41c9d7b..02aeeca 100644 --- a/llvm/tools/llvm-objcopy/Object.h +++ b/llvm/tools/llvm-objcopy/Object.h @@ -148,7 +148,7 @@ enum SymbolShndxType { struct Symbol { uint8_t Binding; - SectionBase *DefinedIn; + SectionBase *DefinedIn = nullptr; SymbolShndxType ShndxType; uint32_t Index; llvm::StringRef Name; @@ -163,7 +163,7 @@ struct Symbol { class SymbolTableSection : public SectionBase { protected: std::vector> Symbols; - StringTableSection *SymbolNames; + StringTableSection *SymbolNames = nullptr; public: void setStrTab(StringTableSection *StrTab) { SymbolNames = StrTab; } @@ -185,7 +185,7 @@ template class SymbolTableSectionImpl : public SymbolTableSection { }; struct Relocation { - const Symbol *RelocSymbol; + const Symbol *RelocSymbol = nullptr; uint64_t Offset; uint64_t Addend; uint32_t Type; @@ -193,8 +193,8 @@ struct Relocation { template class RelocationSectionBase : public SectionBase { private: - SymTabType *Symbols; - SectionBase *SecToApplyRel; + SymTabType *Symbols = nullptr; + SectionBase *SecToApplyRel = nullptr; public: void setSymTab(SymTabType *StrTab) { Symbols = StrTab; } @@ -226,7 +226,7 @@ public: class SectionWithStrTab : public Section { private: - StringTableSection *StrTab; + StringTableSection *StrTab = nullptr; public: SectionWithStrTab(llvm::ArrayRef Data) : Section(Data) {} @@ -285,8 +285,8 @@ private: SectionTableRef readSectionHeaders(const llvm::object::ELFFile &ElfFile); protected: - StringTableSection *SectionNames; - SymbolTableSection *SymbolTable; + StringTableSection *SectionNames = nullptr; + SymbolTableSection *SymbolTable = nullptr; std::vector Sections; std::vector Segments; -- 2.7.4