Hi, On 7 April 2016 at 14:49, Jean-Philippe ANDRÉ <[email protected]> wrote:
> jpeg pushed a commit to branch master. > > > http://git.enlightenment.org/core/efl.git/commit/?id=4e4b42ec036b1bda45879c1c4141b56106546373 > > commit 4e4b42ec036b1bda45879c1c4141b56106546373 > Author: Jean-Philippe Andre <[email protected]> > Date: Thu Apr 7 14:40:10 2016 +0900 > > 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 a1a506e13e2 > 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 should fix the build for Ubuntu users. For more information, refer to this thread: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32511 > --- > src/lib/ecore/ecore.c | 3 +++ > src/lib/efl/Efl.h | 3 +++ > src/lib/efl/interfaces/efl_interfaces_main.c | 6 ++++++ > 3 files changed, 12 insertions(+) > > diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c > index d7eead3..6c326a7 100644 > --- a/src/lib/ecore/ecore.c > +++ b/src/lib/ecore/ecore.c > @@ -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")) > diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h > index 2002ebc..4cc909a 100644 > --- a/src/lib/efl/Efl.h > +++ b/src/lib/efl/Efl.h > @@ -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 > diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c > b/src/lib/efl/interfaces/efl_interfaces_main.c > index 908e228..68ff6f3 100644 > --- a/src/lib/efl/interfaces/efl_interfaces_main.c > +++ b/src/lib/efl/interfaces/efl_interfaces_main.c > @@ -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 */ > +} > > -- > > > -- Jean-Philippe André ------------------------------------------------------------------------------ _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
