forked from OSchip/llvm-project
[ELF] Inline InputSection::getParent. NFC
Combined with the previous change, lld executable is ~2K smaller and some code paths using InputSection::getParent are more efficient. The fragmented headers lead to a design limitation that OutputSection has to be incomplete, so we cannot use static_cast.
This commit is contained in:
parent
6c814931bc
commit
72bedf46c7
|
@ -323,10 +323,6 @@ InputSection::InputSection(ObjFile<ELFT> &f, const typename ELFT::Shdr &header,
|
|||
StringRef name)
|
||||
: InputSectionBase(f, header, name, InputSectionBase::Regular) {}
|
||||
|
||||
OutputSection *InputSection::getParent() const {
|
||||
return cast_or_null<OutputSection>(parent);
|
||||
}
|
||||
|
||||
// Copy SHT_GROUP section contents. Used only for the -r option.
|
||||
template <class ELFT> void InputSection::copyShtGroup(uint8_t *buf) {
|
||||
// ELFT::Word is the 32-bit integral type in the target endianness.
|
||||
|
|
|
@ -348,7 +348,9 @@ public:
|
|||
// beginning of the output section.
|
||||
template <class ELFT> void writeTo(uint8_t *buf);
|
||||
|
||||
OutputSection *getParent() const;
|
||||
OutputSection *getParent() const {
|
||||
return reinterpret_cast<OutputSection *>(parent);
|
||||
}
|
||||
|
||||
// This variable has two usages. Initially, it represents an index in the
|
||||
// OutputSection's InputSection list, and is used when ordering SHF_LINK_ORDER
|
||||
|
|
Loading…
Reference in New Issue