Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's freestanding mode for libstdc++?

Tags:

gcc

libstdc++

--disable-hosted-libstdcxx
                          only build freestanding C++ runtime support

from the <gcc>/libstdc++-v3/configure --help .

What is this freestanding mode and what are the limits and the benefits ?

For the very little that I know about it looks like it's equivalent to some static linkage of the libstdc++ but then what is the point of this "mode" if you can just build your *.a library ? It doesn't sound like a good explanation.

like image 912
user2485710 Avatar asked Apr 24 '14 01:04

user2485710


1 Answers

"freestanding" is a minimal configuration for a c++ program, as opposed to "hosted" (full standard library support making use of advanced platform OS features). In theory, "freestanding" c++ program can be made to run on bare iron.

In "freestanding" mode only the following headers can be safely used:

  • cstdarg
  • cstddef
  • cstdlib
  • exception
  • limits
  • new
  • exception
  • typeinfo

With optional:

  • cxxabi.h.

And C++11 ones:

  • initializer_list
  • type_traits

Applications must link to "libsupc++.a" library for limited runtime features support.

http://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared.html

This is supposed to conform to section 17.6.1.3 of the c++ standard (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf)

like image 165
oakad Avatar answered Oct 03 '22 18:10

oakad