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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 07:46:39 PST 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: hiraditya, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
grimar added a parent revision: D75528: [yaml2obj][obj2yaml][test] - Add base tests for relocation addends..

This patch makes `Relocation::Addend` to be `ELFYAML::YAMLInt` and not `int64_t`.

`ELFYAML::YAMLInt` it is a new type and it has the following benefits/features:

1. For an 64-bit object any hex value is accepted.
2. For an 32-bit object any hex value in range [UINT32_MIN, UINT32_MAX] is accepted.
3. For decimal values: a) 64-bit case: accept any [INT64MIN, INT64MAX] value. b) 32-bit case: accept any [INT32MIN, INT32MAX] value.
4. It is printed as decimal. I.e. obj2yaml will print something like "Addend: 125", this matches the current behavior.

This fixes all FIXMEs in `relocation-addend.yaml`.


https://reviews.llvm.org/D75527

Files:
  llvm/include/llvm/ObjectYAML/ELFYAML.h
  llvm/lib/ObjectYAML/ELFYAML.cpp
  llvm/test/tools/yaml2obj/ELF/relocation-addend.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75527.247901.patch
Type: text/x-patch
Size: 7463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200303/e1c5369a/attachment.bin>


More information about the llvm-commits mailing list