[lld] r232706 - [Mips] Recognize and check compatibility MIPS32R6 / MIPS64R6 ISA's

Simon Atanasyan simon at atanasyan.com
Wed Mar 18 22:44:13 PDT 2015


Author: atanasyan
Date: Thu Mar 19 00:44:13 2015
New Revision: 232706

URL: http://llvm.org/viewvc/llvm-project?rev=232706&view=rev
Log:
[Mips] Recognize and check compatibility MIPS32R6 / MIPS64R6 ISA's

Added:
    lld/trunk/test/elf/Mips/e-flags-merge-10.test
    lld/trunk/test/elf/Mips/e-flags-merge-11.test
Modified:
    lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.cpp

Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.cpp?rev=232706&r1=232705&r2=232706&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFlagsMerger.cpp Thu Mar 19 00:44:13 2015
@@ -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::merg
   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"));

Added: lld/trunk/test/elf/Mips/e-flags-merge-10.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/e-flags-merge-10.test?rev=232706&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/e-flags-merge-10.test (added)
+++ lld/trunk/test/elf/Mips/e-flags-merge-10.test Thu Mar 19 00:44:13 2015
@@ -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
+...

Added: lld/trunk/test/elf/Mips/e-flags-merge-11.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/e-flags-merge-11.test?rev=232706&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/e-flags-merge-11.test (added)
+++ lld/trunk/test/elf/Mips/e-flags-merge-11.test Thu Mar 19 00:44:13 2015
@@ -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
+...





More information about the llvm-commits mailing list