[llvm] Add --offoading option to llvm-readobj (PR #143342)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 15 01:55:10 PDT 2025
https://github.com/jh7370 commented:
> Response to the comment about Testing for Err, or reportWarning above ([#143342 (comment)](https://github.com/llvm/llvm-project/pull/143342#discussion_r2209696282)). for some reason github is not letting me "reply" to this comment. So I'm going to reply here.
>
> I totally agree that we should have error condition checking tests. I'm a bit limited in what error conditions I can check, because of the limitation in yaml2obj. Like I can't really test when the metadata in the Bundle header is wrong/missing (e.g. number of Entries doesn't match actual number of entries, or size of an entry isn't a valid value, etc). But I can test for big errors, like the offload bundle section doesn't contain any Magic string, or the API just fails entirely to read the offload section. I'll tests for that in a new patch shortly.
I suspect the best way to do this would be to enhance yaml2obj further (possibly after adding basic offloading section support of course), to allow modifying fields. There are good examples in the ELF yaml2obj code of fields that can be used for testing these edge cases, for example setting the sh_offset field of a section header to a value, but having the data somewhere else.
https://github.com/llvm/llvm-project/pull/143342
More information about the llvm-commits
mailing list