[llvm] r314263 - Reland: [llvm-objcopy] Add support for dynamic relocations

Jake Ehrlich via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 17:44:00 PDT 2017


Author: jakehehrlich
Date: Tue Sep 26 17:44:00 2017
New Revision: 314263

URL: http://llvm.org/viewvc/llvm-project?rev=314263&view=rev
Log:
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.

Modified:
    llvm/trunk/tools/llvm-objcopy/Object.h

Modified: llvm/trunk/tools/llvm-objcopy/Object.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/Object.h?rev=314263&r1=314262&r2=314263&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/Object.h (original)
+++ llvm/trunk/tools/llvm-objcopy/Object.h Tue Sep 26 17:44:00 2017
@@ -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<std::unique_ptr<Symbol>> Symbols;
-  StringTableSection *SymbolNames;
+  StringTableSection *SymbolNames = nullptr;
 
 public:
   void setStrTab(StringTableSection *StrTab) { SymbolNames = StrTab; }
@@ -185,7 +185,7 @@ template <class ELFT> class SymbolTableS
 };
 
 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 SymTabType> 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<uint8_t> Data) : Section(Data) {}
@@ -285,8 +285,8 @@ private:
   SectionTableRef readSectionHeaders(const llvm::object::ELFFile<ELFT> &ElfFile);
 
 protected:
-  StringTableSection *SectionNames;
-  SymbolTableSection *SymbolTable;
+  StringTableSection *SectionNames = nullptr;
+  SymbolTableSection *SymbolTable = nullptr;
   std::vector<SecPtr> Sections;
   std::vector<SegPtr> Segments;
 




More information about the llvm-commits mailing list