Skip to content

Instantly share code, notes, and snippets.

@EricWF
Created February 8, 2017 01:11
Show Gist options
  • Select an option

  • Save EricWF/8ca88b7381c0923e294f5432c19645b5 to your computer and use it in GitHub Desktop.

Select an option

Save EricWF/8ca88b7381c0923e294f5432c19645b5 to your computer and use it in GitHub Desktop.
Index: gcc/common.opt
===================================================================
--- gcc/common.opt (revision 245184)
+++ gcc/common.opt (working copy)
@@ -2928,6 +2928,9 @@
nostdlib
Driver
+nostdlibc++
+Driver
+
o
Common Driver Joined Separate Var(asm_file_name) MissingArgError(missing filename after %qs)
-o <file> Place output into <file>.
Index: gcc/cp/g++spec.c
===================================================================
--- gcc/cp/g++spec.c (revision 245184)
+++ gcc/cp/g++spec.c (working copy)
@@ -137,6 +137,7 @@
switch (decoded_options[i].opt_index)
{
case OPT_nostdlib:
+ case OPT_nostdlibc__:
case OPT_nodefaultlibs:
library = -1;
break;
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 245184)
+++ gcc/doc/invoke.texi (working copy)
@@ -11569,6 +11569,12 @@
constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
GNU Compiler Collection (GCC) Internals}.)
+@item -nostdlibc++
+@opindex nostdlibc++
+Do not use the C++ standard library when linking. Startup files and other
+standard and system libraries are still included. Options specifying linkage
+of the C++ standard libraries, such as @option{-static-libstdc++} are ignored.
+
@item -pie
@opindex pie
Produce a position independent executable on targets that support it.
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c (revision 245184)
+++ gcc/gcc.c (working copy)
@@ -1,3 +1,4 @@
+
/* Compiler driver program that can handle many languages.
Copyright (C) 1987-2017 Free Software Foundation, Inc.
@@ -4117,9 +4118,10 @@
case OPT_shared_libgcc:
case OPT_static_libgfortran:
case OPT_static_libstdc__:
+ case OPT_nostdlibc__:
/* These are always valid, since gcc.c itself understands the
first two, gfortranspec.c understands -static-libgfortran and
- g++spec.c understands -static-libstdc++ */
+ g++spec.c understands -static-libstdc++ and -nostdlibc++ */
validated = true;
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment