[PATCH] D59095: [llvm-readelf]Don't lose negative-ness of negative addends for no symbol relocations
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 8 01:44:58 PST 2019
jhenderson marked 2 inline comments as done.
jhenderson added a comment.
Thanks all. I am already planning a number of follow-up changes to fix the issues re. consistent formatting and the LLONG_MIN comment. This particular issue however is something I needed more urgently, so wanted to fix first.
================
Comment at: tools/llvm-readobj/ELFDumper.cpp:2735
+ Addend = " - ";
+ RelAddend = std::abs(RelAddend);
+ } else
----------------
MaskRay wrote:
> If `r_addend = LLONG_MIN`, `abs(r_addend)` is ub...
>
> "The behavior is undefined if the result cannot be represented by the return type."
Yes, it is. But it's already a problem, so I'd like to fix this separately, if that's okay?
================
Comment at: tools/llvm-readobj/ELFDumper.cpp:3401
+ }
+ Addend += to_string(format_hex_no_prefix(RelAddend, 1));
}
----------------
Higuoxing wrote:
> Can we use `to_hexString(RelAddend, false)` here? I think it's better to have consistent code style.
Would you mind if I do this in a later patch? I'm looking to try to share the code for `printRelocation` and `printDynamicRelocation`, since they're almost identical anyway, and this would be one of the changes I'm planning on then.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59095/new/
https://reviews.llvm.org/D59095
More information about the llvm-commits
mailing list