This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Misleading linker message
- From: "H . J . Lu" <hjl at lucon dot org>
- To: binutils at sourceware dot cygnus dot com
- Date: Fri, 30 Nov 2001 13:20:43 -0800
- Subject: Misleading linker message
# cat foo.c
extern void bar ();
void (*func) () = bar;
_start ()
{
}
# gcc -g foo.c -c
# ld -o static foo.o
foo.o: In function `_start':
/home/hjl/bugs/gas/discard3/foo.c:6: undefined reference to `bar'
The line number is totally wrong. In the case of the Linux kernel, ld
reports the undefined reference in a totally unrelated source file.
# gcc foo.c -c
# ld -o static foo.o
foo.o(.data+0x0): undefined reference to `bar'
This one is more useful.
H.J.