This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: undefined symbols in shared libraries
On Thu, Mar 11, 2004 at 07:24:15PM -0800, H. J. Lu wrote:
> I think it meant to say executables and shared libraries instead of
> static binaries and dynamic binaries. You can't have unresolved
> references in dynamic binaries.
But you can. Even at runtime with lazy dynamic linking.
$ cat /src/tmp/hello.c
#include <stdio.h>
extern void undefined_func (void);
void foo (void)
{
undefined_func ();
}
int main (void)
{
printf ("Hello!\n");
return 0;
}
$ gcc -O2 -Wl,--warn-unresolved-symbols /src/tmp/hello.c
/tmp/ccM4Etbq.o(.text+0x5): In function `foo':
: warning: undefined reference to `undefined_func'
$ ./a.out
Hello!
This area of code has been patched before, and you're saying it is
now incorrect and needs yet another patch. Have you looked at the
history? I'm unwilling to approve your patch without some very solid
justification. Instead, I think the definition and use of
unresolved_syms_in_shared_libs and unresolved_syms_in_objects needs to
be looked at carefully rather than just making bandaid patches.
--
Alan Modra
IBM OzLabs - Linux Technology Centre