Re: ld compat linker warnings considered harmful
Greg Troxel <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.toolchain |
|---|---|
| Message-ID | <[email protected]> |
Thomas Klausner <[email protected]> writes: > In short, a program just doing 'exit' is linked against libgssapi (or > libroken, both work), and the linker complains: > > # gcc -o a a.c -lgssapi > ld: /usr/lib/libutil.so.7: warning: warning: reference to compatibility login_getpwclass(); include <login_cap.h> for correct reference > ld: /usr/lib/libutil.so.7: warning: warning: reference to compatibility pw_scan(); include <pwd.h> to generate correct reference > ld: /usr/lib/libutil.so.7: warning: warning: reference to compatibility loginx(); include <util.h> to generate correct reference > ld: /usr/lib/libutil.so.7: warning: warning: reference to compatibility parsedate(); include <util.h> for correct reference > ld: /usr/lib/libutil.so.7: warning: warning: reference to compatibility pw_copyx(); include <util.h> to generate correct reference > ld: /usr/lib/libutil.so.7: warning: warning: reference to compatibility pw_getpwconf(); include <pwd.h> to generate correct reference > ld: /usr/lib/libutil.so.7: warning: warning: reference to compatibility login(); include <util.h> to generate correct reference > ld: /usr/lib/libutil.so.7: warning: warning: reference to compatibility setusercontext(); include <login_cap.h> for correct reference > ld: /usr/lib/libutil.so.7: warning: warning: reference to compatibility pw_copy(); include <util.h> to generate correct reference > > No function from gssapi (or roken) is called, so nothing can call > libutil and need the compat header. The core issue seems to be that libutil really does refer to __login_getpwclass50, or at least nm says it does. login_cap.h says #ifndef __LIBC12_SOURCE__ login_cap_t *login_getpwclass(const struct passwd *) __RENAME(__login_getpwclass50); #endif I'm having trouble following the plan; it's not explained in login_getpwclass. FWIW, I don't get this warning on NetBSD 10. I do on current. I also don't follow how the exit-only program including login_cap.h would change the library, and adding that include to the exit-only program doees suppress the warning. It seems obvious that we need to have a way to mark these compatibiliy references in libraries as something that should not be warned about, while retaining the warning if user code refers to the old symbol. And that it's merely a SMOP to do that. I am probably missing something.