Index: lld/trunk/ELF/InputFiles.h =================================================================== --- lld/trunk/ELF/InputFiles.h +++ lld/trunk/ELF/InputFiles.h @@ -162,10 +162,10 @@ // If no information is available, returns "". std::string getLineInfo(InputSectionBase *S, uintX_t Offset); - // Get MIPS GP0 value defined by this file. This value represents the gp value + // MIPS GP0 value defined by this file. This value represents the gp value // used to create the relocatable object and required to support // R_MIPS_GPREL16 / R_MIPS_GPREL32 relocations. - uint32_t getMipsGp0() const; + uint32_t MipsGp0 = 0; // The number is the offset in the string table. It will be used as the // st_name of the symbol. @@ -194,10 +194,6 @@ // List of all symbols referenced or defined by this file. std::vector SymbolBodies; - // MIPS .reginfo section defined by this file. - std::unique_ptr> MipsReginfo; - // MIPS .MIPS.options section defined by this file. - std::unique_ptr> MipsOptions; // MIPS .MIPS.abiflags section defined by this file. std::unique_ptr> MipsAbiFlags; Index: lld/trunk/ELF/InputFiles.cpp =================================================================== --- lld/trunk/ELF/InputFiles.cpp +++ lld/trunk/ELF/InputFiles.cpp @@ -160,14 +160,6 @@ return makeArrayRef(this->SymbolBodies).slice(1); } -template uint32_t elf::ObjectFile::getMipsGp0() const { - if (ELFT::Is64Bits && MipsOptions && MipsOptions->Reginfo) - return MipsOptions->Reginfo->ri_gp_value; - if (!ELFT::Is64Bits && MipsReginfo && MipsReginfo->Reginfo) - return MipsReginfo->Reginfo->ri_gp_value; - return 0; -} - template void elf::ObjectFile::parse(DenseSet &ComdatGroups) { // Read section and symbol tables. @@ -348,18 +340,6 @@ // FIXME: ARM meta-data section. At present attributes are ignored, // they can be used to reason about object compatibility. return &InputSection::Discarded; - case SHT_MIPS_REGINFO: - if (MipsReginfo) - fatal(getFilename(this) + - ": multiple SHT_MIPS_REGINFO sections are not allowed"); - MipsReginfo.reset(new MipsReginfoInputSection(this, &Sec, Name)); - return MipsReginfo.get(); - case SHT_MIPS_OPTIONS: - if (MipsOptions) - fatal(getFilename(this) + - ": multiple SHT_MIPS_OPTIONS sections are not allowed"); - MipsOptions.reset(new MipsOptionsInputSection(this, &Sec, Name)); - return MipsOptions.get(); case SHT_MIPS_ABIFLAGS: if (MipsAbiFlags) fatal(getFilename(this) + Index: lld/trunk/ELF/InputSection.h =================================================================== --- lld/trunk/ELF/InputSection.h +++ lld/trunk/ELF/InputSection.h @@ -39,7 +39,7 @@ // section class InputSectionData { public: - enum Kind { Regular, EHFrame, Merge, MipsReginfo, MipsOptions, MipsAbiFlags }; + enum Kind { Regular, EHFrame, Merge, MipsAbiFlags }; // The garbage collector sets sections' Live bits. // If GC is disabled, all sections are considered live by default. @@ -288,36 +288,6 @@ template InputSection InputSection::Discarded; -// MIPS .reginfo section provides information on the registers used by the code -// in the object file. Linker should collect this information and write a single -// .reginfo section in the output file. The output section contains a union of -// used registers masks taken from input .reginfo sections and final value -// of the `_gp` symbol. For details: Chapter 4 / "Register Information" at -// ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf -template -class MipsReginfoInputSection : public InputSectionBase { - typedef typename ELFT::Shdr Elf_Shdr; - -public: - MipsReginfoInputSection(ObjectFile *F, const Elf_Shdr *Hdr, - StringRef Name); - static bool classof(const InputSectionData *S); - - const llvm::object::Elf_Mips_RegInfo *Reginfo = nullptr; -}; - -template -class MipsOptionsInputSection : public InputSectionBase { - typedef typename ELFT::Shdr Elf_Shdr; - -public: - MipsOptionsInputSection(ObjectFile *F, const Elf_Shdr *Hdr, - StringRef Name); - static bool classof(const InputSectionData *S); - - const llvm::object::Elf_Mips_RegInfo *Reginfo = nullptr; -}; - template class MipsAbiFlagsInputSection : public InputSectionBase { typedef typename ELFT::Shdr Elf_Shdr; Index: lld/trunk/ELF/InputSection.cpp =================================================================== --- lld/trunk/ELF/InputSection.cpp +++ lld/trunk/ELF/InputSection.cpp @@ -103,10 +103,8 @@ return Offset; case Merge: return cast>(this)->getOffset(Offset); - case MipsReginfo: - case MipsOptions: case MipsAbiFlags: - // MIPS .reginfo, .MIPS.options, and .MIPS.abiflags sections are consumed + // .MIPS.abiflags sections is consumed // by the linker, and the linker produces a single output section. It is // possible that input files contain section symbol points to the // corresponding input section. Redirect it to the produced output section. @@ -801,59 +799,6 @@ } template -MipsReginfoInputSection::MipsReginfoInputSection(elf::ObjectFile *F, - const Elf_Shdr *Hdr, - StringRef Name) - : InputSectionBase(F, Hdr, Name, - InputSectionBase::MipsReginfo) { - ArrayRef Data = this->Data; - // Initialize this->Reginfo. - if (Data.size() != sizeof(Elf_Mips_RegInfo)) { - error(getName(this) + ": invalid size of .reginfo section"); - return; - } - Reginfo = reinterpret_cast *>(Data.data()); - if (Config->Relocatable && Reginfo->ri_gp_value) - error(getName(this) + ": unsupported non-zero ri_gp_value"); -} - -template -bool MipsReginfoInputSection::classof(const InputSectionData *S) { - return S->kind() == InputSectionBase::MipsReginfo; -} - -template -MipsOptionsInputSection::MipsOptionsInputSection(elf::ObjectFile *F, - const Elf_Shdr *Hdr, - StringRef Name) - : InputSectionBase(F, Hdr, Name, - InputSectionBase::MipsOptions) { - // Find ODK_REGINFO option in the section's content. - ArrayRef D = this->Data; - while (!D.empty()) { - if (D.size() < sizeof(Elf_Mips_Options)) { - error(getName(this) + ": invalid size of .MIPS.options section"); - break; - } - auto *O = reinterpret_cast *>(D.data()); - if (O->kind == ODK_REGINFO) { - Reginfo = &O->getRegInfo(); - if (Config->Relocatable && Reginfo->ri_gp_value) - error(getName(this) + ": unsupported non-zero ri_gp_value"); - break; - } - if (!O->size) - fatal(getName(this) + ": zero option descriptor size"); - D = D.slice(O->size); - } -} - -template -bool MipsOptionsInputSection::classof(const InputSectionData *S) { - return S->kind() == InputSectionBase::MipsOptions; -} - -template MipsAbiFlagsInputSection::MipsAbiFlagsInputSection( elf::ObjectFile *F, const Elf_Shdr *Hdr, StringRef Name) : InputSectionBase(F, Hdr, Name, @@ -892,16 +837,6 @@ template class elf::MergeInputSection; template class elf::MergeInputSection; -template class elf::MipsReginfoInputSection; -template class elf::MipsReginfoInputSection; -template class elf::MipsReginfoInputSection; -template class elf::MipsReginfoInputSection; - -template class elf::MipsOptionsInputSection; -template class elf::MipsOptionsInputSection; -template class elf::MipsOptionsInputSection; -template class elf::MipsOptionsInputSection; - template class elf::MipsAbiFlagsInputSection; template class elf::MipsAbiFlagsInputSection; template class elf::MipsAbiFlagsInputSection; Index: lld/trunk/ELF/OutputSections.h =================================================================== --- lld/trunk/ELF/OutputSections.h +++ lld/trunk/ELF/OutputSections.h @@ -31,7 +31,6 @@ template class InputSection; template class InputSectionBase; template class MergeInputSection; -template class MipsReginfoInputSection; template class OutputSection; template class ObjectFile; template class SharedFile; @@ -57,8 +56,6 @@ GotPlt, HashTable, Merge, - MipsReginfo, - MipsOptions, MipsAbiFlags, Plt, Regular, @@ -634,43 +631,6 @@ }; template -class MipsReginfoOutputSection final : public OutputSectionBase { - typedef llvm::object::Elf_Mips_RegInfo Elf_Mips_RegInfo; - typedef OutputSectionBase Base; - -public: - MipsReginfoOutputSection(); - void writeTo(uint8_t *Buf) override; - void addSection(InputSectionBase *S) override; - typename Base::Kind getKind() const override { return Base::MipsReginfo; } - static bool classof(const Base *B) { - return B->getKind() == Base::MipsReginfo; - } - -private: - uint32_t GprMask = 0; -}; - -template -class MipsOptionsOutputSection final : public OutputSectionBase { - typedef llvm::object::Elf_Mips_Options Elf_Mips_Options; - typedef llvm::object::Elf_Mips_RegInfo Elf_Mips_RegInfo; - typedef OutputSectionBase Base; - -public: - MipsOptionsOutputSection(); - void writeTo(uint8_t *Buf) override; - void addSection(InputSectionBase *S) override; - typename Base::Kind getKind() const override { return Base::MipsOptions; } - static bool classof(const Base *B) { - return B->getKind() == Base::MipsOptions; - } - -private: - uint32_t GprMask = 0; -}; - -template class MipsAbiFlagsOutputSection final : public OutputSectionBase { typedef llvm::object::Elf_Mips_ABIFlags Elf_Mips_ABIFlags; typedef OutputSectionBase Base; Index: lld/trunk/ELF/OutputSections.cpp =================================================================== --- lld/trunk/ELF/OutputSections.cpp +++ lld/trunk/ELF/OutputSections.cpp @@ -913,6 +913,11 @@ this->Entsize = sizeof(Elf_Rela); else if (Type == SHT_REL) this->Entsize = sizeof(Elf_Rel); + else if (Type == SHT_MIPS_REGINFO) + this->Entsize = sizeof(Elf_Mips_RegInfo); + else if (Type == SHT_MIPS_OPTIONS) + this->Entsize = + sizeof(Elf_Mips_Options) + sizeof(Elf_Mips_RegInfo); } template void OutputSection::finalize() { @@ -1725,64 +1730,6 @@ } template -MipsReginfoOutputSection::MipsReginfoOutputSection() - : OutputSectionBase(".reginfo", SHT_MIPS_REGINFO, SHF_ALLOC) { - this->Addralign = 4; - this->Entsize = sizeof(Elf_Mips_RegInfo); - this->Size = sizeof(Elf_Mips_RegInfo); -} - -template -void MipsReginfoOutputSection::writeTo(uint8_t *Buf) { - auto *R = reinterpret_cast(Buf); - if (Config->Relocatable) - R->ri_gp_value = 0; - else - R->ri_gp_value = Out::Got->Addr + MipsGPOffset; - R->ri_gprmask = GprMask; -} - -template -void MipsReginfoOutputSection::addSection(InputSectionBase *C) { - // Copy input object file's .reginfo gprmask to output. - auto *S = cast>(C); - GprMask |= S->Reginfo->ri_gprmask; - S->OutSec = this; -} - -template -MipsOptionsOutputSection::MipsOptionsOutputSection() - : OutputSectionBase(".MIPS.options", SHT_MIPS_OPTIONS, - SHF_ALLOC | SHF_MIPS_NOSTRIP) { - this->Addralign = 8; - this->Entsize = 1; - this->Size = sizeof(Elf_Mips_Options) + sizeof(Elf_Mips_RegInfo); -} - -template -void MipsOptionsOutputSection::writeTo(uint8_t *Buf) { - auto *Opt = reinterpret_cast(Buf); - Opt->kind = ODK_REGINFO; - Opt->size = this->Size; - Opt->section = 0; - Opt->info = 0; - auto *Reg = reinterpret_cast(Buf + sizeof(*Opt)); - if (Config->Relocatable) - Reg->ri_gp_value = 0; - else - Reg->ri_gp_value = Out::Got->Addr + MipsGPOffset; - Reg->ri_gprmask = GprMask; -} - -template -void MipsOptionsOutputSection::addSection(InputSectionBase *C) { - auto *S = cast>(C); - if (S->Reginfo) - GprMask |= S->Reginfo->ri_gprmask; - S->OutSec = this; -} - -template MipsAbiFlagsOutputSection::MipsAbiFlagsOutputSection() : OutputSectionBase(".MIPS.abiflags", SHT_MIPS_ABIFLAGS, SHF_ALLOC) { this->Addralign = 8; @@ -1876,12 +1823,6 @@ case InputSectionBase::Merge: Sec = make>(Key.Name, Type, Flags, Key.Alignment); break; - case InputSectionBase::MipsReginfo: - Sec = make>(); - break; - case InputSectionBase::MipsOptions: - Sec = make>(); - break; case InputSectionBase::MipsAbiFlags: Sec = make>(); break; @@ -1978,16 +1919,6 @@ template class EhOutputSection; template class EhOutputSection; -template class MipsReginfoOutputSection; -template class MipsReginfoOutputSection; -template class MipsReginfoOutputSection; -template class MipsReginfoOutputSection; - -template class MipsOptionsOutputSection; -template class MipsOptionsOutputSection; -template class MipsOptionsOutputSection; -template class MipsOptionsOutputSection; - template class MipsAbiFlagsOutputSection; template class MipsAbiFlagsOutputSection; template class MipsAbiFlagsOutputSection; Index: lld/trunk/ELF/Relocations.cpp =================================================================== --- lld/trunk/ELF/Relocations.cpp +++ lld/trunk/ELF/Relocations.cpp @@ -518,7 +518,7 @@ if (Expr == R_GOTREL) { Addend -= MipsGPOffset; if (Body.isLocal()) - Addend += File.getMipsGp0(); + Addend += File.MipsGp0; } } if (Config->Pic && Config->EMachine == EM_PPC64 && Type == R_PPC64_TOC) Index: lld/trunk/ELF/SyntheticSections.h =================================================================== --- lld/trunk/ELF/SyntheticSections.h +++ lld/trunk/ELF/SyntheticSections.h @@ -15,6 +15,37 @@ namespace lld { namespace elf { +// .MIPS.options section. +template +class MipsOptionsSection final : public InputSection { + typedef llvm::object::Elf_Mips_Options Elf_Mips_Options; + typedef llvm::object::Elf_Mips_RegInfo Elf_Mips_RegInfo; + +public: + MipsOptionsSection(); + void finalize(); + +private: + std::vector Buf; + + Elf_Mips_Options *getOptions() { + return reinterpret_cast(Buf.data()); + } +}; + +// MIPS .reginfo section. +template +class MipsReginfoSection final : public InputSection { + typedef llvm::object::Elf_Mips_RegInfo Elf_Mips_RegInfo; + +public: + MipsReginfoSection(); + void finalize(); + +private: + Elf_Mips_RegInfo Reginfo = {}; +}; + // .note.gnu.build-id section. template class BuildIdSection : public InputSection { public: @@ -74,11 +105,15 @@ static BuildIdSection *BuildId; static InputSection *Common; static InputSection *Interp; + static MipsOptionsSection *MipsOptions; + static MipsReginfoSection *MipsReginfo; }; template BuildIdSection *In::BuildId; template InputSection *In::Common; template InputSection *In::Interp; +template MipsOptionsSection *In::MipsOptions; +template MipsReginfoSection *In::MipsReginfo; } // namespace elf } // namespace lld Index: lld/trunk/ELF/SyntheticSections.cpp =================================================================== --- lld/trunk/ELF/SyntheticSections.cpp +++ lld/trunk/ELF/SyntheticSections.cpp @@ -22,6 +22,7 @@ #include "OutputSections.h" #include "Strings.h" #include "SymbolTable.h" +#include "Target.h" #include "lld/Core/Parallel.h" #include "llvm/Support/Endian.h" @@ -76,6 +77,89 @@ return Ret; } +// Iterate over sections of the specified type. For each section call +// provided function. After that "kill" the section by turning off +// "Live" flag, so that they won't be included in the final output. +template +static void iterateSectionContents( + uint32_t Type, + std::function *, ArrayRef)> F) { + for (InputSectionBase *Sec : Symtab::X->Sections) { + if (Sec && Sec->Live && Sec->Type == Type) { + Sec->Live = false; + F(Sec->getFile(), Sec->Data); + } + } +} + +// .MIPS.options section. +template +MipsOptionsSection::MipsOptionsSection() + : InputSection(SHF_ALLOC, SHT_MIPS_OPTIONS, 8, ArrayRef(), + ".MIPS.options") { + Buf.resize(sizeof(Elf_Mips_Options) + sizeof(Elf_Mips_RegInfo)); + getOptions()->kind = ODK_REGINFO; + getOptions()->size = Buf.size(); + auto Func = [this](ObjectFile *F, ArrayRef D) { + while (!D.empty()) { + if (D.size() < sizeof(Elf_Mips_Options)) { + error(getFilename(F) + ": invalid size of .MIPS.options section"); + break; + } + auto *O = reinterpret_cast(D.data()); + if (O->kind == ODK_REGINFO) { + if (Config->Relocatable && O->getRegInfo().ri_gp_value) + error(getFilename(F) + ": unsupported non-zero ri_gp_value"); + getOptions()->getRegInfo().ri_gprmask |= O->getRegInfo().ri_gprmask; + F->MipsGp0 = O->getRegInfo().ri_gp_value; + break; + } + if (!O->size) + fatal(getFilename(F) + ": zero option descriptor size"); + D = D.slice(O->size); + } + }; + iterateSectionContents(SHT_MIPS_OPTIONS, Func); + + this->Data = ArrayRef(Buf); + // Section should be alive for N64 ABI only. + this->Live = ELFT::Is64Bits; +} + +template void MipsOptionsSection::finalize() { + if (!Config->Relocatable) + getOptions()->getRegInfo().ri_gp_value = + Out::Got->Addr + MipsGPOffset; +} + +// MIPS .reginfo section. +template +MipsReginfoSection::MipsReginfoSection() + : InputSection(SHF_ALLOC, SHT_MIPS_REGINFO, 4, ArrayRef(), + ".reginfo") { + auto Func = [this](ObjectFile *F, ArrayRef D) { + if (D.size() != sizeof(Elf_Mips_RegInfo)) { + error(getFilename(F) + ": invalid size of .reginfo section"); + return; + } + auto *R = reinterpret_cast(D.data()); + if (Config->Relocatable && R->ri_gp_value) + error(getFilename(F) + ": unsupported non-zero ri_gp_value"); + Reginfo.ri_gprmask |= R->ri_gprmask; + F->MipsGp0 = R->ri_gp_value; + }; + iterateSectionContents(SHT_MIPS_REGINFO, Func); + + this->Data = ArrayRef((const uint8_t *)&Reginfo, sizeof(Reginfo)); + // Section should be alive for O32 and N32 ABIs only. + this->Live = !ELFT::Is64Bits; +} + +template void MipsReginfoSection::finalize() { + if (!Config->Relocatable) + Reginfo.ri_gp_value = Out::Got->Addr + MipsGPOffset; +} + static ArrayRef createInterp() { // StringSaver guarantees that the returned string ends with '\0'. StringRef S = Saver.save(Config->DynamicLinker); @@ -198,6 +282,16 @@ template InputSection *elf::createInterpSection(); template InputSection *elf::createInterpSection(); +template class elf::MipsOptionsSection; +template class elf::MipsOptionsSection; +template class elf::MipsOptionsSection; +template class elf::MipsOptionsSection; + +template class elf::MipsReginfoSection; +template class elf::MipsReginfoSection; +template class elf::MipsReginfoSection; +template class elf::MipsReginfoSection; + template class elf::BuildIdSection; template class elf::BuildIdSection; template class elf::BuildIdSection; Index: lld/trunk/ELF/Writer.cpp =================================================================== --- lld/trunk/ELF/Writer.cpp +++ lld/trunk/ELF/Writer.cpp @@ -291,6 +291,21 @@ In::Common = Common; Symtab::X->Sections.push_back(Common); } + + if (Config->EMachine == EM_MIPS) { + // .MIPS.options + auto *OptSec = make>(); + if (OptSec->Live) { + In::MipsOptions = OptSec; + Symtab::X->Sections.push_back(OptSec); + } + // MIPS .reginfo + auto *RegSec = make>(); + if (RegSec->Live) { + In::MipsReginfo = RegSec; + Symtab::X->Sections.push_back(RegSec); + } + } } template @@ -1441,6 +1456,13 @@ template void Writer::writeSections() { uint8_t *Buf = Buffer->getBufferStart(); + // Finalize MIPS .reginfo and .MIPS.options sections + // because they contain offsets to .got and _gp. + if (In::MipsReginfo) + In::MipsReginfo->finalize(); + if (In::MipsOptions) + In::MipsOptions->finalize(); + // PPC64 needs to process relocations in the .opd section // before processing relocations in code-containing sections. Out::Opd = findSection(".opd"); Index: lld/trunk/test/ELF/basic-mips.s =================================================================== --- lld/trunk/test/ELF/basic-mips.s +++ lld/trunk/test/ELF/basic-mips.s @@ -57,23 +57,23 @@ # CHECK-NEXT: } # CHECK-NEXT: Section { # CHECK-NEXT: Index: 1 -# CHECK-NEXT: Name: .reginfo -# CHECK-NEXT: Type: SHT_MIPS_REGINFO (0x70000006) +# CHECK-NEXT: Name: .MIPS.abiflags +# CHECK-NEXT: Type: SHT_MIPS_ABIFLAGS (0x7000002A) # CHECK-NEXT: Flags [ (0x2) # CHECK-NEXT: SHF_ALLOC (0x2) # CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x100F4 -# CHECK-NEXT: Offset: 0xF4 +# CHECK-NEXT: Address: 0x100F8 +# CHECK-NEXT: Offset: 0xF8 # CHECK-NEXT: Size: 24 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 -# CHECK-NEXT: AddressAlignment: 4 +# CHECK-NEXT: AddressAlignment: 8 # CHECK-NEXT: EntrySize: 24 # CHECK-NEXT: } # CHECK-NEXT: Section { # CHECK-NEXT: Index: 2 -# CHECK-NEXT: Name: .MIPS.abiflags -# CHECK-NEXT: Type: SHT_MIPS_ABIFLAGS (0x7000002A) +# CHECK-NEXT: Name: .reginfo +# CHECK-NEXT: Type: SHT_MIPS_REGINFO (0x70000006) # CHECK-NEXT: Flags [ (0x2) # CHECK-NEXT: SHF_ALLOC (0x2) # CHECK-NEXT: ] @@ -82,7 +82,7 @@ # CHECK-NEXT: Size: 24 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 -# CHECK-NEXT: AddressAlignment: 8 +# CHECK-NEXT: AddressAlignment: 4 # CHECK-NEXT: EntrySize: 24 # CHECK-NEXT: } # CHECK-NEXT: Section { Index: lld/trunk/test/ELF/invalid/mips-invalid-options-descriptor.s =================================================================== --- lld/trunk/test/ELF/invalid/mips-invalid-options-descriptor.s +++ lld/trunk/test/ELF/invalid/mips-invalid-options-descriptor.s @@ -2,4 +2,4 @@ ## .MIPS.options with size of zero. # RUN: not ld.lld %p/Inputs/mips-invalid-options-descriptor.elf -o %t2 2>&1 | \ # RUN: FileCheck %s -# CHECK: zero option descriptor size +# CHECK: error: Invalid data was encountered while parsing the file Index: lld/trunk/test/ELF/invalid/mips-multiple-options.test =================================================================== --- lld/trunk/test/ELF/invalid/mips-multiple-options.test +++ lld/trunk/test/ELF/invalid/mips-multiple-options.test @@ -1,25 +0,0 @@ -# RUN: yaml2obj %s -o %t -# RUN: not ld.lld %t -o %tout 2>&1 | FileCheck %s - ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .o1 - Type: SHT_MIPS_OPTIONS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Content: "010000000000000000000000" - - - Name: .o2 - Type: SHT_MIPS_OPTIONS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Content: "010000000000000000000000" - -# CHECK: multiple SHT_MIPS_OPTIONS sections are not allowed Index: lld/trunk/test/ELF/invalid/mips-multiple-reginfo.test =================================================================== --- lld/trunk/test/ELF/invalid/mips-multiple-reginfo.test +++ lld/trunk/test/ELF/invalid/mips-multiple-reginfo.test @@ -1,25 +0,0 @@ -# RUN: yaml2obj %s -o %t -# RUN: not ld.lld %t -o %tout 2>&1 | FileCheck %s - ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] - -Sections: - - Name: .foo1 - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Content: "000000000000000000000000000000000000000000000000" - - - Name: .foo2 - Type: SHT_MIPS_REGINFO - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 16 - Content: "000000000000000000000000000000000000000000000000" - -# CHECK: multiple SHT_MIPS_REGINFO sections are not allowed Index: lld/trunk/test/ELF/mips-gprel32-relocs-gp0.s =================================================================== --- lld/trunk/test/ELF/mips-gprel32-relocs-gp0.s +++ lld/trunk/test/ELF/mips-gprel32-relocs-gp0.s @@ -31,7 +31,7 @@ # DUMP: 00010004 .text 00000000 foo # DUMP: 00027ff0 .got 00000000 .hidden _gp -# ERR: {{.*}}mips-gp0-non-zero.o(.reginfo): unsupported non-zero ri_gp_value +# ERR: error: {{.*}}mips-gp0-non-zero.o: unsupported non-zero ri_gp_value .text .global __start Index: lld/trunk/test/ELF/mips-n32-rels.s =================================================================== --- lld/trunk/test/ELF/mips-n32-rels.s +++ lld/trunk/test/ELF/mips-n32-rels.s @@ -38,7 +38,7 @@ # ^-- %lo(0x17ff0) # CHECK: Contents of section .rodata: -# CHECK-NEXT: 10128 00020004 +# CHECK-NEXT: 10110 00020004 # ^-- loc # CHECK: 00020004 .text 00000000 loc Index: lld/trunk/test/ELF/mips-options-r.test =================================================================== --- lld/trunk/test/ELF/mips-options-r.test +++ lld/trunk/test/ELF/mips-options-r.test @@ -1,7 +1,6 @@ # Check that if input file contains .MIPS.options section and symbol # points to the section and the linker generates a relocatable output, -# LLD does not crash and write section symbols point to the output -# .MIPS.options section. +# LLD does not crash. # # PR 27878 # @@ -12,8 +11,8 @@ # % as -mabi=64 -mips64r2 t.s # RUN: ld.lld -r %p/Inputs/mips-options.o -o %t.o -# RUN: llvm-readobj -t %t.o | FileCheck %s +# RUN: llvm-readobj -s %t.o | FileCheck %s # REQUIRES: mips -# CHECK: Section: .MIPS.options +# CHECK: Name: .MIPS.options