forked from OSchip/llvm-project
Add comment to InputSectionBase::File.
This patch also moves declarations so that related declarations next to each other. llvm-svn: 315266
This commit is contained in:
parent
339ddd1685
commit
124bedbd50
|
@ -696,10 +696,6 @@ void InputSection::relocateNonAlloc(uint8_t *Buf, ArrayRef<RelTy> Rels) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ELFT> ObjFile<ELFT> *InputSectionBase::getFile() const {
|
|
||||||
return cast_or_null<ObjFile<ELFT>>(File);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class ELFT>
|
template <class ELFT>
|
||||||
void InputSectionBase::relocate(uint8_t *Buf, uint8_t *BufEnd) {
|
void InputSectionBase::relocate(uint8_t *Buf, uint8_t *BufEnd) {
|
||||||
if (Flags & SHF_ALLOC) {
|
if (Flags & SHF_ALLOC) {
|
||||||
|
@ -1031,11 +1027,6 @@ template void InputSection::writeTo<ELF32BE>(uint8_t *);
|
||||||
template void InputSection::writeTo<ELF64LE>(uint8_t *);
|
template void InputSection::writeTo<ELF64LE>(uint8_t *);
|
||||||
template void InputSection::writeTo<ELF64BE>(uint8_t *);
|
template void InputSection::writeTo<ELF64BE>(uint8_t *);
|
||||||
|
|
||||||
template ObjFile<ELF32LE> *InputSectionBase::getFile<ELF32LE>() const;
|
|
||||||
template ObjFile<ELF32BE> *InputSectionBase::getFile<ELF32BE>() const;
|
|
||||||
template ObjFile<ELF64LE> *InputSectionBase::getFile<ELF64LE>() const;
|
|
||||||
template ObjFile<ELF64BE> *InputSectionBase::getFile<ELF64BE>() const;
|
|
||||||
|
|
||||||
template MergeInputSection::MergeInputSection(ObjFile<ELF32LE> *,
|
template MergeInputSection::MergeInputSection(ObjFile<ELF32LE> *,
|
||||||
const ELF32LE::Shdr *, StringRef);
|
const ELF32LE::Shdr *, StringRef);
|
||||||
template MergeInputSection::MergeInputSection(ObjFile<ELF32BE> *,
|
template MergeInputSection::MergeInputSection(ObjFile<ELF32BE> *,
|
||||||
|
|
|
@ -102,16 +102,6 @@ protected:
|
||||||
// This corresponds to a section of an input file.
|
// This corresponds to a section of an input file.
|
||||||
class InputSectionBase : public SectionBase {
|
class InputSectionBase : public SectionBase {
|
||||||
public:
|
public:
|
||||||
static bool classof(const SectionBase *S) { return S->kind() != Output; }
|
|
||||||
|
|
||||||
// The file this section is from.
|
|
||||||
InputFile *File;
|
|
||||||
|
|
||||||
ArrayRef<uint8_t> Data;
|
|
||||||
uint64_t getOffsetInFile() const;
|
|
||||||
|
|
||||||
static InputSectionBase Discarded;
|
|
||||||
|
|
||||||
InputSectionBase()
|
InputSectionBase()
|
||||||
: SectionBase(Regular, "", /*Flags*/ 0, /*Entsize*/ 0, /*Alignment*/ 0,
|
: SectionBase(Regular, "", /*Flags*/ 0, /*Entsize*/ 0, /*Alignment*/ 0,
|
||||||
/*Type*/ 0,
|
/*Type*/ 0,
|
||||||
|
@ -130,6 +120,22 @@ public:
|
||||||
uint32_t Alignment, ArrayRef<uint8_t> Data, StringRef Name,
|
uint32_t Alignment, ArrayRef<uint8_t> Data, StringRef Name,
|
||||||
Kind SectionKind);
|
Kind SectionKind);
|
||||||
|
|
||||||
|
static bool classof(const SectionBase *S) { return S->kind() != Output; }
|
||||||
|
|
||||||
|
// The file which contains this section. It's dynamic type is always
|
||||||
|
// ObjFile<ELFT>, but in order to avoid ELFT, we use InputFile as
|
||||||
|
// its static type.
|
||||||
|
InputFile *File;
|
||||||
|
|
||||||
|
template <class ELFT> ObjFile<ELFT> *getFile() const {
|
||||||
|
return cast_or_null<ObjFile<ELFT>>(File);
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayRef<uint8_t> Data;
|
||||||
|
uint64_t getOffsetInFile() const;
|
||||||
|
|
||||||
|
static InputSectionBase Discarded;
|
||||||
|
|
||||||
// Input sections are part of an output section. Special sections
|
// Input sections are part of an output section. Special sections
|
||||||
// like .eh_frame and merge sections are first combined into a
|
// like .eh_frame and merge sections are first combined into a
|
||||||
// synthetic section that is then added to an output section. In all
|
// synthetic section that is then added to an output section. In all
|
||||||
|
@ -140,12 +146,14 @@ public:
|
||||||
const void *FirstRelocation = nullptr;
|
const void *FirstRelocation = nullptr;
|
||||||
unsigned NumRelocations : 31;
|
unsigned NumRelocations : 31;
|
||||||
unsigned AreRelocsRela : 1;
|
unsigned AreRelocsRela : 1;
|
||||||
|
|
||||||
template <class ELFT> ArrayRef<typename ELFT::Rel> rels() const {
|
template <class ELFT> ArrayRef<typename ELFT::Rel> rels() const {
|
||||||
assert(!AreRelocsRela);
|
assert(!AreRelocsRela);
|
||||||
return llvm::makeArrayRef(
|
return llvm::makeArrayRef(
|
||||||
static_cast<const typename ELFT::Rel *>(FirstRelocation),
|
static_cast<const typename ELFT::Rel *>(FirstRelocation),
|
||||||
NumRelocations);
|
NumRelocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ELFT> ArrayRef<typename ELFT::Rela> relas() const {
|
template <class ELFT> ArrayRef<typename ELFT::Rela> relas() const {
|
||||||
assert(AreRelocsRela);
|
assert(AreRelocsRela);
|
||||||
return llvm::makeArrayRef(
|
return llvm::makeArrayRef(
|
||||||
|
@ -166,8 +174,6 @@ public:
|
||||||
// Returns the size of this section (even if this is a common or BSS.)
|
// Returns the size of this section (even if this is a common or BSS.)
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
template <class ELFT> ObjFile<ELFT> *getFile() const;
|
|
||||||
|
|
||||||
InputSection *getLinkOrderDep() const;
|
InputSection *getLinkOrderDep() const;
|
||||||
|
|
||||||
void maybeUncompress();
|
void maybeUncompress();
|
||||||
|
|
Loading…
Reference in New Issue