// they can be used to reason about object compatibility.
return &InputSection<ELFT>::Discarded;
case SHT_MIPS_REGINFO:
+ if (MipsReginfo)
+ fatal(getFilename(this) +
+ ": multiple SHT_MIPS_REGINFO sections are not allowed");
MipsReginfo.reset(new MipsReginfoInputSection<ELFT>(this, &Sec, Name));
return MipsReginfo.get();
case SHT_MIPS_OPTIONS:
MipsOptions.reset(new MipsOptionsInputSection<ELFT>(this, &Sec, Name));
return MipsOptions.get();
case SHT_MIPS_ABIFLAGS:
+ if (MipsAbiFlags)
+ fatal(getFilename(this) +
+ ": multiple SHT_MIPS_ABIFLAGS sections are not allowed");
MipsAbiFlags.reset(new MipsAbiFlagsInputSection<ELFT>(this, &Sec, Name));
return MipsAbiFlags.get();
case SHT_RELA:
--- /dev/null
+# 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_ABIFLAGS
+ ISA: MIPS64
+
+ - Name: .foo2
+ Type: SHT_MIPS_ABIFLAGS
+ ISA: MIPS64
+
+# CHECK: multiple SHT_MIPS_ABIFLAGS sections are not allowed
--- /dev/null
+# 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