diff options
| author | Alexander Shaposhnikov <shal1t712@gmail.com> | 2018-04-20 20:46:04 +0000 |
|---|---|---|
| committer | Alexander Shaposhnikov <shal1t712@gmail.com> | 2018-04-20 20:46:04 +0000 |
| commit | 52db4335b3a121333f8954ee27d0f09c1596a46b (patch) | |
| tree | e565202e934ff617d526bd282354f1800e2ae2f5 /llvm/tools/llvm-objcopy/Object.h | |
| parent | 334c379e32b8fcc7f73ffaba3baf88a5be29a269 (diff) | |
| download | bcm5719-llvm-52db4335b3a121333f8954ee27d0f09c1596a46b.tar.gz bcm5719-llvm-52db4335b3a121333f8954ee27d0f09c1596a46b.zip | |
[llvm-objcopy] Fix sh_link
This diff fixes sh_link for various types of sections
(i.e. for SHT_ARM_EXIDX, SHT_HASH). In particular, this change enables us
to use llvm-objcopy with clang -gsplit-dwarf for the target android-arm.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D45851
llvm-svn: 330478
Diffstat (limited to 'llvm/tools/llvm-objcopy/Object.h')
| -rw-r--r-- | llvm/tools/llvm-objcopy/Object.h | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/llvm/tools/llvm-objcopy/Object.h b/llvm/tools/llvm-objcopy/Object.h index bf8b52244d8..ddc0da16aa4 100644 --- a/llvm/tools/llvm-objcopy/Object.h +++ b/llvm/tools/llvm-objcopy/Object.h @@ -259,11 +259,15 @@ class Section : public SectionBase { MAKE_SEC_WRITER_FRIEND ArrayRef<uint8_t> Contents; + SectionBase *LinkSection = nullptr; public: explicit Section(ArrayRef<uint8_t> Data) : Contents(Data) {} void accept(SectionVisitor &Visitor) const override; + void removeSectionReferences(const SectionBase *Sec) override; + void initialize(SectionTableRef SecTable) override; + void finalize() override; }; class OwnedDataSection : public SectionBase { @@ -456,7 +460,7 @@ public: void setFlagWord(ELF::Elf32_Word W) { FlagWord = W; } void addMember(SectionBase *Sec) { GroupMembers.push_back(Sec); } - void initialize(SectionTableRef SecTable) override {}; + void initialize(SectionTableRef SecTable) override{}; void accept(SectionVisitor &) const override; void finalize() override; @@ -465,31 +469,18 @@ public: } }; -class SectionWithStrTab : public Section { - const SectionBase *StrTab = nullptr; - void setStrTab(const SectionBase *StringTable) { StrTab = StringTable; } - -public: - explicit SectionWithStrTab(ArrayRef<uint8_t> Data) : Section(Data) {} - void removeSectionReferences(const SectionBase *Sec) override; - void initialize(SectionTableRef SecTable) override; - void finalize() override; - static bool classof(const SectionBase *S); -}; - -class DynamicSymbolTableSection : public SectionWithStrTab { +class DynamicSymbolTableSection : public Section { public: - explicit DynamicSymbolTableSection(ArrayRef<uint8_t> Data) - : SectionWithStrTab(Data) {} + explicit DynamicSymbolTableSection(ArrayRef<uint8_t> Data) : Section(Data) {} static bool classof(const SectionBase *S) { return S->Type == ELF::SHT_DYNSYM; } }; -class DynamicSection : public SectionWithStrTab { +class DynamicSection : public Section { public: - explicit DynamicSection(ArrayRef<uint8_t> Data) : SectionWithStrTab(Data) {} + explicit DynamicSection(ArrayRef<uint8_t> Data) : Section(Data) {} static bool classof(const SectionBase *S) { return S->Type == ELF::SHT_DYNAMIC; |

