[PATCH] D75527: [yaml2obj] - Add `ELFYAML::YAMLIntUInt` to fix how we parse a relocation `Addend` key.
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 17 03:01:25 PDT 2020
jhenderson accepted this revision.
jhenderson added a comment.
LGTM, with a couple of small nits.
================
Comment at: llvm/lib/ObjectYAML/ELFYAML.cpp:996
+ // We do not accept negative hex numbers for simplicity
+ // because perhaps nobody might want to them.
+ if (Scalar.empty() || Scalar.startswith("-0x"))
----------------
grimar wrote:
> I'll change this to "might want to use them".
Let's be more specific, since I think the real reason is that it is ambiguous what to do with them:
"We do not accept negative hex numbers because their meaning is ambiguous. For example, would -0xfffffffff mean 1 or INT32_MIN?"
================
Comment at: llvm/test/tools/yaml2obj/ELF/relocation-addend.yaml:7-8
-# RUN: yaml2obj %s -o %t1 -D ADDEND=9223372036854775807
-# RUN: llvm-readobj -r %t1 | FileCheck %s --check-prefix=MAX64
-# RUN: yaml2obj %s -o %t2 -D ADDEND=0x7FFFFFFFFFFFFFFF
-# RUN: llvm-readobj -r %t2 | FileCheck %s --check-prefix=MAX64
+## INT64_MIN == (-9223372036854775807i64 - 1)
+## UINT64_MAX == 0xffffffffffffffffui64
----------------
I don't think you need the i64/ui64 bits of the values.
Also, why not just `-9223372036854775808`?
================
Comment at: llvm/test/tools/yaml2obj/ELF/relocation-addend.yaml:72-73
-## Case 2.1: Document we accept an addend with the
-## value INT32_MAX = 2^31-1 = 0x7FFFFFFF = 2,147,483,647.
-
-# RUN: yaml2obj --docnum=2 %s -o %t4 -D ADDEND=2147483647
-# RUN: llvm-readobj -r %t4 | FileCheck %s --check-prefix=MAX32
-# RUN: yaml2obj --docnum=2 %s -o %t5 -D ADDEND=0x7FFFFFFF
-# RUN: cmp %t4 %t5
+## INT32_MIN == (-2147483647i32 - 1)
+## UINT32_MAX == 0xffffffffui32
----------------
Same as above.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75527/new/
https://reviews.llvm.org/D75527
More information about the llvm-commits
mailing list