summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2015-03-19 05:44:13 +0000
committerSimon Atanasyan <simon@atanasyan.com>2015-03-19 05:44:13 +0000
commit14b5217cc61bba81f2da3fe2565d26739667d6ea (patch)
treebaba191128da65cb7a84a4d86d3bde45426b5d6c
parent8343c2c9ecf2e6fd6c02591f0d77a156d91aefa8 (diff)
downloadbcm5719-llvm-14b5217cc61bba81f2da3fe2565d26739667d6ea.tar.gz
bcm5719-llvm-14b5217cc61bba81f2da3fe2565d26739667d6ea.zip
[Mips] Recognize and check compatibility MIPS32R6 / MIPS64R6 ISA's
llvm-svn: 232706
-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