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

--- Comment #5 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Maciej W. Rozycki <[email protected]>:

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

commit e34fd4bfa6d748c05786850ef410eb1bd0ae4c22
Author: Maciej W. Rozycki <[email protected]>
Date:   Fri Feb 20 17:29:50 2026 +0000

    PR ld/24600: BFD: Add general linker support for mapless archives

    Expand linker mapless archive support from XCOFF targets only across the
    remaining ones, except for VMS targets whose archive format always has a
    symbol map.  For this tranform BFD code used by AR to produce symbol
    maps to archive files such as to have a handler supplied to either write
    a map to a file or convert symbol data to an archive symbol definition
    table attached to an archive BFD as if read from a symbol map, but using
    pointers to member BFDs rather than file offsets.  Retain XCOFF handling
    code as it is.

    Where the archive group feature is used a given archive may be opened
    multiple times in a single link.  If this happens then a reference to a
    symbol the definition of which is provided by said archive will change
    from undefined on the first access to the archive to defined on later
    accesses.  The symbol table is pulled from an archive only for undefined
    references, so if a symbol table has been pulled on first access and
    then dropped by on-the-fly symbol map generation on a subsequent access,
    then the symbol table is never re-read.  Later on when the linker wants
    to access it to actually resolve symbol references it won't have been
    reloaded and a crash would happen on a null pointer dereference.

    To prevent this from happening add code to `_bfd_compute_and_push_armap'
    to let the caller request the symbol table to be retained and ask for it
    when building a symbol map on the fly in the linker.  The symbol table
    will likely be used further down the link anyway.

    Additionally always check the format of the first member of an archive,
    even if no symbol map is present, and respect the format determined, so
    that the correct format is used even if it is not the default one the LD
    has been configured for, preventing segmentation faults from triggering
    in `cris-aout' LD with the default (`crisaout') emulation or with the
    `criself' emulation explicitly requested where archive members are in
    the ELF format and consequntly removing failures with new tests:

    cris-aout  -FAIL: CRIS regular archive w/o index link (explicit emulation)
    cris-aout  -FAIL: CRIS regular archive w/o index link (implicit emulation)
    cris-aout  -FAIL: CRIS thin archive w/o index link (explicit emulation)
    cris-aout  -FAIL: CRIS thin archive w/o index link (implicit emulation)

    Update documentation and adjust test cases accordingly now that mapless
    archives are accepted for link by all targets except for VMS ones, which
    never produce them in the first place.

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

Reply via email to