for (const FileFlags &F : Files) {
if (Config->Is64 && F.Flags & EF_MIPS_MICROMIPS)
- error("linking microMIPS 64-bit files is unsupported: " +
- toString(F.File));
+ error(toString(F.File) + ": microMIPS 64-bit is not supported");
uint32_t ABI2 = F.Flags & (EF_MIPS_ABI | EF_MIPS_ABI2);
if (ABI != ABI2)
- error("target ABI '" + getAbiName(ABI) + "' is incompatible with '" +
- getAbiName(ABI2) + "': " + toString(F.File));
+ error(toString(F.File) + ": ABI '" + getAbiName(ABI2) +
+ "' is incompatible with target ABI '" + getAbiName(ABI) + "'");
bool Nan2 = F.Flags & EF_MIPS_NAN2008;
if (Nan != Nan2)
- error("target -mnan=" + getNanName(Nan) + " is incompatible with -mnan=" +
- getNanName(Nan2) + ": " + toString(F.File));
+ error(toString(F.File) + ": -mnan=" + getNanName(Nan2) +
+ " is incompatible with target -mnan=" + getNanName(Nan));
bool Fp2 = F.Flags & EF_MIPS_FP64;
if (Fp != Fp2)
- error("target -mfp" + getFpName(Fp) + " is incompatible with -mfp" +
- getFpName(Fp2) + ": " + toString(F.File));
+ error(toString(F.File) + ": -mfp" + getFpName(Fp2) +
+ " is incompatible with target -mfp" + getFpName(Fp));
}
}
for (const FileFlags &F : Files.slice(1)) {
bool IsPic2 = F.Flags & (EF_MIPS_PIC | EF_MIPS_CPIC);
if (IsPic && !IsPic2)
- warn("linking abicalls code " + toString(Files[0].File) +
- " with non-abicalls file: " + toString(F.File));
+ warn(toString(F.File) +
+ ": linking non-abicalls code with abicalls code " +
+ toString(Files[0].File));
if (!IsPic && IsPic2)
- warn("linking non-abicalls code " + toString(Files[0].File) +
- " with abicalls file: " + toString(F.File));
+ warn(toString(F.File) +
+ ": linking abicalls code with non-abicalls code " +
+ toString(Files[0].File));
}
// Compute the result PIC/non-PIC flag.
case Mips::Val_GNU_MIPS_ABI_FP_SOFT:
return "-msoft-float";
case Mips::Val_GNU_MIPS_ABI_FP_OLD_64:
- return "-mips32r2 -mfp64 (old)";
+ return "-mgp32 -mfp64 (old)";
case Mips::Val_GNU_MIPS_ABI_FP_XX:
return "-mfpxx";
case Mips::Val_GNU_MIPS_ABI_FP_64:
if (compareMipsFpAbi(NewFlag, OldFlag) >= 0)
return NewFlag;
if (compareMipsFpAbi(OldFlag, NewFlag) < 0)
- error("target floating point ABI '" + getMipsFpAbiName(OldFlag) +
- "' is incompatible with '" + getMipsFpAbiName(NewFlag) +
- "': " + FileName);
+ error(FileName + ": floating point ABI '" + getMipsFpAbiName(NewFlag) +
+ "' is incompatible with target floating point ABI '" +
+ getMipsFpAbiName(OldFlag) + "'");
return OldFlag;
}
# RUN: not ld.lld %t1.o %t2.o -o %t.exe 2>&1 \
# RUN: | FileCheck -check-prefix=R6OCTEON %s
-# Check that lld does not allow to link incompatible floating point ABI.
-
-# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
-# RUN: -mcpu=mips32 %S/Inputs/mips-dynamic.s -o %t1.o
-# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
-# RUN: -mcpu=mips32 -mattr=+fp64 %s -o %t2.o
-# RUN: not ld.lld %t1.o %t2.o -o %t.exe 2>&1 | FileCheck -check-prefix=FPABI %s
-
# Check that lld take in account EF_MIPS_MACH_XXX ISA flags
# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
# RUN: ld.lld %t1.o %t2.o -o %t.exe
# RUN: llvm-readobj -h %t.exe | FileCheck -check-prefix=OCTEON %s
-# Check that lld does not allow to link incompatible ABIs.
-
-# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
-# RUN: -target-abi n32 %S/Inputs/mips-dynamic.s -o %t1.o
-# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
-# RUN: -target-abi o32 %s -o %t2.o
-# RUN: not ld.lld %t1.o %t2.o -o %t.exe 2>&1 | FileCheck -check-prefix=N32O32 %s
-
-# Check that lld does not allow to link modules with incompatible NAN flags.
-
-# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
-# RUN: -mattr=+nan2008 %S/Inputs/mips-dynamic.s -o %t1.o
-# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
-# RUN: %s -o %t2.o
-# RUN: not ld.lld %t1.o %t2.o -o %t.exe 2>&1 | FileCheck -check-prefix=NAN %s
-
.option pic0
.text
.global __start
# R6OCTEON-NEXT: >>> {{.+}}mips-elf-flags-err.s.tmp1.o: mips64r6
# R6OCTEON-NEXT: >>> {{.+}}mips-elf-flags-err.s.tmp2.o: mips64r2 (octeon)
-# FPABI: target floating point ABI '-mdouble-float' is incompatible with '-mgp32 -mfp64': {{.*}}mips-elf-flags-err.s.tmp2.o
-
# OCTEON: Flags [
# OCTEON-NEXT: EF_MIPS_ARCH_64R2
# OCTEON-NEXT: EF_MIPS_CPIC
# OCTEON-NEXT: EF_MIPS_MACH_OCTEON
# OCTEON: ]
-
-# N32O32: error: {{.*}}mips-elf-flags-err.s.tmp2.o is incompatible with {{.*}}mips-elf-flags-err.s.tmp1.o
-
-# NAN: target -mnan=2008 is incompatible with -mnan=legacy: {{.*}}mips-elf-flags-err.s.tmp2.o
--- /dev/null
+# REQUIRES: mips
+#
+# Check warning and errors in case of input
+# files with incompatible ELF header flags.
+
+# RUN: yaml2obj -docnum 1 %s -o %t-n64.o
+# RUN: yaml2obj -docnum 2 %s -o %t-o64.o
+# RUN: yaml2obj -docnum 3 %s -o %t-n32.o
+# RUN: yaml2obj -docnum 4 %s -o %t-o32.o
+# RUN: yaml2obj -docnum 5 %s -o %t-eabi64.o
+# RUN: yaml2obj -docnum 6 %s -o %t-eabi32.o
+
+# RUN: not ld.lld %t-n64.o %t-eabi64.o -shared -o /dev/null 2>&1 \
+# RUN: | FileCheck -check-prefixes=MM64,N64EABI64 %s
+#
+# RUN: not ld.lld %t-n64.o %t-o64.o -shared -o /dev/null 2>&1 \
+# RUN: | FileCheck -check-prefixes=MM64,N64O64 %s
+
+# RUN: not ld.lld %t-o32.o %t-eabi32.o -shared -o /dev/null 2>&1 \
+# RUN: | FileCheck -check-prefixes=O32EABI32,FP64,CPIC1 %s
+
+# RUN: not ld.lld %t-eabi32.o %t-o32.o -shared -o /dev/null 2>&1 \
+# RUN: | FileCheck -check-prefix=CPIC2 %s
+
+# MM64: {{.*}}n64.o: microMIPS 64-bit is not supported
+
+# N64EABI64: {{.*}}eabi64.o: ABI 'eabi64' is incompatible with target ABI 'n64'
+# N64O64: {{.*}}o64.o: ABI 'o64' is incompatible with target ABI 'n64'
+# O32EABI32: {{.*}}eabi32.o: ABI 'eabi32' is incompatible with target ABI 'o32'
+
+# NAN: {{.*}}o32.o: -mnan=legacy is incompatible with target -mnan=2008
+# FP64: {{.*}}eabi32.o: -mfp64 is incompatible with target -mfp32
+
+# CPIC1: {{.*}}tmp-eabi32.o: linking non-abicalls code with abicalls code {{.*}}o32.o
+# CPIC2: {{.*}}tmp-o32.o: linking abicalls code with non-abicalls code {{.*}}eabi32.o
+
+# n64.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_64, EF_MIPS_MICROMIPS ]
+
+# o64.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ABI_O64, EF_MIPS_ARCH_64 ]
+
+# n32.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_64, EF_MIPS_ABI2, EF_MIPS_NAN2008 ]
+
+# o32.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_32, EF_MIPS_ABI_O32, EF_MIPS_CPIC ]
+
+# eabi64.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_64, EF_MIPS_ABI_EABI64 ]
+
+# eabi32.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_32, EF_MIPS_ABI_EABI32, EF_MIPS_FP64 ]
--- /dev/null
+# REQUIRES: mips
+#
+# Check warning and errors in case of input
+# files with incompatible floating point ABI flags.
+
+# RUN: yaml2obj -docnum 1 %s -o %t-dbl.o
+# RUN: yaml2obj -docnum 2 %s -o %t-sgl.o
+# RUN: yaml2obj -docnum 3 %s -o %t-soft.o
+# RUN: yaml2obj -docnum 4 %s -o %t-fp64.o
+# RUN: yaml2obj -docnum 5 %s -o %t-fp64old.o
+# RUN: yaml2obj -docnum 6 %s -o %t-fp64a.o
+# RUN: yaml2obj -docnum 7 %s -o %t-fpxx.o
+
+# RUN: not ld.lld %t-dbl.o %t-fp64.o -shared -o /dev/null 2>&1 \
+# RUN: | FileCheck -check-prefixes=DBLFP64 %s
+
+# RUN: not ld.lld %t-sgl.o %t-fp64old.o -shared -o /dev/null 2>&1 \
+# RUN: | FileCheck -check-prefixes=SGLFP64OLD %s
+
+# RUN: not ld.lld %t-soft.o %t-fp64a.o -shared -o /dev/null 2>&1 \
+# RUN: | FileCheck -check-prefixes=SOFTFP64A %s
+
+# RUN: not ld.lld %t-sgl.o %t-fpxx.o -shared -o /dev/null 2>&1 \
+# RUN: | FileCheck -check-prefixes=SGLFPXX %s
+
+# DBLFP64: {{.*}}fp64.o: floating point ABI '-mgp32 -mfp64' is incompatible with target floating point ABI '-mdouble-float'
+# SGLFP64OLD: {{.*}}fp64old.o: floating point ABI '-mgp32 -mfp64 (old)' is incompatible with target floating point ABI '-msingle-float'
+# SOFTFP64A: {{.*}}fp64a.o: floating point ABI '-mgp32 -mfp64 -mno-odd-spreg' is incompatible with target floating point ABI '-msoft-float'
+# SGLFPXX: {{.*}}fpxx.o: floating point ABI '-mfpxx' is incompatible with target floating point ABI '-msingle-float'
+
+# dbl.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_64 ]
+
+Sections:
+- Name: .MIPS.abiflags
+ Type: SHT_MIPS_ABIFLAGS
+ ISA: MIPS64
+ ASEs: []
+ FpABI: FP_DOUBLE
+ GPRSize: REG_64
+ CPR1Size: REG_64
+ CPR2Size: REG_NONE
+
+# sgl.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_64 ]
+
+Sections:
+- Name: .MIPS.abiflags
+ Type: SHT_MIPS_ABIFLAGS
+ ISA: MIPS64
+ ASEs: []
+ FpABI: FP_SINGLE
+ GPRSize: REG_64
+ CPR1Size: REG_64
+ CPR2Size: REG_NONE
+
+# soft.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_64 ]
+
+Sections:
+- Name: .MIPS.abiflags
+ Type: SHT_MIPS_ABIFLAGS
+ ISA: MIPS64
+ ASEs: []
+ FpABI: FP_SOFT
+ GPRSize: REG_64
+ CPR1Size: REG_64
+ CPR2Size: REG_NONE
+
+# fp64.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_64 ]
+
+Sections:
+- Name: .MIPS.abiflags
+ Type: SHT_MIPS_ABIFLAGS
+ ISA: MIPS64
+ ASEs: []
+ FpABI: FP_64
+ GPRSize: REG_64
+ CPR1Size: REG_64
+ CPR2Size: REG_NONE
+
+# fp64old.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_64 ]
+
+Sections:
+- Name: .MIPS.abiflags
+ Type: SHT_MIPS_ABIFLAGS
+ ISA: MIPS64
+ ASEs: []
+ FpABI: FP_OLD_64
+ GPRSize: REG_64
+ CPR1Size: REG_64
+ CPR2Size: REG_NONE
+
+# fp64a.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_64 ]
+
+Sections:
+- Name: .MIPS.abiflags
+ Type: SHT_MIPS_ABIFLAGS
+ ISA: MIPS64
+ ASEs: []
+ FpABI: FP_64A
+ GPRSize: REG_64
+ CPR1Size: REG_64
+ CPR2Size: REG_NONE
+
+# fpxx.o
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_ARCH_64 ]
+
+Sections:
+- Name: .MIPS.abiflags
+ Type: SHT_MIPS_ABIFLAGS
+ ISA: MIPS64
+ ASEs: []
+ FpABI: FP_XX
+ GPRSize: REG_64
+ CPR1Size: REG_64
+ CPR2Size: REG_NONE
+++ /dev/null
-# REQUIRES: mips
-#
-# Check that the linker rejects microMIPS64 input files.
-
-# RUN: yaml2obj %s -o %t.o
-# RUN: not ld.lld %t.o -shared -o %t.so 2>&1 | FileCheck %s
-
-# CHECK: linking microMIPS 64-bit files is unsupported: {{.*}}mips-micro64-reject.test
-
-!ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2MSB
- Type: ET_REL
- Machine: EM_MIPS
- Flags: [ EF_MIPS_MICROMIPS, EF_MIPS_ARCH_64 ]
-
-Sections:
- - Name: .text
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Content: 00000000
-