Branch: Tag:

2011-05-01

2011-05-01 00:33:25 by Per Hedbor <ph@opera.com>

Use -fvisibility=hidden.

This allows gcc to optimize function calls to globally visible, but not exported
(using PMOD_EXPORT) functions to a direct call. Saves a few % CPU, and also decreases
the size of the binary.

However, it is now important to use PMOD_EXPORT correctly on any system, not only Windows.

It also significantly speeds up loading of dynamic modules, but that does not generally speaking
use any significant amount of CPU anyway.

994:   fi   fi    + AC_SYS_COMPILER_FLAG([-fvisibility=hidden],[fvisibility_hidden],CFLAGS) +  +    AC_SYS_COMPILER_FLAG(+O3,plus_O3,OPTIMIZE, [    AC_SYS_COMPILER_FLAG(-O3,O3,OPTIMIZE, [    AC_SYS_COMPILER_FLAG(-O2,O2,OPTIMIZE, [
8101:    cat >conftest.c <<EOF   #include <stdio.h>   #include <stdlib.h> + #if __GNUC__ >= 4 + __attribute__ ((visibility("default"))) + # endif   void testfunc(void) {    fprintf(stderr,"Calling testfunc2\n");    testfunc2();
8130:    AC_TRY_RUN([   #define TESTING   #include "dynamic_load.c" + #if __GNUC__ >= 4 + __attribute__ ((visibility("default"))) + # endif   void testfunc2(void) { exit(0); }   ], pike_cv_sys_dynamic_loading=yes, pike_cv_sys_dynamic_loading=no, pike_cv_sys_dynamic_loading=no)    CFLAGS="$OLD_CFLAGS"