[PATCH] D75527: [yaml2obj] - Add `ELFYAML::YAMLInt` to fix how we parse a relocation `Addend` key.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 09:42:40 PST 2020


MaskRay added a comment.

> For decimal values: a) 64-bit case: accept any [INT64MIN, INT64MAX] value. b) 32-bit case: accept any [INT32MIN, INT32MAX] value.

It should probably accept the union of int32_t and uint32_t, i.e. [-2147483648, 4294967295]. Examples: R_AARCH64_ABS32, R_AARCH64_PREL32, R_PPC64_ADDR64.

Not all relocation types behave this way, but we can treat all relocations the same way and be permissive here.

See https://github.com/llvm/llvm-project/blob/master/lld/ELF/Target.h#L223 `checkIntUInt`



================
Comment at: llvm/lib/ObjectYAML/ELFYAML.cpp:998
+    // Do not allow "-0xFE". It looks strange.
+    if (Scalar.drop_front().startswith("0x"))
+      return ErrMsg;
----------------
Not very necessary, I think.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75527/new/

https://reviews.llvm.org/D75527





More information about the llvm-commits mailing list