[PATCH 2/3] bfd/ELF: Retain strong undefined symbols under -z dynamic-undefined-weak

Jan Beulich jbeulich@suse.com
Fri Aug 22 08:16:37 GMT 2025


On 16.07.2025 18:03, Hakan Candar wrote:
> Add `bfd_is_undef_symbol` macro for clarity and consistency across
> backends. Adjust symbol hiding and dynamic marking logic in elflink.c
> to treat undefined strong symbols the same as weak ones when applying
> retention rules.
> 
> This improves alignment with the gABI and LLD behavior, especially
> under `-z [no]dynamic-undefined-weak`. Backends that already respected
> this logic (e.g., x86_64, ppc) show no regressions, and can now retain
> strong undefined symbols as dynamic relocations via -z dynamic-undefined-weak.

What does -z dynamic-undefined-weak have to do with strong undefined symbols?
(I guess there is simply some context missing here, but I'd like to understand
that before looking at the patch itself.)

Jan

> Some backends that previously did not support `-z [no]dynamic-undefined-weak`
> (e.g., aarch64, mips, riscv) now follow the shared logic correctly as
> described above, enabling dynamic relocations for strong undefineds.
> 
> Other backends (e.g., sh4, m68k) do not yet respect the centralized
> behavior and continue to prune undefined symbols unconditionally due
> to backend-specific conditionals. These will be addressed incrementally.


More information about the Binutils mailing list