This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
calling an undefined weak symbol
- From: "Metuki Sabhe" <sabhe dot metuki at gmail dot com>
- To: libc-alpha at sourceware dot org
- Date: Sun, 14 Oct 2007 23:13:16 +0200
- Subject: calling an undefined weak symbol
Hi list,
In the function __libc_start_main we have those two lines:
extern void __nptl_deallocate_tsd (void) __attribute ((weak));
__nptl_deallocate_tsd ();
If I understand correctly, the function will call __nptl_deallocate_tsd,
which will have the value of the __nptl_deallocate_tsd function
if libpthread will be linked in, or zero if not (because this is a weak
symbol).
But, if libpthread is not linked in, then __libc_start_main will call
a value of zero which will make a Segmentation Fault !
Can you please explain this to me (I don't really think glibc creates
a segfault, I am sure I missed something here) ?
Thank you all,
Metuki