[RFC] libsframe: add local sframe-swap.h header

Nix nix@esperi.org.uk
Mon Aug 24 12:58:33 GMT 2026


On 17 Aug 2026, Indu Bhagat stated:

> Currently libsframe includes libctf/swap.h for byteswapping functions.
> This cross-directory inclusion of a private header leads to build
> conflicts during in-tree builds when both libsframe/config.h and
> libctf/config.h are present, causing duplicate macro warnings (More
> details at
> https://inbox.sourceware.org/binutils/27dfa5e4c684cfdd773e207e8022234109eb1b91.1786465076.git.aburgess@redhat.com/T/#u).
>
> To completely decouple libsframe from libctf, add a local header
> libsframe/sframe-swap.h containing the byte-swapping utility functions,
> and remove the -I/../libctf from libsframe/Makefile.am.

There is no -I/../libctf there. (Yes, I am being ridiculously pedantic.)

> libsframe/
> 	* Makefile.am (AM_CPPFLAGS): Remove -I/../libctf.

Ditto.

> diff --git a/libsframe/sframe-swap.h b/libsframe/sframe-swap.h
> new file mode 100644
> index 00000000000..ebe7865f8e9
> --- /dev/null
> +++ b/libsframe/sframe-swap.h
> @@ -0,0 +1,94 @@
> +/* Interface to byteswapping functions for libsframe.

I'm not sure, but you might possibly be able to keep all the advantages
of this change while avoiding all the code duplication by just making
this file

#include "../libctf/swap.h"

while keeping everything else in this change the same. (glibc does this
sort of thing a lot.)

-- 
NULL && (void)


More information about the Binutils mailing list