On Jan 25, 2006, at 8:49 PM, Mike Frysinger wrote:
we were playing with arrays of pointers to weak functions in a utility
program
when we noticed the code started crashing whenever built with a Gentoo
hardened toolchain. Gentoo vanilla toolchains would produce code that
ran
nicely and as expected. tracing it back, the references to the
undefined
weak functions were not being set to NULL as they should have been.
then we
reproduced the issue with a Gentoo vanilla toolchain by simply
building the
test code as a PIE. i'm not sure if this is an issue in gcc or glibc
ldso or
a bug at all (i'm pretty sure it's a bug), so i'm starting with gcc :)
Well please look at the code generation that GCC does. It is correct.
movq ptr_to_func(%rip), %rsi
-- Pinski