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

Re: compiling without -O2 ld shared lib errors



On 8 April 2011 20:11, Simon McVittie <smcv@debian.org> wrote:
You can work around it with -Wl,--add-needed in LDFLAGS, or fix it properly
by including -lheimntlm in the LIBADD/LDADD for whatever you're linking.

Thanks. Thought this might be the case.

However, that doesn't explain why it magically when compiling with -02. Are linker rules relaxed when they see code compiled with -O2? It doesn't make a lot of sense to me.

Unless maybe -O2 removes the entire function that references this symbol, because it is is not used anywhere... Hmmm.... Might have worked this out myself :-)

./kdc/digest-service.c:
=== cut ===
static void
ntlm_service(...)
{
[...]
ret = heim_ntlm_calculate_ntlm1(...)
[...]
}

[...]
int
main(int argc, char **argv)
{
[...]
#if __APPLE__
    {
        heim_sipc mach;
        heim_sipc_launchd_mach_init("org.h5l.ntlm-service",
                                    ntlm_service, context, &mach);
        heim_sipc_timeout(60);
    }
#endif
[...]
}
=== cut ===

Am thinking the best solution might be to wrap the entire ntlm_service function with the same #if __APPLE__ ... #endif, as that appears to be the only reference to ntlm_service, and I think the static definition means it can't be referenced externally.
--
Brian May <brian@microcomaustralia.com.au>

Reply to: