[gPXE-devel] Weak pxe_menu_boot()

Joshua Oreman oremanj at rwcr.net
Fri Jul 9 12:24:42 EDT 2010


On Fri, Jul 9, 2010 at 3:29 AM, Stefan Hajnoczi <stefanha at gmail.com> wrote:
> Richard Sandiford identified the issue: the compiler inlines
> pxe_menu_boot() because the symbol has visibility "hidden".  From
> include/compiler.h:
>
> /* Force visibility of all symbols to "hidden", i.e. inform gcc that
>  * all symbol references resolve strictly within our final binary.
>  * This avoids unnecessary PLT/GOT entries on x86_64.
>  *
>  * This is a stronger claim than specifying "-fvisibility=hidden",
>  * since it also affects symbols marked with "extern".
>  */
> #ifndef ASSEMBLY
> #if __GNUC__ >= 4
> #pragma GCC visibility push(hidden)
> #endif
> #endif /* ASSEMBLY */
>
> So although the function is extern, the pxe_menu_boot symbol has
> visibility "hidden" and the compiler decides inlining is okay, despite
> it being a weak symbol.  Add __attribute__((visibility("default"))) to
> pxe_menu_boot() to test this.
>
> It seems to me that gcc interprets "hidden" as "all symbol references
> resolve strictly within the compilation unit" rather than "all symbols
> references resolve strictly within our final binary".  Whether or not
> gcc changes its behavior, we need to solve this for gPXE so that it
> works on existing compilers.

Excellent job tracking this down. I wonder if
__attribute__((noinline)) would work as well?

-- Josh

> Stefan
> _______________________________________________
> gPXE-devel mailing list
> gPXE-devel at etherboot.org
> http://etherboot.org/mailman/listinfo/gpxe-devel
>


More information about the gPXE-devel mailing list