Undefined weak symbols stay undefined

Momchil Velikov velco@fadata.bg
Tue Nov 25 09:57:00 GMT 2003


$ cat x.c
extern int foo () __attribute__ ((weak));

int
main ()
{
  if (foo)
    foo ();

  return 0;
}
$ gcc -static x.c
$ readelf -s a.out | grep foo
  1257: 00000000     0 NOTYPE  WEAK   DEFAULT  UND foo

  Aren't undefined weak symbols supposed to be _defined_ to zero by
the linker, probably putting them in SHN_ANS ?

~velco

PS. This is binutils 2.14 20030612.



More information about the Binutils mailing list