diff options
author | 2022-03-16 09:01:36 -0400 | |
---|---|---|
committer | 2022-03-16 09:01:43 -0400 | |
commit | 2952f10cd79af4645222f124f28c7928287d8113 (patch) | |
tree | df776596c24ec839cad957eebb14c4bd1b2c3b8c /binutils/ChangeLog | |
parent | binutils/readelf: handle NT_AMDGPU_METADATA note name (diff) | |
download | binutils-gdb-2952f10cd79af4645222f124f28c7928287d8113.tar.gz binutils-gdb-2952f10cd79af4645222f124f28c7928287d8113.tar.bz2 binutils-gdb-2952f10cd79af4645222f124f28c7928287d8113.zip |
binutils/readelf: build against msgpack, dump NT_AMDGPU_METADATA note contents
The AMDGPU HSA OS ABI (code object v3 and above) defines the
NT_AMDGPU_METADATA ELF note [1]. The content is a msgpack object
describing, among other things, the kernels present in the code object
and how to call them.
I think it would be useful for readelf to be able to display the content
of those notes. msgpack is a structured format, a bit like JSON, except
not text-based. It is therefore possible to dump the contents in
human-readable form without knowledge of the specific layout of the
note.
Add configury to binutils to optionally check for the msgpack C library
[2]. Add There is a new --with{,out}-msgpack configure flag, and the actual
library lookup is done using pkg-config.
If msgpack support is enabled, dumping a NT_AMDGPU_METADATA note looks
like:
$ readelf --notes amdgpu-code-object
Displaying notes found in: .note
Owner Data size Description
AMDGPU 0x0000040d NT_AMDGPU_METADATA (code object metadata)
{
"amdhsa.kernels": [
{
".args": [
{
".address_space": "global",
".name": "out.coerce",
".offset": 0,
".size": 8,
".value_kind": "global_buffer",
},
<snip>
If msgpack support is disabled, dump the contents as hex, as is done
with notes that are not handled in a special way. This allows one to
decode the contents manually (maybe using a command-line msgpack
decoder) if really needed.
[1] https://llvm.org/docs/AMDGPUUsage.html#code-object-metadata
[2] https://github.com/msgpack/msgpack-c/tree/c_master
binutils/ChangeLog:
* Makefile.am (readelf_CFLAGS): New.
(readelf_LDADD): Add MSGPACK_LIBS.
* Makefile.in: Re-generate.
* config.in: Re-generate.
* configure: Re-generate.
* configure.ac: Add --with-msgpack flag and check for msgpack
using pkg-config.
* readelf.c: Include msgpack.h if HAVE_MSGPACK.
(print_note_contents_hex): New.
(print_indents): New.
(dump_msgpack_obj): New.
(dump_msgpack): New.
(print_amdgpu_note): New.
(process_note): Handle NT_AMDGPU_METADATA note contents.
Use print_note_contents_hex.
Change-Id: Ia60a654e620bc32dfdb1bccd845594e2af328b84
Diffstat (limited to 'binutils/ChangeLog')
-rw-r--r-- | binutils/ChangeLog | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ea132260e67..eb8c1975837 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,5 +1,23 @@ 2022-03-16 Simon Marchi <simon.marchi@efficios.com> + * Makefile.am (readelf_CFLAGS): New. + (readelf_LDADD): Add MSGPACK_LIBS. + * Makefile.in: Re-generate. + * config.in: Re-generate. + * configure: Re-generate. + * configure.ac: Add --with-msgpack flag and check for msgpack + using pkg-config. + * readelf.c: Include msgpack.h if HAVE_MSGPACK. + (print_note_contents_hex): New. + (print_indents): New. + (dump_msgpack_obj): New. + (dump_msgpack): New. + (print_amdgpu_note): New. + (process_note): Handle NT_AMDGPU_METADATA note contents. + Use print_note_contents_hex. + +2022-03-16 Simon Marchi <simon.marchi@efficios.com> + * readelf.c (get_amdgpu_elf_note_type): New. (process_note): Handle "AMDGPU" notes. |