diff options
Diffstat (limited to 'llvm/tools/llvm-objcopy/ELF/Object.h')
-rw-r--r-- | llvm/tools/llvm-objcopy/ELF/Object.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/tools/llvm-objcopy/ELF/Object.h b/llvm/tools/llvm-objcopy/ELF/Object.h index f3df93b9662..3b4f3c7a0d7 100644 --- a/llvm/tools/llvm-objcopy/ELF/Object.h +++ b/llvm/tools/llvm-objcopy/ELF/Object.h @@ -1018,6 +1018,7 @@ public: uint32_t Flags; bool HadShdrs = true; + bool MustBeRelocatable = false; StringTableSection *SectionNames = nullptr; SymbolTableSection *SymbolTable = nullptr; SectionIndexSection *SectionIndexTable = nullptr; @@ -1043,6 +1044,7 @@ public: template <class T, class... Ts> T &addSection(Ts &&... Args) { auto Sec = llvm::make_unique<T>(std::forward<Ts>(Args)...); auto Ptr = Sec.get(); + MustBeRelocatable |= isa<RelocationSection>(*Ptr); Sections.emplace_back(std::move(Sec)); Ptr->Index = Sections.size(); return *Ptr; @@ -1051,6 +1053,9 @@ public: Segments.emplace_back(llvm::make_unique<Segment>(Data)); return *Segments.back(); } + bool isRelocatable() const { + return (Type != ELF::ET_DYN && Type != ELF::ET_EXEC) || MustBeRelocatable; + } }; } // end namespace elf |