title: Is -ffunction-sections -fdata-sections and --gc-sections not working?
body: <p>I want to remove unused functions from code while compiling. Then I write some code (main.c):</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  const char *get1();
  
  int main()
  {
      puts( get1() );
  }
  </code></pre>
  
  <p>and getall.c:</p>
  
  <pre><code>const char *get1()
  {
      return "s97symmqdn-1";
  }
  
  
  const char *get2()
  {
      return "s97symmqdn-2";
  }
  
  const char *get3()
  {
      return "s97symmqdn-3";
  }
  </code></pre>
  
  <p>Makefile</p>
  
  <pre><code>test1   :
          rm -f a.out *.o *.a
          gcc -ffunction-sections -fdata-sections -c main.c getall.c
          ar cr libgetall.a getall.o
          gcc -Wl,--gc-sections main.o -L. -lgetall
  </code></pre>
  
  <p>After run <code>make test1 &amp;&amp; objdump --sym a.out | grep get</code> , I only find the next 2 lines output:</p>
  
  <pre><code>0000000000000000 l    df *ABS*  0000000000000000              getall.c
  0000000000400535 g     F .text  000000000000000b              get1
  </code></pre>
  
  <p>I guess the <code>get2</code> and <code>get3</code> was removed. But when I open the a.out by vim, I found <code>s97symmqdn-1 s97symmqdn-2 s97symmqdn-3</code> exists. 
  Is the function <code>get2</code> <code>get3</code> removed really ? How I can remove the symbol <code>s97symmqdn-2 s97symmqdn-3</code> ? Thank you for your reply.
  My system is centos7 and gcc version is 4.8.5</p>