diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-01-12 19:40:25 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-01-12 19:40:25 +0000 |
commit | 15a2f04fda69170dc0ce581733f61c14b5d22ab1 (patch) | |
tree | 8a84d8ad9e3ef72925543eda9b1e73f9448ec2cd /gnu | |
parent | ad78a1fd33f7f20173b3df83ed7222d6ae54c913 (diff) |
fix c++ -shared for gcc 3. Here, we recognize -shared and link with
-lsupc++. That way, linking shared C++ libraries is consistent between
gcc 2.95 and gcc 3.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/gcc/gcc/cp/g++spec.c | 25 |
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) { |