1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[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
```

llvm-svn: 350152
This commit is contained in:
Simon Atanasyan 2018-12-29 10:10:02 +00:00
parent efffee3f73
commit 6611fe0a02
2 changed files with 6 additions and 0 deletions

View File

@ -239,6 +239,10 @@ unsigned MipsELFObjectWriter::getRelocType(MCContext &Ctx,
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;

View File

@ -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