title: Barebones C++ without standard library?
body: <p>Compilers such as GCC and Clang allow to compile C++ programs without the C++ standard library, e.g. using the <code>-nostdlib</code> command line flag. It seems that such often fail to link thou, for example:</p>
  
  <pre><code>void f() noexcept { throw 42; }
  int main() { f(); }
  </code></pre>
  
  <p>Usually fails to link due to undefined symbols like <code>__cxa_allocate_exception</code>, <code>typeinfo for int</code>, <code>__cxa_throw</code>, <code>__gxx_personality_v0</code>, <code>__clang_call_terminate</code>, <code>__cxa_begin_catch</code>, <code>std::terminate()</code> etc.</p>
  
  <p>Even a simple</p>
  
  <pre><code>int main() {}
  </code></pre>
  
  <p>Fails to link with</p>
  
  <blockquote>
    <p>ld: warning: cannot find entry symbol <code>_start</code>; defaulting to 0000000000400120</p>
  </blockquote>
  
  <p>and is killed by the OS upon execution. Using <code>-c</code> the compiler still runs the linker which blatantly fails with:</p>
  
  <blockquote>
    <p>ld: error in <code>mytest</code>(<code>.eh_frame</code>); no <code>.eh_frame_hdr</code> table will be created.</p>
  </blockquote>
  
  <p>Is it a realistic goal to program and compile C++ applications or libraries without using and linking to the standard library? How can I compile my code using GCC or Clang on Linux? What core language features would one be unable to use without the standard library?</p>