summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.cpp4
-rw-r--r--lld/test/elf/Mips/e-flags-merge-10.test43
-rw-r--r--lld/test/elf/Mips/e-flags-merge-11.test43
3 files changed, 90 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.cpp
index 3ae66fedb4b..d8c1aad39de 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.cpp
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.cpp
@@ -23,6 +23,8 @@ struct MipsISATreeEdge {
};
static MipsISATreeEdge isaTree[] = {
+ // MIPS32R6 and MIPS64R6 are not compatible with other extensions
+
// MIPS64 extensions.
{EF_MIPS_ARCH_64R2, EF_MIPS_ARCH_64},
// MIPS V extensions.
@@ -87,6 +89,8 @@ std::error_code MipsELFFlagsMerger::merge(uint8_t newClass, uint32_t newFlags) {
case EF_MIPS_ARCH_64:
case EF_MIPS_ARCH_32R2:
case EF_MIPS_ARCH_64R2:
+ case EF_MIPS_ARCH_32R6:
+ case EF_MIPS_ARCH_64R6:
break;
default:
return make_dynamic_error_code(Twine("Unsupported instruction set"));
diff --git a/lld/test/elf/Mips/e-flags-merge-10.test b/lld/test/elf/Mips/e-flags-merge-10.test
new file mode 100644
index 00000000000..33d4e85868d
--- /dev/null
+++ b/lld/test/elf/Mips/e-flags-merge-10.test
@@ -0,0 +1,43 @@
+# Check that LLD shows an error and does not link files with mips32r2
+# and mips32r6 instructions sets.
+
+# RUN: yaml2obj -format=elf -docnum 1 %s > %t-32r2.o
+# RUN: yaml2obj -format=elf -docnum 2 %s > %t-32r6.o
+
+# RUN: not lld -flavor gnu -target mipsel -shared -o %t.so \
+# RUN: %t-32r2.o %t-32r6.o 2>&1 | FileCheck %s
+
+# CHECK: Linking modules with icompatible ISA
+
+# 32r2.o
+---
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2]
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x04
+ Size: 0x04
+
+# 32r6.o
+---
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6]
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x04
+ Size: 0x04
+...
diff --git a/lld/test/elf/Mips/e-flags-merge-11.test b/lld/test/elf/Mips/e-flags-merge-11.test
new file mode 100644
index 00000000000..e51427dacf3
--- /dev/null
+++ b/lld/test/elf/Mips/e-flags-merge-11.test
@@ -0,0 +1,43 @@
+# Check that LLD shows an error and does not link files with mips64r2
+# and mips64r6 instructions sets.
+
+# RUN: yaml2obj -format=elf -docnum 1 %s > %t-64r2.o
+# RUN: yaml2obj -format=elf -docnum 2 %s > %t-64r6.o
+
+# RUN: not lld -flavor gnu -target mips64el -shared -o %t.so \
+# RUN: %t-64r2.o %t-64r6.o 2>&1 | FileCheck %s
+
+# CHECK: Linking modules with icompatible ISA
+
+# 64r2.o
+---
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_ARCH_64R2]
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x04
+ Size: 0x04
+
+# 64r6.o
+---
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_ARCH_64R6]
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x04
+ Size: 0x04
+...
OpenPOWER on IntegriCloud