diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index dda4242d8be1c..bb9dff38ae029 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -118,9 +118,9 @@ class InputSectionBase : public SectionBase { static bool classof(const SectionBase *s) { return s->kind() != Output; } - // The file which contains this section. Its dynamic type is always - // ObjFile, but in order to avoid ELFT, we use InputFile as - // its static type. + // The file which contains this section. Its dynamic type is usually + // ObjFile, but may be an InputFile of InternalKind (for a synthetic + // section). InputFile *file; // Input sections are part of an output section. Special sections @@ -132,8 +132,9 @@ class InputSectionBase : public SectionBase { // Section index of the relocation section if exists. uint32_t relSecIdx = 0; + // Getter when the dynamic type is ObjFile. template ObjFile *getFile() const { - return cast_or_null>(file); + return cast>(file); } // Used by --optimize-bb-jumps and RISC-V linker relaxation temporarily to