binutils-gdb/libctf
Nick Alcock 2b2e51a31e
libctf: link: rejig lazy opening to not need weak symbols
The ctf_link_add_ctf API function has a 'lazy opening' feature whereby,
if you pass in the file but not a CTF archive, the archive is opened
as late as possible during links.  This is valuable mostly in
cu-mapped links (a feature not accessible via GNU ld), where it
ensures that, rather than eventually needing memory for the original
link inputs, the smushed-together cu-mapped intermediate outputs,
*and* the final output, we only need enough memory for the smushed-
together outputs, the final output, and one input, since the inputs
can be closed immediately after they are smushed together.

(In GNU ld, the feature is useless because it loads all sections into
memory anyway.)

The lazy-opening feature uses libctf's ctf_open function, which uses
BFD: so it is not available in libctf-nobfd -- except that I thought I
had a cunning trick, and used a weak symbol so that if you linked
libctf-nobfd into your program and then also linked in bfd, the feature
stayed enabled.

This is silly -- if your program is licensed such that you can link in
BFD, you can just link in libctf.so and not bother with libctf-nobfd.so
in the first place.  Worse, the weak symbol usage broke MacOS builds,
since MacOS's system compiler uses a different means of introducing weak
symbols.  We could test for and use it, but this is the only place in
libctf to use weak symbols at all, and the feature of lazy-opening with
libctf-nobfd is so marginal we might as well drop it: it's almost
certain there are zero users, certainly fewer users than users of MacOS
with the system compiler.

While we're at it, simplify things by deleting the never-implemented
feature (not exposed in the API) to allow linking together raw buffers
of CTF data.  If we need it we can bring it back, but all it's doing
right now is complicating the code to no end at all.

libctf/
	PR libctf/33194
	* ctf-link.c (ctf_open): Delete weak pragma.
	(ctf_link_add): Fuse with...
	(ctf_link_add_ctf): ... this function.  Drop BUF, N args
	and corresponding unimplemented feature warnings.  Only check
	NOBFD to see whether lazy loading is available, not PIC as
	well.
	(ctf_link_lazy_open): Likewise.

(cherry picked from commit d3e582895b)
2025-08-10 22:19:50 +01:00
..
doc libctf: doc: add __float128 and SIMD vector classification to spec. 2025-07-01 15:54:27 +01:00
testsuite libctf: don't run tests requiring deduplicating linker unless one is in use 2025-08-10 22:19:46 +01:00
.gitignore libctf: restructure error handling to reduce relocations 2020-07-22 17:57:20 +01:00
aclocal.m4 mmap: Avoid the sanitizer configure check failure 2024-04-10 03:57:46 -07:00
ChangeLog Add markers for 2.45 branch 2025-07-13 08:35:45 +01:00
ChangeLog-2020 libctf: fix old ChangeLog typo 2021-01-05 14:53:40 +00:00
config.h.in libctf: suppress spurious failure of malloc-counting tests under valgrind 2024-06-18 13:20:32 +01:00
configure libctf: get libctf-nobfd.ver from the right place with Solaris ld 2025-08-10 22:19:37 +01:00
configure.ac libctf: get libctf-nobfd.ver from the right place with Solaris ld 2025-08-10 22:19:37 +01:00
ctf-archive.c libctf: archive, open: when opening, always set errp to something 2025-05-23 12:34:35 +01:00
ctf-create.c libctf: create: check the right root-visible flag when adding enumerands 2025-07-01 15:54:27 +01:00
ctf-decl.c Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-decls.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-dedup.c libctf, dedup: reclaim space wasted by duplicate hidden types 2025-06-04 12:51:28 +01:00
ctf-dump.c Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-endian.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-error.c Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-hash.c libctf: dedup: preserve non-root flag across normal links 2025-06-04 12:51:25 +01:00
ctf-impl.h libctf: use __attribute__((__gnu_printf__)) where appropriate 2025-06-04 12:51:29 +01:00
ctf-inlines.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-intl.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-labels.c Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-link.c libctf: link: rejig lazy opening to not need weak symbols 2025-08-10 22:19:50 +01:00
ctf-lookup.c Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-open-bfd.c Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-open.c libctf: archive, open: when opening, always set errp to something 2025-05-23 12:34:35 +01:00
ctf-qsort_r.c Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-serialize.c libctf: exclude always-emitted Solaris symbols from the symtypetab 2025-08-10 22:19:42 +01:00
ctf-sha1.c Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-sha1.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-string.c Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-subr.c Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
ctf-types.c libctf: fix cv-qualified unnamed struct/union field lookup 2025-02-28 14:16:42 +00:00
ctf-util.c Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
elf.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
libctf.ver Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
Makefile.am Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
Makefile.in Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
NEWS include, libctf, ld: extend variable section to contain functions too 2022-03-23 13:48:32 +00:00
swap.h Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30