[PATCH] D14957: [ELF/AArch64] Fix overflow checks for R_AARCH64_{ABS, PREL}{16, 32} relocations.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 15:55:54 PST 2015


ruiu added inline comments.

================
Comment at: ELF/Target.cpp:58-59
@@ +57,4 @@
+template <unsigned N>
+static void checkIsIntOrUInt(uint64_t Val, uint32_t Type) {
+  if (!isInt<N>(Val) && !isUInt<N>(Val))
+    error("Relocation " + getELFRelocationTypeName(Config->EMachine, Type) +
----------------
checkIsIntOrUint -> checkIntUint

  if (isInt<N>(V) || isUInt<N>(V))
    return;
  StringRef S = getELFRelocationTypeName(Config->EMachine, Type);
  error("Relocation " + S +" out of range");

================
Comment at: ELF/Target.cpp:58-59
@@ +57,4 @@
+template <unsigned N>
+static void checkIsIntOrUInt(uint64_t Val, uint32_t Type) {
+  if (!isInt<N>(Val) && !isUInt<N>(Val))
+    error("Relocation " + getELFRelocationTypeName(Config->EMachine, Type) +
----------------
By the way, is isInt<N> correct? Isn't that isInt<N-1>?


http://reviews.llvm.org/D14957





More information about the llvm-commits mailing list