NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/61079: ld compat linker warnings considered harmful



The following reply was made to PR toolchain/61079; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: Thomas Klausner <wiz%NetBSD.org@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost
Subject: Re: toolchain/61079: ld compat linker warnings considered harmful
Date: Thu, 26 Nov 2026 00:42:15 +0000

 > Date: Wed, 25 Nov 2026 20:00:00 +0000 (UTC)
 > From: "wiz%NetBSD.org@localhost via gnats" <gnats-admin%NetBSD.org@localhost>
 >=20
 > The (known) problem is that this linker warning also triggers when it
 > shouldn't, when libraries are pulled in indirectly and the functions
 > not even used by the program that (indirectly) links against them.
 
 Someone should really track down why ld(1) issues these warnings when
 there is no actual reference to the symbols in question!
 
 > RVP pointed out that --no-copy-dt-needed-entries seems to work around thi=
 s:
 >=20
 > https://mail-index.netbsd.org/tech-toolchain/2026/09/18/msg004903.html
 >=20
 > but I don't know if that's an appropriate solution or not.
 
 This is kind of a tangent and a much wider issue.  I suspect
 --no-copy-dt-needed-entries is probably reasonable but I am not sure I
 fully understand the change in semantics.  It should be discussed on
 tech-userlevel@, with a worked example of the change in semantics, to
 assess the impact, irrespective of whether it papers over the ld(1)
 warning bug.
 
 It's also certainly unfit for pullup to 10 or 11, so we'll have to
 live with workarounds until 13 is out and 11 is eol, whereas it's
 likely that we could safely pull up fixes to ld(1) (although I guess
 that won't help building against 10.0 and 11.0 with the spurious ld(1)
 warnings).
 
 > In short, a program just doing 'exit' is linked against libgssapi (or
 > libroken, both work), and the linker complains:
 >=20
 > # gcc -o a a.c -lgssapi
 > ld: /usr/lib/libutil.so.7: warning: warning: reference to compatibility l=
 ogin_getpwclass(); include <login_cap.h> for correct reference
 > [...]
 
 As a tangent on a tangent, libgssapi really shouldn't link against
 libutil at all -- that leaks various extremely nonportable NetBSDisms
 into the ELF namespace, for a library (libgssapi) that's supposed to
 be a reliable, standard, portable interface.  Leaking krb5_* symbols
 or rk_* symbols may be fine, but others like parsedate(), opendisk(),
 &c., are not.
 
 libgsspi pulls in libutil via libroken, which links against libutil
 only so that rk_pidfile() can call pidfile() -- which it does _in
 addition to_ writing the pidfile itself.  So libutil doesn't even
 serve any useful purpose for libroken.
 
 I will nix it (though this really requires a recursive major bump of
 everything that uses libroken, which also means unfit for pullup).
 



Home | Main Index | Thread Index | Old Index