Relicensing (most of) binutils/libctf to LGPLv3+?

Nick Alcock nix@esperi.org.uk
Sat May 9 18:12:21 GMT 2026


[Restarting this conversation after a long pause]

(This clearer text largely due to Jose Marchesi, Cc:ed above.)

CTF [1] is a file format representing the C type system.  Similar to DWARF,
it is intended for debugging purposes, and also to be used by tracers and
other programs: for introspection, ABI analysis, and similar purposes.

GCC can emit CTF into .ctf sections of generated code to represent the
type system of C translation units it generates.  Thus, when GCC compiles
a source file and is told to generate CTF for it, like in:

  $ gcc -gctf foo.c

it then includes a section called .ctf within the resulting foo.o file, with
the CTF that represents the types defined and used by foo.c.

libctf, part of the GNU binutils, is a library that reads, manipulates
and writes CTF, and soon BTF too. The main users of libctf are the
different binutils tools themselves. In particular the linker uses it to
read and deduplicate CTF of input objects in a link operation and to
write the resulting CTF in the output executable or shared object.
Additionally, since libctf is installed by binutils, external programs
can also use it in order to access and manipulate CTF data.

libctf is split into two pieces:

- libctf.so, which used libbfd to read ELF executables.
  It is licensed as GPLv3+, and will remain so.

- libctf-nobfd.so, which does not link to libbfd nor any other binutils
  libraries but for libiberty and, on some platforms, zlib and dlibintl.
  It is licensed as GPLv3+.

What we are asking to do is to relicense libctf-nobfd.so from GPLv3+ to LGPL3+.

The most important reasons are:

+ The Linux kernel needs to consume and manipulate BTF as part of its
  build, and we have work in progress to deduplicate this using programs
  in the kernel build system that link to libctf. The build system of
  the kernel is GPLv2.

+ The clang compiler also will have to generate CTF and would benefit
  from using libctf.  Clang is Apache 2.0 plus LLVM exceptions.

+ I hope in future to optionally link to this in some programs
  distributed as part of glibc as part of automatic runtime ABI mismatch
  detection. glibc is, of course, largely LGPL2.1+.

[1] https://sourceware.org/binutils/docs/ctf-spec.html


More information about the Binutils mailing list