summaryrefslogtreecommitdiff
path: root/binutils/config.in
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2022-03-16 09:01:36 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2022-03-16 09:01:43 -0400
commit2952f10cd79af4645222f124f28c7928287d8113 (patch)
treedf776596c24ec839cad957eebb14c4bd1b2c3b8c /binutils/config.in
parent28cdbb183bf80157a71d222b66abc38f32019f2d (diff)
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/config.in')
-rw-r--r--binutils/config.in3
1 files changed, 3 insertions, 0 deletions
diff --git a/binutils/config.in b/binutils/config.in
index e6fa66fc41..81bd143140 100644
--- a/binutils/config.in
+++ b/binutils/config.in
@@ -104,6 +104,9 @@
/* Define to 1 if you have a working `mmap' system call. */
#undef HAVE_MMAP
+/* Define to 1 if msgpack is available. */
+#undef HAVE_MSGPACK
+
/* Define to 1 if you have the `sbrk' function. */
#undef HAVE_SBRK