title: version-script and hidden visibility
body: <p>When using <code>gcc</code> to build a shared library, it's possible to limit the visibility of the symbols using <code>-fvisibility=hidden</code>. I also just learned you can limit visibility using the version-script option to <code>ld</code>.</p>
  
  <p>Now I want to know if it's possible to combine these. Say I have a program with the following:</p>
  
  <pre><code>void foobar() {}
  void say_hello() {}
  </code></pre>
  
  <p>Then I have the version script file with:</p>
  
  <pre><code>{
    global:
      foobar;
  }
  </code></pre>
  
  <p>And I compile this with:</p>
  
  <pre><code>gcc -fvisibility=hidden -Wl,--version-script=&lt;version-script&gt; test.c -shared -o libtest.so
  </code></pre>
  
  <p>When I run <code>nm</code> on this afterwards, I find that no symbols are exported. Is there anyway that I can set the default visibility to hidden and use the version-script (or something else) to export symbols?</p>