Index: ELF/LinkerScript.cpp =================================================================== --- ELF/LinkerScript.cpp +++ ELF/LinkerScript.cpp @@ -358,6 +358,7 @@ // which will map to whatever the first actual section is. Aether = make("", 0, SHF_ALLOC); Aether->SectionIndex = 1; + Aether->Live = true; auto State = make_unique(Opt); // CurAddressState captures the local AddressState and makes it accessible // deliberately. This is needed as there are some cases where we cannot just Index: ELF/Symbols.cpp =================================================================== --- ELF/Symbols.cpp +++ ELF/Symbols.cpp @@ -48,17 +48,13 @@ if (auto *ISB = dyn_cast_or_null(IS)) IS = ISB->Repl; - // According to the ELF spec reference to a local symbol from outside - // the group are not allowed. Unfortunately .eh_frame breaks that rule - // and must be treated specially. For now we just replace the symbol with - // 0. - if (IS == &InputSection::Discarded) - return 0; - // This is an absolute symbol. if (!IS) return D.Value; + if (!IS->Live) + return 0; + uint64_t Offset = D.Value; // An object in an SHF_MERGE section might be referenced via a Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -270,8 +270,10 @@ Out::ElfHeader = make("", 0, SHF_ALLOC); Out::ElfHeader->Size = sizeof(Elf_Ehdr); + Out::ElfHeader->Live = true; Out::ProgramHeaders = make("", 0, SHF_ALLOC); Out::ProgramHeaders->updateAlignment(Config->Wordsize); + Out::ProgramHeaders->Live = true; if (needsInterpSection()) { InX::Interp = createInterpSection();