Match GNU objdump.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 33893 Build 33892: arc lint + arc unit
Event Timeline
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
451 | I remember @jhenderson said the warning order did not matter. Then, why don't we use the simpler for (StringRef S : MissingSections)? |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
451 | Yes, exactly. I don't see a particular reason to follow GNU on warning ordering or even text, as long as what we say makes sense. |
By the way, you've got a double-negative in your patch title: "Warn if no user specified sections (-j) are not found.". I think you can get rid of the "not".
llvm/test/tools/llvm-objdump/warn-missing-section.test | ||
---|---|---|
22 | This comment needs an update now. | |
64 | You do not need Content and Flags here and below I think. | |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
349 | I'd add a comment explaining when String can be empty. | |
443 | Instead, can you report a warning right here? for (StringRef S : FilterSections) { if (FoundSectionSet.count(S)) return; warn("section '" + S + "' mentioned in a -j/--section option, but not " "found in any input file"); } |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
443 | Ah, nevermind. I see why you can't now. Please ignore this comment. |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
447 | Nit: auto -> StringRef |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
351 | Nit: The SHT_NULL... But really, does this actually matter? I think it's harmless having it in the list right? Happy for it to go in, if there's a good reason, or with this case removed. |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
351 | I think you meant the section with index 0 does not have a name. |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
351 | Thank you. I should have been more clear here. The reason is that StringSet does not allow empty keys (assertion) and section 0 has no name. Comment updated. |
Not that I think it is a likely case, but does GNU objdump allow -j with an empty section name? In other words, can you do this: objdump -D -j "" test.o to dump the contents of all unnamed sections, for example? Since the section index 0 section always has no name, we don't need to (and shouldn't) warn for this case, so we need a test for that too.
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
351 | Actually, it's theoretically valid for other sections to have no name too, so perhaps the comment needs updating to say "so avoid adding sections with no name (such as the section with index 0) here". I'd also recommend making the index term explicit like I just did. |
This comment needs an update now.