[gcc 4.1] make use of gcc 4.1 -fvisibility option
-------------------------------------------------

                 Key: STDCXX-1031
                 URL: https://issues.apache.org/jira/browse/STDCXX-1031
             Project: C++ Standard Library
          Issue Type: Improvement
          Components: Build and Installation
    Affects Versions: 4.2.1
         Environment: gcc 4.1 and better on ELF targets
            Reporter: Martin Sebor
            Assignee: Martin Sebor
             Fix For: 4.2.2


The gcc 4.1 {{[-fvisibility | 
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Code-Gen-Options.html#index-fvisibility-1636]}}
 option is said to
{quote}
??...very substantially improve linking and load times of shared object 
libraries, produce more optimized code, provide near-perfect API export and 
prevent symbol clashes. It is *strongly* recommended that you use this in any 
shared objects you distribute.??
{quote}

In order for stdcxx users to benefit as described in the gcc manual we should 
make use of the {{-fvisibility=hidden}} option in conjunction with 
{{[\_\_attribute\_\_((visibility("default"))) | 
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Function-Attributes.html#index-g_t_0040code_007bvisibility_007d-attribute-1830]}}
 on exported interfaces as the gcc manual recommends.

Besides adding the {{-fvisibility=hidden}} option to the command line when 
building shared libraries with gcc, the implementation involves defining the 
{{_RWSTD_EXPORT}} macro for gcc as follows:
{code}
#define _RWSTD_EXPORT __attribute__ ((visibility ("default")))
{code}

Note that since gcc requires the {{\_\_attribute\_\_}} decoration only on 
function declarations and issues a warning when it appears on definitions so 
the {{_RWSTD_EXPORT}} macro must not be used on definitions.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to