title: gcc Boost template results in "defined in discarded section"
body: <p>I'm using gcc 4.7.4 20140401 to cross compile for an embedded ARM Cortex M4 (Pixhawk). I'm trying to get Boost Statechart working and I've come across an error that I can't resolve. Below is an of one them, there are many like this.</p>
  
  <blockquote>
    <p><code>_ZTIN5boost12noncopyable_11noncopyableE' referenced in section</code>.rodata._ZTIN5boost10statechart13state_machineI15PositionControl15HoldingPositionSaIvENS0_25null_exception_translatorEEE[_ZTIN5boost10statechart13state_machineI15PositionControl15HoldingPositionSaIvENS0_25null_exception_translatorEEE]' of /home/nghia/Documents/catkin/Firmware/Build/px4fmu-v2_default.build//home/nghia/Documents/catkin/Firmware/src/modules/state_machine_boost/module.pre.o: defined in discarded section `.rodata._ZTIN5boost12noncopyable_11noncopyableE[_ZTIN5boost12noncopyable_11noncopyableE]' of /home/nghia/Documents/catkin/Firmware/Build/px4fmu-v2_default.build//home/nghia/Documents/catkin/Firmware/src/modules/state_machine_boost/module.pre.o</p>
  </blockquote>
  
  <p>I've read through all the Stackoverflow posts regarding 'defined in discarded section', but haven't found any solution that works. This includes enabling/disabling -ffunction-sections, -fdata-sections, --gc-sections, optimization flags, and re-ordering the module.</p>
  
  <p>Boost Statechart makes heavy use of template, which I suspect is causing the problem. Is gcc optimizing out stuff it thinks isn't being used?</p>
  
  <p><strong>UPDATE:</strong>
  I've managed to come up with a bare minimal example that triggers the error above:</p>
  
  <pre><code>class dummy : boost::noncopyable
  {
  public:
      int x;    
  };
  
  static dummy g_dummy;
  </code></pre>