Currently, llvm-objdump prints "unknown" instead of d_tag value in hex format. Because getDynamicTagAsString returns "unknown" rather than empty
string.
Details
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 28663 Build 28662: arc lint + arc unit
Event Timeline
tools/llvm-objdump/ELFDump.cpp | ||
---|---|---|
178–179 | Should getDynamicTagAsString just return nullptr on unknown flag maybe? @jhenderson, what do you think? |
tools/llvm-objdump/ELFDump.cpp | ||
---|---|---|
178–179 | There are several functions that return "unknown". I am not so confident to change those codes in /lib. In my opinion, I think those should return "". |
tools/llvm-objdump/ELFDump.cpp | ||
---|---|---|
178–179 | I'd say neither is the right thing to do. I actually think just printing the hex number is not good enough. I think it should be something like <unknown:>0x12345678, and I would highly recommend doing that inside getDynamicTagAsString(). It seems rather odd to be comparing against "unknown". The alternative would be to change the interface to return an Optional<> instead of a string, but the name of the function just makes me think I wouldn't need to do anything with the output at all. |
LGTM, assuming the case printing is correct, and the two other small comments are addressed.
lib/Object/ELF.cpp | ||
---|---|---|
473 | This prints the hex digits as lower-case. Does that match what the rest of the llvm-objdump printing does? | |
test/tools/llvm-objdump/elf-dynamic-section.test | ||
61 | Maybe worth adding a hex digit to the tag value, to show upper/lower case behaviour. | |
tools/llvm-objdump/ELFDump.cpp | ||
179 | As we're messing about with different string types (const char *, std::string, StringRef etc), it's probably best to not use auto here. |
Addressed @jhenderson 's comment
- Change auto to std::string
- Update test case to make sure that hex values are printed in lower case. (Match GNU objdump's output)
This prints the hex digits as lower-case. Does that match what the rest of the llvm-objdump printing does?