[lld] r361472 - [LLD][ELF] - Improve diagnostic about unrecognized relocations.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 02:50:18 PDT 2019
Author: grimar
Date: Thu May 23 02:50:18 2019
New Revision: 361472
URL: http://llvm.org/viewvc/llvm-project?rev=361472&view=rev
Log:
[LLD][ELF] - Improve diagnostic about unrecognized relocations.
This is a minor improvement inspired by https://bugs.llvm.org/show_bug.cgi?id=38303.
A person reported that he observed message complaining about unsupported R_ARM_V4BX:
error: can't create dynamic relocation R_ARM_V4BX against local symbol in readonly segment; recompile object files with -fPIC
But with -z notext he only saw a relocation number, what is not convenient:
error: ../../gfx/cairo/libpixman/src/pixman-arm-neon-asm-bilinear.o:(.text+0x4F0): unrecognized reloc 40
Also, in the error messages we use relocation but not reloc.
With this patch we start to print one of the following messages:
error: file.o: unrecognized relocation Unknown(999)
error: file.o: unrecognized relocation R_X_KNOWN_BY_LLVM_BUT_UNSUPPORTED_BY_LLD_NAME
There is no way to write a test for that I believe.
Differential revision: https://reviews.llvm.org/D62237
Modified:
lld/trunk/ELF/Arch/AArch64.cpp
lld/trunk/ELF/Arch/ARM.cpp
lld/trunk/ELF/Arch/AVR.cpp
lld/trunk/ELF/Arch/Hexagon.cpp
lld/trunk/ELF/Arch/MSP430.cpp
lld/trunk/ELF/Arch/PPC.cpp
lld/trunk/ELF/Arch/PPC64.cpp
Modified: lld/trunk/ELF/Arch/AArch64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/AArch64.cpp?rev=361472&r1=361471&r2=361472&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/AArch64.cpp (original)
+++ lld/trunk/ELF/Arch/AArch64.cpp Thu May 23 02:50:18 2019
@@ -350,7 +350,7 @@ void AArch64::relocateOne(uint8_t *Loc,
or32AArch64Imm(Loc, Val);
break;
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
Modified: lld/trunk/ELF/Arch/ARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/ARM.cpp?rev=361472&r1=361471&r2=361472&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/ARM.cpp (original)
+++ lld/trunk/ELF/Arch/ARM.cpp Thu May 23 02:50:18 2019
@@ -518,7 +518,7 @@ void ARM::relocateOne(uint8_t *Loc, RelT
(Val & 0x00ff)); // imm8
break;
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
Modified: lld/trunk/ELF/Arch/AVR.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/AVR.cpp?rev=361472&r1=361471&r2=361472&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/AVR.cpp (original)
+++ lld/trunk/ELF/Arch/AVR.cpp Thu May 23 02:50:18 2019
@@ -66,7 +66,7 @@ void AVR::relocateOne(uint8_t *Loc, RelT
break;
}
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + toString(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
Modified: lld/trunk/ELF/Arch/Hexagon.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/Hexagon.cpp?rev=361472&r1=361471&r2=361472&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/Hexagon.cpp (original)
+++ lld/trunk/ELF/Arch/Hexagon.cpp Thu May 23 02:50:18 2019
@@ -246,7 +246,7 @@ void Hexagon::relocateOne(uint8_t *Loc,
or32le(Loc, applyMask(0x00c03fff, Val));
break;
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + toString(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
break;
}
}
Modified: lld/trunk/ELF/Arch/MSP430.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/MSP430.cpp?rev=361472&r1=361471&r2=361472&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/MSP430.cpp (original)
+++ lld/trunk/ELF/Arch/MSP430.cpp Thu May 23 02:50:18 2019
@@ -83,7 +83,7 @@ void MSP430::relocateOne(uint8_t *Loc, R
break;
}
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + toString(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
Modified: lld/trunk/ELF/Arch/PPC.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC.cpp?rev=361472&r1=361471&r2=361472&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/PPC.cpp (original)
+++ lld/trunk/ELF/Arch/PPC.cpp Thu May 23 02:50:18 2019
@@ -69,7 +69,7 @@ void PPC::relocateOne(uint8_t *Loc, RelT
write32be(Loc, read32be(Loc) | (Val & 0x3FFFFFC));
break;
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
Modified: lld/trunk/ELF/Arch/PPC64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC64.cpp?rev=361472&r1=361471&r2=361472&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/PPC64.cpp (original)
+++ lld/trunk/ELF/Arch/PPC64.cpp Thu May 23 02:50:18 2019
@@ -860,7 +860,7 @@ void PPC64::relocateOne(uint8_t *Loc, Re
write64(Loc, Val - DynamicThreadPointerOffset);
break;
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
More information about the llvm-commits
mailing list