This is first of a series that will enable to have an alternative dumping style for llvm-readobj tool. This particular patch prints output similar to readelf -h.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Hi. I have a question: is there anything in particular that bothers you about the format used currently by readobj? Can't you just use a script to do the postprocessing for you?
Hello Davide,
The present format is good enough to convey the information. It is however not sufficient or sometimes difficult for present users of GNU tools (which are quite ubiquitous) to make a switch as it is complete redesign of the post processing tools they may have based on.
-Hemant
I'm not necessarily against this, but I think the patch should be generic for all targets and I've highlighted an example of where it isn't. Instead of conditionals I think you might just want to abstract out the dumping mechanism as well.
Also, don't forget to add llvm-commits as a subscriber to your patch when you upload it so that email goes to the list right away.
-eric
tools/llvm-readobj/ELFDumper.cpp | ||
---|---|---|
723 | Example... |
What I have noticed is All enums are made to string as is in the LLVM style. However, GNU has different naming conventions such as "W" instead of SHF_WRITE string as is. This will cause a lot of code bloat. An easy solution is to store GNU flavor of string with usuale string inside
My browser submitted the comment before completion. Apologies.
Here is complete comment:
What I have noticed is all enums are made to string as is in the LLVM style. However, GNU has different naming conventions such as "W" instead of SHF_WRITE string as is. This will cause a lot of code bloat. An easy solution is to store GNU flavor of string with usual string inside
template<typename T> struct EnumEntry { StringRef Name; T Value; };
Any thoughts on this?
Instead of conditionals I think you might just want to abstract out the dumping mechanism as well.
Can you explain this a bit more.
-Hemant
tools/llvm-readobj/StreamWriter.h | ||
---|---|---|
324 | This is unnecessary. Formatted raw stream is a better fit. Next patch will make use of that. |
tools/llvm-readobj/ELFDumper.cpp | ||
---|---|---|
2219 | Some versions of Cygwin apparently have newlib that do not support std::to_string. There needs to be a change to remove these calls. |
Some inline comments.
tools/llvm-readobj/ELFDumper.cpp | ||
---|---|---|
1058–1061 | Can we get these two things to use the same interface? | |
2219 | Is this an issue for any targets we have a bot for? | |
tools/llvm-readobj/StreamWriter.cpp | ||
15 | Just use stringstream here? | |
tools/llvm-readobj/StreamWriter.h | ||
29 | More descriptive/comment relating it to the option would be good. |
tools/llvm-readobj/ELFDumper.cpp | ||
---|---|---|
2219 | Yes. There are a couple of cygwin bots I believe. I found this when I checked this commit: |
One inline comment that'll require a bit of reworking, but otherwise LGTM for now.
Thanks!
-eric
tools/llvm-readobj/ELFDumper.cpp | ||
---|---|---|
2181 | Ugh. | |
tools/llvm-readobj/llvm-readobj.h | ||
45 ↗ | (On Diff #47264) | Hate to ask at the last minute but can you make this an enum (admittedly with two choices) so that the checks in the code are positive? (e.g. OutputStyle == GNU and OutputStyle == LLVM) |
tools/llvm-readobj/llvm-readobj.h | ||
---|---|---|
45 ↗ | (On Diff #47264) | Sure. |
Example...