title: dynamic symbols with statically linked libstdc++
body: <p>I need to compile my c++ application for 32-bit platform. To support older systems I've linked libstdc++ statically. The trouble is that even with static libstdc++ gcc linker adds a lot of dynamic symbols.</p>
  
  <p>Here is <code>nm -D</code> output on the compiled application:</p>
  
  <pre><code>08137f2c u _ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE
  08137fbc u _ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE
  08135b24 V _ZTINSt8ios_base7failureE
  08135930 V _ZTISt10bad_typeid
  08134e90 V _ZTISt10moneypunctIcLb0EE
  08134e70 V _ZTISt10moneypunctIcLb1EE
  081354b0 V _ZTISt10moneypunctIwLb0EE
  08135490 V _ZTISt10moneypunctIwLb1EE
  08135b44 V _ZTISt11logic_error
  08135b8c V _ZTISt11range_error
  0813380c V _ZTISt11regex_error
  </code></pre>
  
  <p>And lots of other symols. Mostly they are unique global or weak objects. Below are Makefile and a simple cpp file.</p>
  
  <p>main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main()
  {
    std::cout &lt;&lt; "s" &lt;&lt; std::endl;
    return 0;
  }
  </code></pre>
  
  <p>Makefile</p>
  
  <pre><code>CXX         = g++
  EXE         = app
  CXXFLAGS    = -std=c++14 -m32
  LDFLAGS     = -m32
  LDLIBS      = -static-libstdc++ -static-libgcc
  
  SOURCES     = main.cpp
  OBJS        = $(subst .cpp,.o,$(SOURCES))
  
  all: $(EXE)
      strip $(EXE)
  
  $(EXE): $(OBJS)
      $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
  
  %.o: %.cpp
      $(CXX) $(CXXFLAGS) -c $&lt;
  
  clean:
      rm -rf $(OBJS) $(EXE)
  </code></pre>
  
  <p>Is there any way I can get rid of those symbols?
  The libstdc++ I use is from last gcc (6.2.1) on Arch linux. And x64 version compiles without any additional symbols.</p>