https://sourceware.org/bugzilla/show_bug.cgi?id=33194

--- Comment #11 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nick Alcock <n...@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d3e582895b2038feb47b68f1e03efaa0d9dae325

commit d3e582895b2038feb47b68f1e03efaa0d9dae325
Author: Nick Alcock <nick.alc...@oracle.com>
Date:   Wed Jul 23 14:20:26 2025 +0100

    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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to