[PATCH] D74023: [RISCV] ELF attribute section for RISC-V

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 29 07:35:49 PST 2020


HsiangKai marked an inline comment as done.
HsiangKai added inline comments.


================
Comment at: llvm/lib/Object/ELFObjectFile.cpp:308
+      default:
+        llvm_unreachable("Unknown extension in Arch attribute.");
+      case 'i':
----------------
HsiangKai wrote:
> jhenderson wrote:
> > jhenderson wrote:
> > > HsiangKai wrote:
> > > > MaskRay wrote:
> > > > > The `defualt` branch is still reachable, thus it is incorrect to use llvm_unreachable.
> > > > > You may want to return an Error.
> > > > Encoding part only accepts `iemafdc`. Decoding part should expect these features only. Default case should be unreachable.
> > > Is it unreachable if somebody provides an invalid binary (i.e. with something incorrectly encoded)? Decoding needs to handle invalid binaries without crashing on an llvm_unreachable.
> > Please add a test case for an unknown letter.
> I will add a test for it later.
Add a test case `llvm/test/tools/llvm-readobj/ELF/RISCV/unknown-arch-attr.test`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74023/new/

https://reviews.llvm.org/D74023





More information about the llvm-commits mailing list