summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gcc/gcc/cp/g++spec.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gnu/usr.bin/gcc/gcc/cp/g++spec.c b/gnu/usr.bin/gcc/gcc/cp/g++spec.c
index af30f1c409a..03c775f6915 100644
--- a/gnu/usr.bin/gcc/gcc/cp/g++spec.c
+++ b/gnu/usr.bin/gcc/gcc/cp/g++spec.c
@@ -42,6 +42,12 @@ Boston, MA 02111-1307, USA. */
#ifndef LIBSTDCXX_PROFILE
#define LIBSTDCXX_PROFILE "-lstdc++"
#endif
+#ifndef LIBSUPCXX
+#define LIBSUPCXX "-lsupc++"
+#endif
+#ifndef LIBSUPCXX_PROFILE
+#define LIBSUPCXX_PROFILE "-lsupc++"
+#endif
void
lang_specific_driver (in_argc, in_argv, in_added_libraries)
@@ -61,6 +67,10 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
link in libstdc++. */
int library = 1;
+ /* This will be 1 if we encounter a situation where we should link
+ libsupc++. */
+ int libsupcxx = 0;
+
/* The number of arguments being added to what's in argv, other than
libraries. We use this to track the number of times we've inserted
-xc++/-xnone. */
@@ -132,6 +142,13 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
|| strcmp (argv[i], "-nodefaultlibs") == 0))
{
library = 0;
+ libsupcxx = -1;
+ }
+ else if (strcmp (argv[i], "-shared") == 0)
+ {
+ library = 0;
+ if (libsupcxx == 0)
+ libsupcxx = 1;
}
else if (strcmp (argv[i], "-lm") == 0
|| strcmp (argv[i], "-lmath") == 0
@@ -146,6 +163,8 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
}
else if (strcmp (argv[i], "-lc") == 0)
args[i] |= WITHLIBC;
+ else if (strcmp (argv[i], "-lstdc++") == 0)
+ libsupcxx = -1;
else if (strcmp (argv[i], "-pg") == 0 || strcmp (argv[i], "-p") == 0)
saw_profile_flag++;
else if (strcmp (argv[i], "-v") == 0)
@@ -269,6 +288,12 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
j++;
}
+ /* Add -lsupc++ for shared. */
+ if (libsupcxx)
+ {
+ arglist[j++] = saw_profile_flag ? LIBSUPCXX_PROFILE : LIBSUPCXX;
+ added_libraries++;
+ }
/* Add `-lstdc++' if we haven't already done so. */
if (library)
{