[PATCH] D40962: [ELF] When a relocation is out of range print the value and the range

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 09:49:56 PST 2017


arichardson added inline comments.


================
Comment at: ELF/Target.h:171
+    // message instead of an extremely large unsigned number
+    reportRangeError(Loc, Type, (int64_t)V < 0 ? Twine((int64_t)V) : Twine(V),
+                     llvm::minIntN(N), llvm::maxUIntN(N));
----------------
ruiu wrote:
> arichardson wrote:
> > ruiu wrote:
> > > Why don't you just pass Twine((int64_t)V)?
> > Since we only call this with values <= INT64_MAX that is much better, thanks.
> But why INT64_MAX? It seems just inconsistent. If you sign-extend, you want to always do that, no?
I meant that this function is either called with a negative signed number or an unsigned value that doesn't have the int64 sign bit set so that using Twine((int64_t)V) is exactly the same as the ternary expression that I had here.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D40962





More information about the llvm-commits mailing list