These v3 patches address comments by Andrii and Arnaldo. 1. This uses a variadic macro and relies on a GNU extension. It can probably be reworked to not use this, with some effort. 2. I was following the original code that had aliases structs and pointers for the same data. I adjusted my code not to do this (later commits) and changed the existing occurrences in the same function (this commit). The net effect is clearer lifetime and ownership. 3. In a similar vein, the variable scn really only needed to be a loop-local iterator. 4. This removes the dependency on llvm-objcopy. 5. And we set the alignment on the seciton. I'm not posting the later patches that perform explicit ELF section layout and which (attempt) to also do things with ELF segments. Giuliano Procida (5): btf_encoder: Funnel ELF error reporting through a macro btf_encoder: Do not use both structs and pointers for the same data btf_encoder: Traverse sections using a for-loop btf_encoder: Add .BTF section using libelf btf_encoder: Align .BTF section to 8 bytes libbtf.c | 183 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 114 insertions(+), 69 deletions(-) -- 2.30.0.478.g8a0d178c01-goog