#include #include #include #include #include #include ">

LLVM: lib/ObjCopy/ELF/ELFObject.cpp File Reference (original) (raw)

#include "[ELFObject.h](ELFObject%5F8h%5Fsource.html)"
#include "[llvm/ADT/ArrayRef.h](ArrayRef%5F8h%5Fsource.html)"
#include "[llvm/ADT/STLExtras.h](STLExtras%5F8h%5Fsource.html)"
#include "[llvm/ADT/StringRef.h](StringRef%5F8h%5Fsource.html)"
#include "[llvm/ADT/Twine.h](Twine%5F8h%5Fsource.html)"
#include "[llvm/ADT/iterator_range.h](iterator%5F%5Frange%5F8h%5Fsource.html)"
#include "[llvm/BinaryFormat/ELF.h](BinaryFormat%5F2ELF%5F8h%5Fsource.html)"
#include "[llvm/MC/MCELFExtras.h](MCELFExtras%5F8h%5Fsource.html)"
#include "[llvm/MC/MCTargetOptions.h](MCTargetOptions%5F8h%5Fsource.html)"
#include "[llvm/Support/Compression.h](Compression%5F8h%5Fsource.html)"
#include "[llvm/Support/Endian.h](Endian%5F8h%5Fsource.html)"
#include "[llvm/Support/ErrorHandling.h](llvm%5F2Support%5F2ErrorHandling%5F8h%5Fsource.html)"
#include "[llvm/Support/Path.h](Path%5F8h%5Fsource.html)"
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <unordered_set>
#include <utility>
#include <vector>

Go to the source code of this file.

Functions
template<bool Is64>
static SmallVector< char, 0 > encodeCrel (ArrayRef< Relocation > Relocations)
static bool addressOverflows32bit (uint64_t Addr)
template<class T>
static T checkedGetHex (StringRef S)
template<class T, class Iterator>
static Iterator toHexStr (T X, Iterator It, size_t Len)
static Error checkRecord (const IHexRecord &R)
static Error checkChars (StringRef Line)
static uint64_t sectionPhysicalAddr (const SectionBase *Sec)
static bool isValidReservedSectionIndex (uint16_t Index, uint16_t Machine)
template
static void setAddend (Elf_Rel_Impl< ELFT, false > &, uint64_t)
template
static void setAddend (Elf_Rel_Impl< ELFT, true > &Rela, uint64_t Addend)
template<class RelRange, class T>
static void writeRel (const RelRange &Relocations, T *Buf, bool IsMips64EL)
static bool sectionWithinSegment (const SectionBase &Sec, const Segment &Seg)
static bool segmentOverlapsSegment (const Segment &Child, const Segment &Parent)
static bool compareSegmentsByOffset (const Segment *A, const Segment *B)
template
static void getAddend (uint64_t &, const Elf_Rel_Impl< ELFT, false > &)
template
static void getAddend (uint64_t &ToSet, const Elf_Rel_Impl< ELFT, true > &Rela)
template<class T>
static Error initRelocations (RelocationSection *Relocs, T RelRange)
static void orderSegments (std::vector< Segment * > &Segments)
static uint64_t layoutSegments (std::vector< Segment * > &Segments, uint64_t Offset)
template<class Range>
static uint64_t layoutSections (Range Sections, uint64_t Offset)
static uint64_t layoutSectionsForOnlyKeepDebug (Object &Obj, uint64_t Off)
static uint64_t layoutSegmentsForOnlyKeepDebug (std::vector< Segment * > &Segments, uint64_t HdrEnd)
static Error removeUnneededSections (Object &Obj)

addressOverflows32bit()

checkChars()

checkedGetHex()

checkRecord()

compareSegmentsByOffset()

encodeCrel()

getAddend() [1/2]

getAddend() [2/2]

initRelocations()

Definition at line 1658 of file ELFObject.cpp.

References llvm::objcopy:🧝:Relocation::Addend, llvm::objcopy:🧝:RelocationSection::addRelocation(), llvm::createStringError(), getAddend(), llvm::objcopy:🧝:RelocationSection::getObject(), llvm::objcopy:🧝:SymbolTableSection::getSymbolByIndex(), llvm::invalid_argument, llvm::objcopy:🧝:Object::IsMips64EL, llvm::objcopy:🧝:SectionBase::Name, llvm::objcopy:🧝:Relocation::Offset, llvm::objcopy:🧝:Relocation::RelocSymbol, llvm::Error::success(), llvm::objcopy:🧝:Object::SymbolTable, T, llvm::Expected< T >::takeError(), and llvm::objcopy:🧝:Relocation::Type.

isValidReservedSectionIndex()

Definition at line 648 of file ELFObject.cpp.

References llvm::ELF::EM_AMDGPU, llvm::ELF::EM_HEXAGON, llvm::ELF::EM_MIPS, Machine, llvm::ELF::SHN_ABS, llvm::ELF::SHN_AMDGPU_LDS, llvm::ELF::SHN_COMMON, llvm::ELF::SHN_HEXAGON_SCOMMON, llvm::ELF::SHN_HEXAGON_SCOMMON_1, llvm::ELF::SHN_HEXAGON_SCOMMON_2, llvm::ELF::SHN_HEXAGON_SCOMMON_4, llvm::ELF::SHN_HEXAGON_SCOMMON_8, llvm::ELF::SHN_MIPS_ACOMMON, llvm::ELF::SHN_MIPS_SCOMMON, and llvm::ELF::SHN_MIPS_SUNDEFINED.

layoutSections()

layoutSectionsForOnlyKeepDebug()

layoutSegments()

Definition at line 2331 of file ELFObject.cpp.

References llvm::objcopy:🧝:Segment::Align, llvm::alignTo(), assert(), compareSegmentsByOffset(), llvm::objcopy:🧝:Segment::FileSize, llvm::is_sorted(), llvm::objcopy:🧝:Segment::Offset, llvm::Offset, llvm::objcopy:🧝:Segment::OriginalOffset, llvm::objcopy:🧝:Segment::ParentSegment, and llvm::objcopy:🧝:Segment::VAddr.

layoutSegmentsForOnlyKeepDebug()

Definition at line 2450 of file ELFObject.cpp.

References llvm::objcopy:🧝:Segment::FileSize, llvm::objcopy:🧝:Segment::firstSection(), llvm::objcopy:🧝:SectionBase::Offset, llvm::objcopy:🧝:Segment::Offset, llvm::Offset, llvm::objcopy:🧝:Segment::ParentSegment, llvm::ELF::PT_PHDR, llvm::objcopy:🧝:Segment::Sections, llvm::ELF::SHT_NOBITS, Size, llvm::objcopy:🧝:SectionBase::Size, llvm::objcopy:🧝:SectionBase::Type, and llvm::objcopy:🧝:Segment::Type.

orderSegments()

void orderSegments ( std::vector< Segment * > & Segments) static

removeUnneededSections()

sectionPhysicalAddr()

sectionWithinSegment()

Definition at line 1216 of file ELFObject.cpp.

References llvm::objcopy:🧝:SectionBase::Addr, llvm::objcopy:🧝:Segment::FileSize, llvm::objcopy:🧝:SectionBase::Flags, llvm::objcopy:🧝:Segment::MemSize, llvm::objcopy:🧝:Segment::Offset, llvm::objcopy:🧝:SectionBase::OriginalOffset, llvm::ELF::PT_TLS, llvm::ELF::SHF_ALLOC, llvm::ELF::SHF_TLS, llvm::ELF::SHT_NOBITS, llvm::objcopy:🧝:SectionBase::Size, llvm::objcopy:🧝:SectionBase::Type, llvm::objcopy:🧝:Segment::Type, and llvm::objcopy:🧝:Segment::VAddr.

segmentOverlapsSegment()

setAddend() [1/2]

setAddend() [2/2]

toHexStr()

template<class T, class Iterator>

Iterator toHexStr ( T X, Iterator It, size_t Len ) static

writeRel()

template<class RelRange, class T>

void writeRel ( const RelRange & Relocations, T * Buf, bool IsMips64EL ) static