/// by the OS loader.
virtual Scope scope() const = 0;
- static inline bool classof(const Atom *a) {
+ static bool classof(const Atom *a) {
return a->definition() == definitionAbsolute;
}
- static inline bool classof(const AbsoluteAtom *) { return true; }
+
+ static bool classof(const AbsoluteAtom *) { return true; }
protected:
AbsoluteAtom() : Atom(definitionAbsolute) {}
///
class ArchiveLibraryFile : public File {
public:
- static inline bool classof(const File *f) {
+ static bool classof(const File *f) {
return f->kind() == kindArchiveLibrary;
}
/// symbol.
Definition definition() const { return _definition; }
- static inline bool classof(const Atom *a) { return true; }
+ static bool classof(const Atom *a) { return true; }
protected:
/// Atom is an abstract base class. Only subclasses can access constructor.
/// \brief Returns an iterator to the end of this Atom's References.
virtual reference_iterator end() const = 0;
- static inline bool classof(const Atom *a) {
+ static bool classof(const Atom *a) {
return a->definition() == definitionRegular;
}
int getSize() const { return _size; }
- static inline bool classof(const Node *a) {
+ static bool classof(const Node *a) {
return a->kind() == Kind::GroupEnd;
}
explicit FileNode(std::unique_ptr<File> f)
: Node(Node::Kind::File), _file(std::move(f)), _asNeeded(false) {}
- static inline bool classof(const Node *a) {
+ static bool classof(const Node *a) {
return a->kind() == Node::Kind::File;
}
virtual uint64_t size() const = 0;
- static inline bool classof(const Atom *a) {
+ static bool classof(const Atom *a) {
return a->definition() == definitionSharedLibrary;
}
+
static inline bool classof(const SharedLibraryAtom *) { return true; }
protected:
public:
virtual ~SharedLibraryFile() {}
- static inline bool classof(const File *f) {
+ static bool classof(const File *f) {
return f->kind() == kindSharedLibrary;
}
virtual CanBeNull canBeNull() const = 0;
- static inline bool classof(const Atom *a) {
+ static bool classof(const Atom *a) {
return a->definition() == definitionUndefined;
}
- static inline bool classof(const UndefinedAtom *) { return true; }
+
+ static bool classof(const UndefinedAtom *) { return true; }
/// Returns an undefined atom if this undefined symbol has a synonym. This is
/// mainly used in COFF. In COFF, an unresolved external symbol can have up to
raw_ostream &);
/// \brief Casting support
- static inline bool classof(const LinkingContext *info) { return true; }
+ static bool classof(const LinkingContext *info) { return true; }
Writer &writer() const override;
bool validateImpl(raw_ostream &diagnostics) override;
void assignFileOffsetsForMiscSections();
- /// Inline functions
- inline range<AbsoluteAtomIterT> absoluteAtoms() { return _absoluteAtoms; }
+ range<AbsoluteAtomIterT> absoluteAtoms() { return _absoluteAtoms; }
- inline void addSection(Chunk<ELFT> *c) {
- _sections.push_back(c);
- }
+ void addSection(Chunk<ELFT> *c) { _sections.push_back(c); }
- inline void finalize() {
+ void finalize() {
ScopedTask task(getDefaultDomain(), "Finalize layout");
for (auto &si : _sections)
si->finalize();
}
- inline void doPreFlight() {
+ void doPreFlight() {
for (auto &si : _sections)
si->doPreFlight();
}
- inline const AtomLayout *findAtomLayoutByName(StringRef name) const override {
+ const AtomLayout *findAtomLayoutByName(StringRef name) const override {
for (auto sec : _sections)
if (auto section = dyn_cast<Section<ELFT>>(sec))
if (auto *al = section->findAtomLayoutByName(name))
return nullptr;
}
- inline void setHeader(ELFHeader<ELFT> *elfHeader) { _elfHeader = elfHeader; }
+ void setHeader(ELFHeader<ELFT> *elfHeader) { _elfHeader = elfHeader; }
- inline void setProgramHeader(ProgramHeader<ELFT> *p) {
+ void setProgramHeader(ProgramHeader<ELFT> *p) {
_programHeader = p;
}
- inline range<OutputSectionIter> outputSections() { return _outputSections; }
+ range<OutputSectionIter> outputSections() { return _outputSections; }
- inline range<ChunkIter> sections() { return _sections; }
+ range<ChunkIter> sections() { return _sections; }
- inline range<SegmentIter> segments() { return _segments; }
+ range<SegmentIter> segments() { return _segments; }
- inline ELFHeader<ELFT> *getHeader() { return _elfHeader; }
+ ELFHeader<ELFT> *getHeader() { return _elfHeader; }
bool hasDynamicRelocationTable() const { return !!_dynamicRelocationTable; }
void e_shstrndx(uint16_t shstrndx) { _eh.e_shstrndx = shstrndx; }
uint64_t fileSize() const { return sizeof(Elf_Ehdr); }
- static inline bool classof(const Chunk<ELFT> *c) {
+ static bool classof(const Chunk<ELFT> *c) {
return c->Kind() == Chunk<ELFT>::Kind::ELFHeader;
}
- inline int getContentType() const { return Chunk<ELFT>::ContentType::Header; }
+ int getContentType() const { return Chunk<ELFT>::ContentType::Header; }
void write(ELFWriter *writer, TargetLayout<ELFT> &layout,
llvm::FileOutputBuffer &buffer);
uint64_t fileSize() const { return sizeof(Elf_Phdr) * _ph.size(); }
- static inline bool classof(const Chunk<ELFT> *c) {
+ static bool classof(const Chunk<ELFT> *c) {
return c->Kind() == Chunk<ELFT>::Kind::ProgramHeader;
}
return _ph.size();
}
- inline int getContentType() const { return Chunk<ELFT>::ContentType::Header; }
+ int getContentType() const { return Chunk<ELFT>::ContentType::Header; }
private:
Elf_Phdr *allocateProgramHeader(bool &allocatedNew) {
void updateSection(Section<ELFT> *section);
- static inline bool classof(const Chunk<ELFT> *c) {
+ static bool classof(const Chunk<ELFT> *c) {
return c->getChunkKind() == Chunk<ELFT>::Kind::SectionHeader;
}
uint64_t fileSize() const { return sizeof(Elf_Shdr) * _sectionInfo.size(); }
- inline uint64_t entsize() {
- return sizeof(Elf_Shdr);
- }
+ uint64_t entsize() { return sizeof(Elf_Shdr); }
- inline int getContentType() const { return Chunk<ELFT>::ContentType::Header; }
+ int getContentType() const { return Chunk<ELFT>::ContentType::Header; }
- inline uint64_t numHeaders() {
- return _sectionInfo.size();
- }
+ uint64_t numHeaders() { return _sectionInfo.size(); }
private:
StringTable<ELFT> *_stringSection;
}
/// \brief Return the raw flags, we need this to sort segments
- inline int64_t atomflags() const {
- return _contentPermissions;
- }
+ int64_t atomflags() const { return _contentPermissions; }
/// Atom Iterators
typedef typename std::vector<lld::AtomLayout *>::iterator atom_iter;
void appendSection(Chunk<ELFT> *c);
// Set the OutputSection is associated with a segment
- inline void setHasSegment() { _hasSegment = true; }
+ void setHasSegment() { _hasSegment = true; }
/// Sets the ordinal
- inline void setOrdinal(uint64_t ordinal) {
- _ordinal = ordinal;
- }
+ void setOrdinal(uint64_t ordinal) { _ordinal = ordinal; }
/// Sets the Memory size
- inline void setMemSize(uint64_t memsz) {
- _memSize = memsz;
- }
+ void setMemSize(uint64_t memsz) { _memSize = memsz; }
/// Sets the size fo the output Section.
- inline void setSize(uint64_t fsiz) {
- _size = fsiz;
- }
+ void setSize(uint64_t fsiz) { _size = fsiz; }
// The offset of the first section contained in the output section is
// contained here.
- inline void setFileOffset(uint64_t foffset) {
- _fileOffset = foffset;
- }
+ void setFileOffset(uint64_t foffset) { _fileOffset = foffset; }
// Sets the starting address of the section
- inline void setAddr(uint64_t addr) {
- _virtualAddr = addr;
- }
+ void setAddr(uint64_t addr) { _virtualAddr = addr; }
// Is the section loadable?
- inline bool isLoadableSection() const { return _isLoadableSection; }
+ bool isLoadableSection() const { return _isLoadableSection; }
// Set section Loadable
- inline void setLoadableSection(bool isLoadable) {
+ void setLoadableSection(bool isLoadable) {
_isLoadableSection = isLoadable;
}
void setType(int16_t type) { _type = type; }
- inline range<ChunkIter> sections() { return _sections; }
+ range<ChunkIter> sections() { return _sections; }
// The below functions returns the properties of the OutputSection.
- inline bool hasSegment() const { return _hasSegment; }
+ bool hasSegment() const { return _hasSegment; }
- inline StringRef name() const { return _name; }
+ StringRef name() const { return _name; }
- inline int64_t shinfo() const { return _shInfo; }
+ int64_t shinfo() const { return _shInfo; }
- inline uint64_t alignment() const { return _alignment; }
+ uint64_t alignment() const { return _alignment; }
- inline int64_t link() const { return _link; }
+ int64_t link() const { return _link; }
- inline int64_t type() const { return _type; }
+ int64_t type() const { return _type; }
- inline uint64_t virtualAddr() const { return _virtualAddr; }
+ uint64_t virtualAddr() const { return _virtualAddr; }
- inline int64_t ordinal() const { return _ordinal; }
+ int64_t ordinal() const { return _ordinal; }
- inline int64_t kind() const { return _kind; }
+ int64_t kind() const { return _kind; }
- inline uint64_t fileSize() const { return _size; }
+ uint64_t fileSize() const { return _size; }
- inline int64_t entsize() const { return _entSize; }
+ int64_t entsize() const { return _entSize; }
- inline uint64_t fileOffset() const { return _fileOffset; }
+ uint64_t fileOffset() const { return _fileOffset; }
- inline int64_t flags() const { return _flags; }
+ int64_t flags() const { return _flags; }
- inline uint64_t memSize() { return _memSize; }
+ uint64_t memSize() { return _memSize; }
private:
StringRef _name;
virtual void write(ELFWriter *writer, TargetLayout<ELFT> &layout,
llvm::FileOutputBuffer &buffer);
- inline void setNumEntries(int64_t numEntries) {
- _stringMap.resize(numEntries);
- }
+ void setNumEntries(int64_t numEntries) { _stringMap.resize(numEntries); }
private:
std::vector<StringRef> _strings;
// Set the segment slice start and end iterators. This is used to walk through
// the sections that are part of the Segment slice
- inline void setSections(range<SectionIter> sections) {
- _sections = sections;
- }
+ void setSections(range<SectionIter> sections) { _sections = sections; }
// Return the fileOffset of the slice
- inline uint64_t fileOffset() const { return _offset; }
+ uint64_t fileOffset() const { return _offset; }
void setFileOffset(uint64_t offset) { _offset = offset; }
// Return the size of the slice
- inline uint64_t fileSize() const { return _fsize; }
+ uint64_t fileSize() const { return _fsize; }
void setFileSize(uint64_t filesz) { _fsize = filesz; }
// Return the start of the slice
- inline int32_t startSection() const { return _startSection; }
+ int32_t startSection() const { return _startSection; }
// Return the start address of the slice
- inline uint64_t virtualAddr() const { return _addr; }
+ uint64_t virtualAddr() const { return _addr; }
// Return the memory size of the slice
- inline uint64_t memSize() const { return _memSize; }
+ uint64_t memSize() const { return _memSize; }
// Return the alignment of the slice
- inline uint64_t alignment() const { return _alignment; }
+ uint64_t alignment() const { return _alignment; }
- inline void setMemSize(uint64_t memsz) { _memSize = memsz; }
+ void setMemSize(uint64_t memsz) { _memSize = memsz; }
- inline void setVirtualAddr(uint64_t addr) { _addr = addr; }
+ void setVirtualAddr(uint64_t addr) { _addr = addr; }
- inline void setAlign(uint64_t align) { _alignment = align; }
+ void setAlign(uint64_t align) { _alignment = align; }
static bool compare_slices(SegmentSlice<ELFT> *a, SegmentSlice<ELFT> *b) {
return a->startSection() < b->startSection();
}
- inline range<SectionIter> sections() {
- return _sections;
- }
+ range<SectionIter> sections() { return _sections; }
private:
range<SectionIter> _sections;
}
/// Finalize the segment before assigning File Offsets / Virtual addresses
- inline void doPreFlight() {}
+ void doPreFlight() {}
/// Finalize the segment, before we want to write the segment header
/// information
- inline void finalize() {
+ void finalize() {
// We want to finalize the segment values for now only for non loadable
// segments, since those values are not set in the Layout
if (_segmentType == llvm::ELF::PT_LOAD)
}
// For LLVM RTTI
- static inline bool classof(const Chunk<ELFT> *c) {
+ static bool classof(const Chunk<ELFT> *c) {
return c->kind() == Chunk<ELFT>::Kind::ELFSegment;
}
// Getters
- inline int32_t sectionCount() const {
- return _sections.size();
- }
+ int32_t sectionCount() const { return _sections.size(); }
/// \brief, this function returns the type of segment (PT_*)
- inline Layout::SegmentType segmentType() { return _segmentType; }
+ Layout::SegmentType segmentType() { return _segmentType; }
/// \brief return the segment type depending on the content,
/// If the content corresponds to Code, this will return Segment::Code
}
}
- inline int pageSize() const { return this->_context.getPageSize(); }
+ int pageSize() const { return this->_context.getPageSize(); }
- inline int rawflags() const { return _atomflags; }
+ int rawflags() const { return _atomflags; }
- inline int64_t atomflags() const {
+ int64_t atomflags() const {
switch (_atomflags) {
case DefinedAtom::permUnknown:
}
}
- inline int64_t numSlices() const { return _segmentSlices.size(); }
+ int64_t numSlices() const { return _segmentSlices.size(); }
- inline range<SliceIter> slices() { return _segmentSlices; }
+ range<SliceIter> slices() { return _segmentSlices; }
Chunk<ELFT> *firstSection() { return _sections[0]; }
/// Finalize the segment, before we want to write the segment header
/// information
- inline void finalize() {
+ void finalize() {
// If the segment is of type Program Header, then the values fileOffset
// and the fileSize need to be picked up from the last section, the first
// section points to the ELF header and the second chunk points to the