I've splitted this from D64401.
It does not make sence to stop dumping the object if the broken
dynamic section was found. In this patch I changed the behavior from
"report an error" to "report a warning". This matches GNU.
Details
Diff Detail
Event Timeline
tools/llvm-readobj/ELFDumper.cpp | ||
---|---|---|
139 | Include sh_entsize in the warning? |
How about a test case that shows that more stuff can be printed after the aborted dynamic printing, perhaps using --all? Also, is there a risk that this will print the same warning more than once for the same section, if multiple options are used?
Working on that.
Also, is there a risk that this will print the same warning more than once for the same section, if multiple options are used?
Yes, it might do that. It can be fixed easily, for example DynRegionInfo can have a flag saying that region is not valid and so
we then can report a warning only once and set this flag. Though I am not sure this is a problem to report this warning in each place we were
unable to dump something too. I would not expect to see too many places and it makes the output very clear. I.e. it is visible
that there was no information dumped because of a particular error and not something else.
test/tools/llvm-readobj/elf-dynamic-malformed.test | ||
---|---|---|
16 | I think you've gone a bit over the top with this test case now. I think it's sufficient to test the context either side of each warning, and add --implicit-check-not=warning to ensure that you've caught them all. Something like: WARN: warning: invalid section size (4) or entity size (16) WARN-EMPTY: WARN-NEXT: File: WARN: Symbols [ WARN: ] WARN-EMPTY: WARN-NEXT: warning: invalid section size (4) or entity size (16) WARN-NEXT: ProgramHeaders You can follow a similar process with the GNU output. | |
127 | Why is there a warning here? I think it's where the dynamic table should be printed, in which case, please add a comment stating as such. | |
tools/llvm-readobj/llvm-readobj.cpp | ||
383 | I'm not sure this flush is needed, since errs() is unbuffered. |
LGTM, with one suggestion.
test/tools/llvm-readobj/elf-dynamic-malformed.test | ||
---|---|---|
173 | I'd be inclined to add WARN-NEXT: File: ... here to show the context of this warning. |
I think you've gone a bit over the top with this test case now. I think it's sufficient to test the context either side of each warning, and add --implicit-check-not=warning to ensure that you've caught them all. Something like:
You can follow a similar process with the GNU output.