forked from OSchip/llvm-project
[ELF][mips] Print the full file path for files with incompatible ISA
Summary: I also changed the message to print both the ISA and the the architecture name for incompatible files. Previously it would be quite hard to find the actual path of the incompatible object files in projects that have many object files with the same name in different directories. Reviewers: atanasyan, ruiu Reviewed By: atanasyan Subscribers: emaste, sdardis, llvm-commits Differential Revision: https://reviews.llvm.org/D40958 llvm-svn: 320056
This commit is contained in:
parent
2983b46973
commit
280252c6d1
|
@ -34,7 +34,7 @@ struct ArchTreeEdge {
|
|||
};
|
||||
|
||||
struct FileFlags {
|
||||
StringRef Filename;
|
||||
InputFile *File;
|
||||
uint32_t Flags;
|
||||
};
|
||||
} // namespace
|
||||
|
@ -73,17 +73,17 @@ static void checkFlags(ArrayRef<FileFlags> Files) {
|
|||
uint32_t ABI2 = F.Flags & (EF_MIPS_ABI | EF_MIPS_ABI2);
|
||||
if (ABI != ABI2)
|
||||
error("target ABI '" + getAbiName(ABI) + "' is incompatible with '" +
|
||||
getAbiName(ABI2) + "': " + F.Filename);
|
||||
getAbiName(ABI2) + "': " + toString(F.File));
|
||||
|
||||
bool Nan2 = F.Flags & EF_MIPS_NAN2008;
|
||||
if (Nan != Nan2)
|
||||
error("target -mnan=" + getNanName(Nan) + " is incompatible with -mnan=" +
|
||||
getNanName(Nan2) + ": " + F.Filename);
|
||||
getNanName(Nan2) + ": " + toString(F.File));
|
||||
|
||||
bool Fp2 = F.Flags & EF_MIPS_FP64;
|
||||
if (Fp != Fp2)
|
||||
error("target -mfp" + getFpName(Fp) + " is incompatible with -mfp" +
|
||||
getFpName(Fp2) + ": " + F.Filename);
|
||||
getFpName(Fp2) + ": " + toString(F.File));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,9 +102,11 @@ static uint32_t getPicFlags(ArrayRef<FileFlags> Files) {
|
|||
for (const FileFlags &F : Files.slice(1)) {
|
||||
bool IsPic2 = F.Flags & (EF_MIPS_PIC | EF_MIPS_CPIC);
|
||||
if (IsPic && !IsPic2)
|
||||
warn("linking abicalls code with non-abicalls file: " + F.Filename);
|
||||
warn("linking abicalls code " + toString(Files[0].File) +
|
||||
" with non-abicalls file: " + toString(F.File));
|
||||
if (!IsPic && IsPic2)
|
||||
warn("linking non-abicalls code with abicalls file: " + F.Filename);
|
||||
warn("linking non-abicalls code " + toString(Files[0].File) +
|
||||
" with abicalls file: " + toString(F.File));
|
||||
}
|
||||
|
||||
// Compute the result PIC/non-PIC flag.
|
||||
|
@ -221,10 +223,6 @@ static StringRef getMachName(uint32_t Flags) {
|
|||
}
|
||||
|
||||
static StringRef getArchName(uint32_t Flags) {
|
||||
StringRef S = getMachName(Flags);
|
||||
if (!S.empty())
|
||||
return S;
|
||||
|
||||
switch (Flags & EF_MIPS_ARCH) {
|
||||
case EF_MIPS_ARCH_1:
|
||||
return "mips1";
|
||||
|
@ -253,6 +251,14 @@ static StringRef getArchName(uint32_t Flags) {
|
|||
}
|
||||
}
|
||||
|
||||
static std::string getFullArchName(uint32_t Flags) {
|
||||
StringRef Arch = getArchName(Flags);
|
||||
StringRef Mach = getMachName(Flags);
|
||||
if (Mach.empty())
|
||||
return Arch.str();
|
||||
return (Arch + " (" + Mach + ")").str();
|
||||
}
|
||||
|
||||
// There are (arguably too) many MIPS ISAs out there. Their relationships
|
||||
// can be represented as a forest. If all input files have ISAs which
|
||||
// reachable by repeated proceeding from the single child to the parent,
|
||||
|
@ -272,8 +278,9 @@ static uint32_t getArchFlags(ArrayRef<FileFlags> Files) {
|
|||
if (isArchMatched(New, Ret))
|
||||
continue;
|
||||
if (!isArchMatched(Ret, New)) {
|
||||
error("target ISA '" + getArchName(Ret) + "' is incompatible with '" +
|
||||
getArchName(New) + "': " + F.Filename);
|
||||
error("incompatible target ISA:\n>>> " + toString(Files[0].File) + ": " +
|
||||
getFullArchName(Ret) + "\n>>> " + toString(F.File) + ": " +
|
||||
getFullArchName(New));
|
||||
return 0;
|
||||
}
|
||||
Ret = New;
|
||||
|
@ -284,8 +291,7 @@ static uint32_t getArchFlags(ArrayRef<FileFlags> Files) {
|
|||
template <class ELFT> uint32_t elf::calcMipsEFlags() {
|
||||
std::vector<FileFlags> V;
|
||||
for (InputFile *F : ObjectFiles)
|
||||
V.push_back(
|
||||
{F->getName(), cast<ObjFile<ELFT>>(F)->getObj().getHeader()->e_flags});
|
||||
V.push_back({F, cast<ObjFile<ELFT>>(F)->getObj().getHeader()->e_flags});
|
||||
if (V.empty())
|
||||
return 0;
|
||||
checkFlags(V);
|
||||
|
|
|
@ -71,8 +71,14 @@ __start:
|
|||
# R1R2-NEXT: EF_MIPS_CPIC
|
||||
# R1R2-NEXT: ]
|
||||
|
||||
# R3R32: target ISA 'mips3' is incompatible with 'mips32': {{.*}}mips-elf-flags-err.s.tmp2.o
|
||||
# R6OCTEON: target ISA 'mips64r6' is incompatible with 'octeon': {{.*}}mips-elf-flags-err.s.tmp2.o
|
||||
# R3R32: error: incompatible target ISA:
|
||||
# R3R32-NEXT: >>> {{.+}}/mips-elf-flags-err.s.tmp1.o: mips3
|
||||
# R3R32-NEXT: >>> {{.+}}/mips-elf-flags-err.s.tmp2.o: mips32
|
||||
|
||||
# R6OCTEON: error: incompatible target ISA:
|
||||
# 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 [
|
||||
|
|
Loading…
Reference in New Issue