[llvm] r350152 - [mips] Show an error on attempt to use 64-bit PC-relative relocation
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 29 02:10:02 PST 2018
Author: atanasyan
Date: Sat Dec 29 02:10:02 2018
New Revision: 350152
URL: http://llvm.org/viewvc/llvm-project?rev=350152&view=rev
Log:
[mips] Show an error on attempt to use 64-bit PC-relative relocation
The following code requests 64-bit PC-relative relocations unsupported
by MIPS ABI. Now it triggers an assertion. It's better to show an error
message.
```
foo:
.quad bar - foo
```
Modified:
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
llvm/trunk/test/MC/Mips/unsupported-relocation.s
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp?rev=350152&r1=350151&r2=350152&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp Sat Dec 29 02:10:02 2018
@@ -239,6 +239,10 @@ unsigned MipsELFObjectWriter::getRelocTy
if (IsPCRel) {
switch (Kind) {
+ case FK_Data_8:
+ Ctx.reportError(Fixup.getLoc(),
+ "MIPS does not support 64-bit PC-relative relocations");
+ return ELF::R_MIPS_NONE;
case Mips::fixup_Mips_Branch_PCRel:
case Mips::fixup_Mips_PC16:
return ELF::R_MIPS_PC16;
Modified: llvm/trunk/test/MC/Mips/unsupported-relocation.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/unsupported-relocation.s?rev=350152&r1=350151&r2=350152&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/unsupported-relocation.s (original)
+++ llvm/trunk/test/MC/Mips/unsupported-relocation.s Sat Dec 29 02:10:02 2018
@@ -11,3 +11,5 @@ foo:
# CHECK: :[[@LINE-1]]:17: error: MIPS does not support one byte relocations
.byte x+1
# CHECK: :[[@LINE-1]]:17: error: MIPS does not support one byte relocations
+ .quad x-foo
+# CHECK: :[[@LINE-1]]:17: error: MIPS does not support 64-bit PC-relative relocations
More information about the llvm-commits
mailing list