[lld] r278352 - [ELF][MIPS] Recognize and print machine name in case of input incompatibility
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 11 09:25:17 PDT 2016
Author: atanasyan
Date: Thu Aug 11 11:25:17 2016
New Revision: 278352
URL: http://llvm.org/viewvc/llvm-project?rev=278352&view=rev
Log:
[ELF][MIPS] Recognize and print machine name in case of input incompatibility
Modified:
lld/trunk/ELF/Mips.cpp
lld/trunk/test/ELF/mips-elf-flags-err.s
Modified: lld/trunk/ELF/Mips.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Mips.cpp?rev=278352&r1=278351&r2=278352&view=diff
==============================================================================
--- lld/trunk/ELF/Mips.cpp (original)
+++ lld/trunk/ELF/Mips.cpp Thu Aug 11 11:25:17 2016
@@ -175,7 +175,49 @@ static bool isArchMatched(uint32_t New,
}
static StringRef getArchName(uint32_t Flags) {
- switch (Flags) {
+ switch (Flags & EF_MIPS_MACH) {
+ case EF_MIPS_MACH_NONE:
+ break;
+ case EF_MIPS_MACH_3900:
+ return "r3900";
+ case EF_MIPS_MACH_4010:
+ return "r4010";
+ case EF_MIPS_MACH_4100:
+ return "r4100";
+ case EF_MIPS_MACH_4650:
+ return "r4650";
+ case EF_MIPS_MACH_4120:
+ return "r4120";
+ case EF_MIPS_MACH_4111:
+ return "r4111";
+ case EF_MIPS_MACH_5400:
+ return "vr5400";
+ case EF_MIPS_MACH_5900:
+ return "vr5900";
+ case EF_MIPS_MACH_5500:
+ return "vr5500";
+ case EF_MIPS_MACH_9000:
+ return "rm9000";
+ case EF_MIPS_MACH_LS2E:
+ return "loongson2e";
+ case EF_MIPS_MACH_LS2F:
+ return "loongson2f";
+ case EF_MIPS_MACH_LS3A:
+ return "loongson3a";
+ case EF_MIPS_MACH_OCTEON:
+ return "octeon";
+ case EF_MIPS_MACH_OCTEON2:
+ return "octeon2";
+ case EF_MIPS_MACH_OCTEON3:
+ return "octeon3";
+ case EF_MIPS_MACH_SB1:
+ return "sb1";
+ case EF_MIPS_MACH_XLR:
+ return "xlr";
+ default:
+ return "unknown machine";
+ }
+ switch (Flags & EF_MIPS_ARCH) {
case EF_MIPS_ARCH_1:
return "mips1";
case EF_MIPS_ARCH_2:
@@ -199,7 +241,7 @@ static StringRef getArchName(uint32_t Fl
case EF_MIPS_ARCH_64R6:
return "mips64r6";
default:
- return "unknown";
+ return "unknown arch";
}
}
Modified: lld/trunk/test/ELF/mips-elf-flags-err.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/mips-elf-flags-err.s?rev=278352&r1=278351&r2=278352&view=diff
==============================================================================
--- lld/trunk/test/ELF/mips-elf-flags-err.s (original)
+++ lld/trunk/test/ELF/mips-elf-flags-err.s Thu Aug 11 11:25:17 2016
@@ -15,6 +15,15 @@
# RUN: -mcpu=mips32r6 %s -o %t2.o
# RUN: not ld.lld %t1.o %t2.o -o %t.exe 2>&1 | FileCheck -check-prefix=R1R6 %s
+# Check that lld does not allow to link incompatible ISAs.
+
+# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
+# RUN: -mcpu=mips64r6 %S/Inputs/mips-dynamic.s -o %t1.o
+# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
+# RUN: -mcpu=octeon %s -o %t2.o
+# RUN: not ld.lld %t1.o %t2.o -o %t.exe 2>&1 \
+# RUN: | FileCheck -check-prefix=R6OCTEON %s
+
# Check that lld take in account EF_MIPS_MACH_XXX ISA flags
# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
@@ -55,6 +64,7 @@ __start:
# R1R2-NEXT: ]
# R1R6: target ISA 'mips32' is incompatible with 'mips32r6': {{.*}}mips-elf-flags-err.s.tmp2.o
+# R6OCTEON: target ISA 'mips64r6' is incompatible with 'octeon': {{.*}}mips-elf-flags-err.s.tmp2.o
# OCTEON: Flags [
# OCTEON-NEXT: EF_MIPS_ARCH_64R2
More information about the llvm-commits
mailing list