On Wed, Feb 18, 2026 at 04:22:12PM +0100, Rainer Orth wrote:
> Hi Jonathan,
> 
> >> Jakub explained to me that -flink-atomic is only enabled if the linker
> >> supports --as-needed, which the docs completely fail to explain. Just
> >> saying "on targets that support it" is inadequate.
> >>
> >> The option is on for targets which support libatomic *and* which
> >> support the --as-needed linker flag. So GNU ld,, gold, lld, mold, ...
> >> but *not* Solaris ld for example.
> >
> > Actually it looks like Solaris ld supports the option too ... but not
> > all linkers do, and that affects when -flink-libatomic is on by
> > default.
> 
> indeed: Solaris ld gained many options for compatiblity with GNU ld in
> the last couple of years.  If it were only for --as-needed, the native
> -z ignore should work, too.

Does it also support linker scripts where one can do -z ignore only for
selected library and not for the rest of the command line?
The GNU ld --push-state --as-needed ... --pop-state are very useful (but in
the end we went with libatomic_asneeded.so linker script with
INPUT ( AS_NEEDED ( -latomic ) )
because libtool doesn't handle the former well (nor the Solaris
-z ignore -latomic -z record, especially because the latter is much harder
to parse because the state isn't changed and restored but changed
twice for everything remaining on the command line, so libtool can't figure
out what belongs to what.

        Jakub

Reply via email to