diff options
author | Benjamin Kosnik <bkoz@redhat.com> | 2012-09-20 02:10:22 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2012-09-20 02:10:22 +0000 |
commit | ac6d1200be5d5f6c49a8b6c4ae447bf82c449c25 (patch) | |
tree | 83818fa8812212f4c4643f4ab5975bed4c9efd59 /libstdc++-v3/src/c++11 | |
parent | 17f293b01426805287a4aee50a3494372f0d3d7d (diff) | |
download | gcc-ac6d1200be5d5f6c49a8b6c4ae447bf82c449c25.tar.gz |
re PR libstdc++/28811 (--with-pic vs static libraries and libstdc++)
2012-09-18 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/28811
PR libstdc++/54482
* configure.ac (glibcxx_lt_pic_flag,
glibcxx_compiler_pic_flag,
glibcxx_compiler_shared_flag): New. Use them.
(lt_prog_compiler_pic_CXX): Set via glibcxx_*_flag(s) above.
(pic_mode): Set to default.
(PIC_CXXFLAGS): Remove.
* Makefile.am (PICFLAG, PICFLAG_FOR_TARGET): Remove. Comment.
* libsupc++/Makefile.am: Use glibcxx_ld_pic_flag and
glibcxx_compiler_shared_flag. Comment.
* src/c++11/Makefile.am: Same.
* src/c++98/Makefile.am: Same.
* src/Makefile.am: Use glibcxx_compiler_pic_flag.
* Makefile.in: Regenerated.
* aclocal.m4: Same.
* configure: Same.
* doc/Makefile.in: Same.
* include/Makefile.in: Same.
* libsupc++/Makefile.in: Same.
* po/Makefile.in: Same.
* python/Makefile.in: Same.
* src/Makefile.in: Same.
* src/c++11/Makefile.in: Same.
* src/c++98/Makefile.in: Same.
* testsuite/Makefile.in: Same.
* src/c++11/compatibility-atomic-c++0x.cc: Use
_GLIBCXX_SHARED instead of PIC to designate shared-only
code blocks.
* src/c++11/compatibility-c++0x.cc: Same.
* src/c++11/compatibility-thread-c++0x.cc: Same.
* src/c++98/compatibility-list-2.cc: Same.
* src/c++98/compatibility.cc: : Same.
* testsuite/17_intro/shared_with_static_deps.cc: New.
* doc/xml/manual/build_hacking.xml: Separate configure from
make/build issues, add build details.
From-SVN: r191509
Diffstat (limited to 'libstdc++-v3/src/c++11')
-rw-r--r-- | libstdc++-v3/src/c++11/Makefile.am | 22 | ||||
-rw-r--r-- | libstdc++-v3/src/c++11/Makefile.in | 48 | ||||
-rw-r--r-- | libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc | 4 | ||||
-rw-r--r-- | libstdc++-v3/src/c++11/compatibility-c++0x.cc | 2 | ||||
-rw-r--r-- | libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc | 8 |
5 files changed, 46 insertions, 38 deletions
diff --git a/libstdc++-v3/src/c++11/Makefile.am b/libstdc++-v3/src/c++11/Makefile.am index 69eb5b6dac6..1e3dd999a61 100644 --- a/libstdc++-v3/src/c++11/Makefile.am +++ b/libstdc++-v3/src/c++11/Makefile.am @@ -69,7 +69,7 @@ libc__11convenience_la_SOURCES = $(sources) $(inst_sources) # as the occasion calls for it. AM_CXXFLAGS = \ -std=gnu++11 \ - $(PIC_CXXFLAGS) \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ $(XTEMPLATE_FLAGS) \ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) @@ -78,11 +78,7 @@ AM_MAKEFLAGS = \ # Libtool notes -# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is -# last. (That way, things like -O2 passed down from the toplevel can -# be overridden by --enable-debug.) - -# 2) In general, libtool expects an argument such as `--tag=CXX' when +# 1) In general, libtool expects an argument such as `--tag=CXX' when # using the C++ compiler, because that will enable the settings # detected when C++ support was being configured. However, when no # such flag is given in the command line, libtool attempts to figure @@ -94,8 +90,18 @@ AM_MAKEFLAGS = \ # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to # attempt to infer which configuration to use. -# We have to put --tag disable-shared after --tag CXX lest things -# CXX undo the affect of disable-shared. +# +# The second tag argument, `--tag disable-shared` means that libtool +# only compiles each source once, for static objects. In actuality, +# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to +# the libtool command that is used create the object, which is +# suitable for shared libraries. The `--tag disable-shared` must be +# placed after --tag CXX lest things CXX undo the affect of +# disable-shared. + +# 2) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is +# last. (That way, things like -O2 passed down from the toplevel can +# be overridden by --enable-debug.) LTCXXCOMPILE = \ $(LIBTOOL) --tag CXX --tag disable-shared \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ diff --git a/libstdc++-v3/src/c++11/Makefile.in b/libstdc++-v3/src/c++11/Makefile.in index 67ded81400e..ee5efaa2c78 100644 --- a/libstdc++-v3/src/c++11/Makefile.in +++ b/libstdc++-v3/src/c++11/Makefile.in @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -179,7 +179,6 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PDFLATEX = @PDFLATEX@ -PIC_CXXFLAGS = @PIC_CXXFLAGS@ RANLIB = @RANLIB@ SECTION_FLAGS = @SECTION_FLAGS@ SECTION_LDFLAGS = @SECTION_LDFLAGS@ @@ -227,7 +226,10 @@ glibcxx_MOFILES = @glibcxx_MOFILES@ glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@ glibcxx_POFILES = @glibcxx_POFILES@ glibcxx_builddir = @glibcxx_builddir@ +glibcxx_compiler_pic_flag = @glibcxx_compiler_pic_flag@ +glibcxx_compiler_shared_flag = @glibcxx_compiler_shared_flag@ glibcxx_localedir = @glibcxx_localedir@ +glibcxx_lt_pic_flag = @glibcxx_lt_pic_flag@ glibcxx_prefixdir = @glibcxx_prefixdir@ glibcxx_srcdir = @glibcxx_srcdir@ glibcxx_toolexecdir = @glibcxx_toolexecdir@ @@ -334,7 +336,7 @@ libc__11convenience_la_SOURCES = $(sources) $(inst_sources) # as the occasion calls for it. AM_CXXFLAGS = \ -std=gnu++11 \ - $(PIC_CXXFLAGS) \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ $(XTEMPLATE_FLAGS) \ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) @@ -344,11 +346,7 @@ AM_MAKEFLAGS = \ # Libtool notes -# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is -# last. (That way, things like -O2 passed down from the toplevel can -# be overridden by --enable-debug.) - -# 2) In general, libtool expects an argument such as `--tag=CXX' when +# 1) In general, libtool expects an argument such as `--tag=CXX' when # using the C++ compiler, because that will enable the settings # detected when C++ support was being configured. However, when no # such flag is given in the command line, libtool attempts to figure @@ -360,8 +358,18 @@ AM_MAKEFLAGS = \ # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to # attempt to infer which configuration to use. -# We have to put --tag disable-shared after --tag CXX lest things -# CXX undo the affect of disable-shared. +# +# The second tag argument, `--tag disable-shared` means that libtool +# only compiles each source once, for static objects. In actuality, +# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to +# the libtool command that is used create the object, which is +# suitable for shared libraries. The `--tag disable-shared` must be +# placed after --tag CXX lest things CXX undo the affect of +# disable-shared. + +# 2) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is +# last. (That way, things like -O2 passed down from the toplevel can +# be overridden by --enable-debug.) LTCXXCOMPILE = \ $(LIBTOOL) --tag CXX --tag disable-shared \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ @@ -407,7 +415,6 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; -$(top_srcdir)/fragment.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -426,7 +433,7 @@ clean-noinstLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libc++11convenience.la: $(libc__11convenience_la_OBJECTS) $(libc__11convenience_la_DEPENDENCIES) $(EXTRA_libc__11convenience_la_DEPENDENCIES) +libc++11convenience.la: $(libc__11convenience_la_OBJECTS) $(libc__11convenience_la_DEPENDENCIES) $(CXXLINK) $(libc__11convenience_la_OBJECTS) $(libc__11convenience_la_LIBADD) $(LIBS) mostlyclean-compile: @@ -515,15 +522,10 @@ install-am: all-am installcheck: installcheck-am install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: diff --git a/libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc index 8ccad9330ed..3ad0b93974e 100644 --- a/libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc +++ b/libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc @@ -30,7 +30,7 @@ // XXX GLIBCXX_ABI Deprecated // gcc-4.7.0 -#ifdef PIC +#ifdef _GLIBCXX_SHARED #define LOGSIZE 4 @@ -147,7 +147,7 @@ _GLIBCXX_END_NAMESPACE_VERSION // In the future, GLIBCXX_ABI > 6 should remove all uses of // _GLIBCXX_*_SYMVER macros in this file. -#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \ +#if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \ && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \ && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT) diff --git a/libstdc++-v3/src/c++11/compatibility-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-c++0x.cc index bd5dbe0ff06..306bad55faf 100644 --- a/libstdc++-v3/src/c++11/compatibility-c++0x.cc +++ b/libstdc++-v3/src/c++11/compatibility-c++0x.cc @@ -30,7 +30,7 @@ # error "compatibility-c++0x.cc must be compiled with -std=gnu++0x" #endif -#ifdef PIC +#ifdef _GLIBCXX_SHARED namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc index e5c7eec419e..5e87b531923 100644 --- a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc +++ b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc @@ -23,7 +23,7 @@ // <http://www.gnu.org/licenses/>. #include <bits/c++config.h> -#if defined(_GLIBCXX_HAVE_TLS) && defined(PIC) +#if defined(_GLIBCXX_HAVE_TLS) && defined(_GLIBCXX_SHARED) #define _GLIBCXX_ASYNC_ABI_COMPAT #endif @@ -40,7 +40,7 @@ // XXX GLIBCXX_ABI Deprecated // gcc-4.6.0 // <future> export changes -#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \ +#if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \ && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \ && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT) @@ -57,7 +57,7 @@ _GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx15future_categoryE, _ZSt15future_category, GLIB // gcc-4.6.0 // <mutex> export changes #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) -#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \ +#if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \ && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \ && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT) @@ -82,7 +82,7 @@ _GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx11try_to_lockE, _ZSt11try_to_lock, GLIBCXX_3.4. // <future> export changes #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \ && (ATOMIC_INT_LOCK_FREE > 1) -#if defined(_GLIBCXX_HAVE_TLS) && defined(PIC) +#if defined(_GLIBCXX_HAVE_TLS) && defined(_GLIBCXX_SHARED) namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION |