Added IgnoreUnknown parameter to parseArchString to allow objdump use this method without failing on unknown extensions
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I haven't found any reasons written in comments or docs why llvm-objdump couldn't take the attributes from elf file and decode all instructions without extra flags. Could you please have a look is this change can be valid?
llvm/test/tools/llvm-objdump/ELF/RISCV/unknown-arch-attr.test | ||
---|---|---|
13 | IMO objdump should just ignore features it doesn't know about and still decode whatever it knows about. It could still print a warning though. |
I've implement this before ( https://reviews.llvm.org/D125204), but I didn't find enough time to complete the error handle part, apparently this patch did better than mine in this part.
The only functional difference is this patch isn't ignore unsupported extension, feel free to take those part into your patch :)
I don't know how I missed this patch. @kito-cheng thanks you, if you aren't against I'll try merge these 2 patches.
if you aren't against I'll try merge these 2 patches.
I am happy to see that happen, just take anything you need from my patch :)
llvm/test/MC/RISCV/attribute-with-insts.s | ||
---|---|---|
5–8 ↗ | (On Diff #481279) | Not sure why this removed? I suppose this should still work as well after this patch? |
llvm/test/tools/llvm-objdump/ELF/RISCV/unknown-arch-attr.test | ||
3–4 | Those comment can keep now :) | |
13 | And this can drop now. | |
37–38 | Just note why this need change: arch string at least should be canonical order. |
llvm/lib/Object/ELFObjectFile.cpp | ||
---|---|---|
307 | s/version/extension/? | |
310 | This means a file that has, say, v0p7, will disassemble as v1p0 rather than being ignored like an extension whose name isn't known?.. | |
llvm/test/tools/llvm-objdump/ELF/RISCV/objdump.s | ||
9 ↗ | (On Diff #481279) | Fix |
llvm/test/tools/llvm-objdump/ELF/RISCV/unknown-arch-attr.test | ||
6 | This isn't true any more |
llvm/test/tools/llvm-objdump/ELF/RISCV/extensions.test | ||
---|---|---|
1 | Failed to apply this patch locally due to missing this file, are you forgot to add a precommit patch for this? |
llvm/lib/Object/ELFObjectFile.cpp | ||
---|---|---|
307 | It doesn't check version of experimental extensions only. The extension name is checked. | |
310 | If it's experimental extension yes. This can be changed to use more strict rules, but not sure that this is needed for experimental extensions. | |
llvm/test/tools/llvm-objdump/ELF/RISCV/extensions.test | ||
1 | I wasn't told not to load precommit patch at the same review. So yes, it exsits now only on my branch. I can't commit it in upstream, so I have asked a collegue to do this. Precommit patch wil be on master soon. |
llvm/test/tools/llvm-objdump/ELF/RISCV/extensions.test | ||
---|---|---|
1 | Precommit test on main branch https://github.com/llvm/llvm-project/commit/6827934ee0afcf9478f36291b3b5e947fe6d0036 |
LGTM for RISC-V part, but I would like let @MaskRay to give final approve since this patch also touch something other than RISC-V port.
ping, @MaskRay could you take a look for this, RISC-V part is LGTM, but this patch has modify something more than RISC-V, so I would like to make sure you are happy with those change too :)
Thanks! The intention LGTM to me as well, but the code style and tests need more work.
llvm/include/llvm/MC/SubtargetFeature.h | ||
---|---|---|
192 | addFeaturesVector Use ArrayRef if no need to be a vector | |
llvm/lib/Support/RISCVISAInfo.cpp | ||
580 | += 1 + ConsumeLength | |
llvm/test/tools/llvm-objdump/ELF/RISCV/objdump.s | ||
1 ↗ | (On Diff #481512) | drop < for llvm-mc |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
2007 | drop braces | |
llvm/tools/llvm-profgen/ProfiledBinary.cpp | ||
571 | (*...).xxx => -> |
The addition of IgnoreUnknown should be mentioned in the commit message / Differential summary. And mention who will be the users.
llvm/test/tools/llvm-objdump/ELF/RISCV/objdump.s | ||
---|---|---|
1 ↗ | (On Diff #481512) | objdump.s is not a good name. Add a file-level comment what this test is about. If you want to test that llvm-objdump by default decodes most instructions, add a few more instructions beside vsetvli (one instruction doesn't tell much). |
Looks great with some nits.
llvm/lib/Object/ELFObjectFile.cpp | ||
---|---|---|
305 | The common style doesn't add a blank line after a variable declaration. | |
llvm/test/tools/llvm-objdump/ELF/RISCV/objdump-instr-from-extensions.s | ||
1 ↗ | (On Diff #488568) | For binary utilities, new test/tools/llvm-* tests are supposed to use ## for non-RUN-non-CHECK lines. Nitpicking: objdump- in objdump-instr-from-extensions.s doesn't convey additional value as the test directory has llvm-objdump in the component. llvm-objdump isn't objdump (which usually refers to GNU objdump). Use the canonical name Tag_RISCV_arch. |
24 ↗ | (On Diff #488568) | IIUC vfwsub/vfrsub are in the same family and it's too useful to have more than one instructions in one family for the purpose of this test. Perhaps just keep vfsub.vv and delete all lines below (and the blank line above). |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
2007 | How does this work? Don't we need to somehow exit after reporting the error? Is there a test for this path? |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
2007 | Yep, true, missed this, thank you. I'll make a new review to fix this today. This is already merged. |
addFeaturesVector
Use ArrayRef if no need to be a vector