diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2025-07-23 14:20:26 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2025-07-28 13:30:47 +0100 |
commit | d3e582895b2038feb47b68f1e03efaa0d9dae325 (patch) | |
tree | 793bcf75305946970f3fb7d095e071594bc08150 /libctf/testsuite/libctf-writable/libctf-errors.c | |
parent | 8fbfec1180e1db1d22a0e47162f4bbf96bca365c (diff) | |
download | binutils-d3e582895b2038feb47b68f1e03efaa0d9dae325.zip binutils-d3e582895b2038feb47b68f1e03efaa0d9dae325.tar.gz binutils-d3e582895b2038feb47b68f1e03efaa0d9dae325.tar.bz2 |
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.
Diffstat (limited to 'libctf/testsuite/libctf-writable/libctf-errors.c')
0 files changed, 0 insertions, 0 deletions