Efl: Add internal strong symbol to fix build on GCC < 5.3

This fixes a crash in ecore_init, calling a weak function from
libefl that was resolved to NULL.

So, here's a fun thing happening with GCC < 5.3. Since a1a506e13e
all EOAPI and EO class_get() functions are weak symbols. This means
that all APIs inside libefl.so are weak.

As a result, gcc linker with --as-needed skipped linking to libefl
since not a single strong symbol from libefl was required by
libecore. This is actually a bug in gcc linker since we do in fact
use symbols from libefl, just weak ones.

GCC 5.3 seems to be fixed, so people with GCC 5.3+ will not
experience any build/runtime issue. The current patch is
a workaround that bug, by artifically creating a strong symbol
required by ecore.

Other libraries than ecore might also need to call
__efl_internal_init, if they end up not being linked to libefl.
This commit is contained in:
Jean-Philippe Andre 2016-04-07 14:40:10 +09:00
parent 7b0d332e01
commit 4e4b42ec03
3 changed files with 12 additions and 0 deletions

View File

@ -210,6 +210,9 @@ ecore_init(void)
if (++_ecore_init_count != 1)
return _ecore_init_count;
/* make sure libecore is linked to libefl - workaround gcc bug */
__efl_internal_init();
setlocale(LC_CTYPE, "");
/*
if (strcmp(nl_langinfo(CODESET), "UTF-8"))

View File

@ -119,6 +119,9 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
#endif
/* work-around bug in gcc --as-needed link optimization */
EAPI void __efl_internal_init(void);
#if defined ( __cplusplus )
}
#endif

View File

@ -37,3 +37,9 @@ EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED =
#include "interfaces/efl_animator.eo.c"
#include "interfaces/efl_orientation.eo.c"
#include "interfaces/efl_flip.eo.c"
EAPI void
__efl_internal_init(void)
{
/* nothing to do, the symbol only is required for link to work */
}