[PATCH] D62237: [LLD][ELF] - Improve diagnostic about unrecognized relocations.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 22 01:50:51 PDT 2019
grimar created this revision.
grimar added a reviewer: ruiu.
Herald added subscribers: jsji, MaskRay, kbarton, kristof.beyls, arichardson, javed.absar, nemanjai, emaste, dylanmckay.
Herald added a reviewer: espindola.
grimar edited the summary of this revision.
grimar removed a reviewer: espindola.
Herald added a reviewer: espindola.
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.
https://reviews.llvm.org/D62237
Files:
ELF/Arch/AArch64.cpp
ELF/Arch/ARM.cpp
ELF/Arch/AVR.cpp
ELF/Arch/Hexagon.cpp
ELF/Arch/MSP430.cpp
ELF/Arch/PPC.cpp
ELF/Arch/PPC64.cpp
Index: ELF/Arch/PPC64.cpp
===================================================================
--- ELF/Arch/PPC64.cpp
+++ ELF/Arch/PPC64.cpp
@@ -860,7 +860,7 @@
write64(Loc, Val - DynamicThreadPointerOffset);
break;
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
Index: ELF/Arch/PPC.cpp
===================================================================
--- ELF/Arch/PPC.cpp
+++ ELF/Arch/PPC.cpp
@@ -69,7 +69,7 @@
write32be(Loc, read32be(Loc) | (Val & 0x3FFFFFC));
break;
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
Index: ELF/Arch/MSP430.cpp
===================================================================
--- ELF/Arch/MSP430.cpp
+++ ELF/Arch/MSP430.cpp
@@ -83,7 +83,7 @@
break;
}
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + toString(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
Index: ELF/Arch/Hexagon.cpp
===================================================================
--- ELF/Arch/Hexagon.cpp
+++ ELF/Arch/Hexagon.cpp
@@ -246,7 +246,7 @@
or32le(Loc, applyMask(0x00c03fff, Val));
break;
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + toString(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
break;
}
}
Index: ELF/Arch/AVR.cpp
===================================================================
--- ELF/Arch/AVR.cpp
+++ ELF/Arch/AVR.cpp
@@ -66,7 +66,7 @@
break;
}
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + toString(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
Index: ELF/Arch/ARM.cpp
===================================================================
--- ELF/Arch/ARM.cpp
+++ ELF/Arch/ARM.cpp
@@ -518,7 +518,7 @@
(Val & 0x00ff)); // imm8
break;
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
Index: ELF/Arch/AArch64.cpp
===================================================================
--- ELF/Arch/AArch64.cpp
+++ ELF/Arch/AArch64.cpp
@@ -350,7 +350,7 @@
or32AArch64Imm(Loc, Val);
break;
default:
- error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type));
+ error(getErrorLocation(Loc) + "unrecognized relocation " + toString(Type));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62237.200664.patch
Type: text/x-patch
Size: 2696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190522/05f4188d/attachment.bin>
More information about the llvm-commits
mailing list