title: clang: stripping class names from the output
body: <p>I build a C++ project of mine using <code>clang++</code>, using the following command line command (split into lines):</p>
  
  <pre><code>clang++
    -std=c++11
    -W -Wall -Wextra -pedantic -Wno-newline-eof -Werror
    -O4
    -I&lt;dirs&gt;
    -L&lt;dirs&gt;
    -l&lt;libs&gt;
    -framework &lt;frameworks&gt;
    -D &lt;defs&gt;
    -o &lt;filename&gt;
    &lt;files&gt;
  </code></pre>
  
  <p>However, when I run <code>strings &lt;filename&gt;</code>, several class names show up, despite the <code>-O4</code> in the command line. I've tried <code>-Wl,-s</code> which should tell llvm to strip all symbols, but that doesn't remove these.</p>
  
  <p>The class names that show up seem to all have one thing in common: they have a vtable. One of these classes is :</p>
  
  <pre><code>class MyClass {
  public:
      virtual void myFunc() = 0;  
  };
  </code></pre>
  
  <p>It shows up as the symbol :</p>
  
  <pre><code>N9namespace7MyClassE
  </code></pre>
  
  <p>I don't like it that my namespace and class names show up in the final file. How do I strip these? My binary is a command line utility, so only the <code>main</code> function should be exported.</p>
  
  <hr>
  
  <p>Even after supplying <code>-fno-rtti</code> (as suggested by @n.m.), some names still remain, such as :</p>
  
  <pre><code>__ZN15MyClassInstance6myFuncEv
  </code></pre>
  
  <p>(MyClassInstance being a subclass of the MyClass above)</p>
  
  <p>Additionally, even the names of global variables are in the binary.</p>