Upstream-Status: Inappropriate [embedded specific] gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++ will not run correctly since by default the linker will try to link against libstdc++ which shouldn't exist yet. We need an option to disable -lstdc++ option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc driver. This patch adds such an option which only disables the -lstdc++. A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to do this officially, the likely answer is don't build libstdc++ separately. RP 29/6/10 Index: gcc-4.8.0/gcc/cp/g++spec.c =================================================================== --- gcc-4.8.0.orig/gcc/cp/g++spec.c 2013-01-10 12:38:27.000000000 -0800 +++ gcc-4.8.0/gcc/cp/g++spec.c 2013-03-26 12:06:42.305775104 -0700 @@ -126,6 +126,7 @@ switch (decoded_options[i].opt_index) { case OPT_nostdlib: + case OPT_nostdlib__: case OPT_nodefaultlibs: library = -1; break; Index: gcc-4.8.0/gcc/doc/invoke.texi =================================================================== --- gcc-4.8.0.orig/gcc/doc/invoke.texi 2013-03-26 12:05:41.000000000 -0700 +++ gcc-4.8.0/gcc/doc/invoke.texi 2013-03-26 12:07:56.905776503 -0700 @@ -190,7 +190,7 @@ -frepo -fno-rtti -fstats -ftemplate-backtrace-limit=@var{n} @gol -ftemplate-depth=@var{n} @gol -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol --fno-default-inline -fvisibility-inlines-hidden @gol +-nostdlib++ -fno-default-inline -fvisibility-inlines-hidden @gol -fvisibility-ms-compat @gol -fext-numeric-literals @gol -Wabi -Wconversion-null -Wctor-dtor-privacy @gol @@ -453,7 +453,7 @@ -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol -s -static -static-libgcc -static-libstdc++ @gol -static-libasan -static-libtsan @gol --shared -shared-libgcc -symbolic @gol +-shared -shared-libgcc -symbolic -nostdlib++ @gol -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol -u @var{symbol}} @@ -9886,6 +9886,11 @@ libc. These entry points should be supplied through some other mechanism when this option is specified. +@item -nostdlib++ +@opindex nostdlib++ +Do not use the standard system C++ runtime libraries when linking. +Only the libraries you specify will be passed to the linker. + @cindex @option{-lgcc}, use with @option{-nostdlib} @cindex @option{-nostdlib} and unresolved references @cindex unresolved references and @option{-nostdlib} Index: gcc-4.8.0/gcc/c-family/c.opt =================================================================== --- gcc-4.8.0.orig/gcc/c-family/c.opt 2013-01-18 21:25:25.000000000 -0800 +++ gcc-4.8.0/gcc/c-family/c.opt 2013-03-26 12:06:42.321775104 -0700 @@ -1299,6 +1299,10 @@ C++ ObjC++ Do not search standard system include directories for C++ +nostdlib++ +Driver +Do not link standard C++ runtime library + o C ObjC C++ ObjC++ Joined Separate ; Documented in common.opt Index: gcc-4.8.0/gcc/gcc.c =================================================================== --- gcc-4.8.0.orig/gcc/gcc.c 2013-03-26 12:05:41.000000000 -0700 +++ gcc-4.8.0/gcc/gcc.c 2013-03-26 12:06:42.325775102 -0700 @@ -748,6 +748,7 @@ %(mflib) " STACK_SPLIT_SPEC "\ %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \ %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\ + %{!nostdlib++:}\ %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}" #endif