This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[libstdc++] Port-specific symbol exports, porting notes
- From: Phil Edwards <phil at jaj dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sun, 6 Jul 2003 00:07:09 -0400
- Subject: [libstdc++] Port-specific symbol exports, porting notes
Some time ago, some symbols had to be added to the export list for the
sake of (at the time) a single platform. I worked up a patch to allow
ports to individually list symbols that would be additionally exported,
but it also involved fixing more of GNU ld's linker versioning parser.
Now that a version of binutils has been officially released (2.14) which
contains the fix, we can start using the functionality on the trunk.
This also brings the "porting to a new platform" docs up to date.
(My editor keeps wanting to trim trailing whitespace in the makfiles,
so finally I just let it have its way for this patch.)
Tested on x86/linux for a long time. Post-specific functionality tested
by just adding fake stuff to a random port and checking the output.
2003-07-05 Phil Edwards <pme@gcc.gnu.org>
* acinclude.m4 (GLIBCXX_ENABLE_SYMVERS): Bump minimal version
requirement. Add port_specific_symbol_file variable.
* configure.host: Add docs for port_specific_symbol_file.
Clean up try_cpu block for x86.
* config/linker-map.gnu: No more "last symbol can't have a
semicolon" kaka. Add hook for port-specific symbols.
* src/Makefile.am: Remove trailing whitespace.
(libstdc++-symbol.ver): Detect the presence of port-specific
symbols, and add them accordingly.
* docs/html/17_intro/porting.texi: Bring up to date.
* src/Makefile.in, aclocal.m4, configure,
docs/html/17_intro/porting.html: Regenerated.
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.253
diff -u -3 -p -r1.253 acinclude.m4
--- acinclude.m4 5 Jul 2003 04:05:18 -0000 1.253
+++ acinclude.m4 6 Jul 2003 03:56:55 -0000
@@ -2258,9 +2258,9 @@ if test $enable_symvers != no; then
AC_MSG_RESULT($glibcxx_shared_libgcc)
fi
-# For GNU ld, we need at least this version. It's 2.12 in the same format
+# For GNU ld, we need at least this version. It's 2.14 in the same format
# as the tested-for version. See GLIBCXX_CHECK_LINKER_FEATURES for more.
-glibcxx_min_gnu_ld_version=21200
+glibcxx_min_gnu_ld_version=21400
# Check to see if unspecified "yes" value can win, given results
# above.
@@ -2305,6 +2305,7 @@ case $enable_symvers in
esac
AC_SUBST(SYMVER_MAP)
+AC_SUBST(port_specific_symbol_file)
AM_CONDITIONAL(GLIBCXX_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
AC_MSG_CHECKING([versioning on shared library symbols])
AC_MSG_RESULT($enable_symvers)
Index: configure.host
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.host,v
retrieving revision 1.12
diff -u -3 -p -r1.12 configure.host
--- configure.host 5 Jul 2003 04:05:26 -0000 1.12
+++ configure.host 6 Jul 2003 03:56:58 -0000
@@ -41,6 +41,11 @@
# the form '-Wl,blah'
# (defaults to empty in acinclude.m4)
#
+# port_specific_symbol_file
+# whitespace-seperated list of files containing
+# additional symbols to export from the shared
+# library, when symbol versioning is in use
+#
#
# If the defaults will not work for your platform, you need only change the
# variables that won't work, i.e., you do not need to explicitly set a
@@ -66,7 +71,7 @@ case "${host_cpu}" in
alpha*)
try_cpu=alpha
;;
- athlon* | i586 | i686 | i786 | x86_64)
+ i[567]86 | x86_64)
try_cpu=i486
;;
hppa*)
Index: config/linker-map.gnu
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/linker-map.gnu,v
retrieving revision 1.41
diff -u -3 -p -r1.41 linker-map.gnu
--- config/linker-map.gnu 5 Jul 2003 04:05:26 -0000 1.41
+++ config/linker-map.gnu 6 Jul 2003 03:56:58 -0000
@@ -1,4 +1,4 @@
-## Linker script for GNU ld 2.11.94+ only.
+## Linker script for GNU ld 2.13.91+ only.
##
## Copyright (C) 2002, 2003 Free Software Foundation, Inc.
##
@@ -25,7 +25,6 @@ GLIBCXX_3.4 {
global:
# Names inside the 'extern' block are demangled names.
- # All but the last are terminated with a semicolon.
extern "C++"
{
std::[A-Za-k]*;
@@ -56,7 +55,7 @@ GLIBCXX_3.4 {
std::__num_base::_S_format_int*;
std::__num_base::_S_atoms_in;
std::__num_base::_S_atoms_out;
- std::__numpunct_cache*
+ std::__numpunct_cache*;
};
# Names not in an 'extern' block are mangled names.
@@ -168,6 +167,8 @@ GLIBCXX_3.4 {
_ZN9__gnu_cxx17_Atomic_add_mutexE;
_ZN9__gnu_cxx22_Atomic_add_mutex_onceE;
_ZN9__gnu_cxx31__gthread_atomic_add_mutex_onceEv;
+
+ # DO NOT DELETE THIS LINE. Port-specific symbols, if any, will be here.
local:
*;
Index: docs/html/17_intro/porting.texi
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/17_intro/porting.texi,v
retrieving revision 1.11
diff -u -3 -p -r1.11 porting.texi
--- docs/html/17_intro/porting.texi 18 Apr 2003 09:53:42 -0000 1.11
+++ docs/html/17_intro/porting.texi 6 Jul 2003 03:56:59 -0000
@@ -9,7 +9,7 @@
@setchapternewpage odd
@copying
-Copyright @copyright{} 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright @copyright{} 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
@@ -74,6 +74,9 @@ In addition, you should try to verify th
works. It is difficult to test the C++ compiler without a working
library, but you should at least try some minimal test cases.
+(Note that what we think of as a ``target,'' the library refers to as
+a ``host.'' The comment at the top of @file{configure.in} explains why.)
+
Here are the primary steps required to port the library:
@menu
@@ -106,7 +109,7 @@ directory. The important information is
directory under @file{config/os} to store the files for your operating
system.
-You might have to change the @file{configure.target} file to ensure that
+You might have to change the @file{configure.host} file to ensure that
your new directory is activated. Look for the switch statement that sets
@code{os_include_dir}, and add a pattern to handle your operating system
if the default will not suffice. The switch statement switches on only
@@ -150,45 +153,42 @@ need to define. You will need to add th
target. It will not work to simply define these macros in
@file{os_defines.h}.
-At this time, there are a few libstdc++-v3-specific macro which may be
-defined. @code{_G_USING_THUNKS} may be defined to 0 to express that the
-port doesn't use thunks (although it is unclear that this is still
-useful since libio support isn't currently working and the g++ v3 ABI
-invalidates the assumption that some ports don't use thunks).
+At this time, there are a few libstdc++-v3-specific macros which may be
+defined:
-@code{_GLIBCPP_USE_C99_CHECK} may be defined to 1 to check C99
+@code{_GLIBCXX_USE_C99_CHECK} may be defined to 1 to check C99
function declarations (which are not covered by specialization below)
found in system headers against versions found in the library headers
derived from the standard.
-@code{_GLIBCPP_USE_C99_DYNAMIC} may be defined to an expression that
+@code{_GLIBCXX_USE_C99_DYNAMIC} may be defined to an expression that
yields 0 if and only if the system headers are exposing proper support
for C99 functions (which are not covered by specialization below). If
defined, it must be 0 while bootstrapping the compiler/rebuilding the
library.
-@code{_GLIBCPP_USE_C99_LONG_LONG_CHECK} may be defined to 1 to check
+@code{_GLIBCXX_USE_C99_LONG_LONG_CHECK} may be defined to 1 to check
the set of C99 long long function declarations found in system headers
against versions found in the library headers derived from the
standard.
-@code{_GLIBCPP_USE_C99_LONG_LONG_DYNAMIC} may be defined to an
+@code{_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC} may be defined to an
expression that yields 0 if and only if the system headers are
exposing proper support for the set of C99 long long functions. If
defined, it must be 0 while bootstrapping the compiler/rebuilding the
library.
-@code{_GLIBCPP_USE_C99_FP_MACROS_DYNAMIC} may be defined to an
+@code{_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC} may be defined to an
expression that yields 0 if and only if the system headers
are exposing proper support for the related set of macros. If defined,
it must be 0 while bootstrapping the compiler/rebuilding the library.
-@code{_GLIBCPP_USE_C99_FLOAT_TRANSCENDENTALS_CHECK} may be defined
+@code{_GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_CHECK} may be defined
to 1 to check the related set of function declarations found in system
headers against versions found in the library headers derived from
the standard.
-@code{_GLIBCPP_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC} may be defined
+@code{_GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC} may be defined
to an expression that yields 0 if and only if the system headers
are exposing proper support for the related set of functions. If defined,
it must be 0 while bootstrapping the compiler/rebuilding the library.
@@ -197,8 +197,8 @@ Finally, you should bracket the entire f
this:
@example
-#ifndef _GLIBCPP_OS_DEFINES
-#define _GLIBCPP_OS_DEFINES
+#ifndef _GLIBCXX_OS_DEFINES
+#define _GLIBCXX_OS_DEFINES
...
#endif
@end example
@@ -222,14 +222,14 @@ setup files without explicit help.
We recommend that for a target triplet @code{<CPU>-<vendor>-<OS>}, you
name your configuration directory @file{config/cpu/<CPU>}. If you do this,
-the configury will find the directory itself. Otherwise you will need to
-edit the @file{configure.target} file and, in the switch statement that sets
+the configury will find the directory by itself. Otherwise you will need to
+edit the @file{configure.host} file and, in the switch statement that sets
@code{cpu_include_dir}, add a pattern to handle your chip.
Note that some chip families share a single configuration directory, for
example, @code{alpha}, @code{alphaev5}, and @code{alphaev6} all use the
@file{config/cpu/alpha} directory, and there is an entry in the
-@file{configure.target} switch statement to handle this.
+@file{configure.host} switch statement to handle this.
The @code{cpu_include_dir} sets default locations for the files controlling
@ref{Thread safety} and @ref{Numeric limits}, if the defaults are not
@@ -474,14 +474,14 @@ see the @file{atomicity.h} file for IRIX
Alternatively, if the primitives are more closely related to the OS
than they are to the CPU, you can put the @file{atomicity.h} file in
the @ref{Operating system} directory instead. In this case, you must
-edit @file{configure.target}, and in the switch statement that handles
+edit @file{configure.host}, and in the switch statement that handles
operating systems, override the @code{ATOMICITYH} variable to point to
the appropriate @code{os_include_dir}. For examples of this approach,
see the @file{atomicity.h} file for AIX.
With those bits out of the way, you have to actually write
@file{atomicity.h} itself. This file should be wrapped in an
-include guard named @code{_BITS_ATOMICITY_H}. It should define one
+include guard named @code{_GLIBCXX_ATOMICITY_H}. It should define one
type, and two functions.
The type is @code{_Atomic_word}. Here is the version used on IRIX:
Index: src/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/Makefile.am,v
retrieving revision 1.125
diff -u -3 -p -r1.125 Makefile.am
--- src/Makefile.am 5 Jul 2003 04:05:41 -0000 1.125
+++ src/Makefile.am 6 Jul 2003 03:56:59 -0000
@@ -37,9 +37,16 @@ toolexeclib_LTLIBRARIES = libstdc++.la
# Symbol versioning for shared libraries.
if GLIBCXX_BUILD_VERSIONED_SHLIB
+port_specific_symbol_file = @port_specific_symbol_file@
version_arg = -Wl,--version-script=libstdc++-symbol.ver
libstdc++-symbol.ver: ${glibcxx_srcdir}/@SYMVER_MAP@
- @LN_S@ ${glibcxx_srcdir}/@SYMVER_MAP@ ./libstdc++-symbol.ver || true
+ cp ${glibcxx_srcdir}/@SYMVER_MAP@ ./libstdc++-symbol.ver
+ if test "x${port_specific_symbol_file}" != x; then \
+ sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
+ sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
+ cat tmp.top $(port_specific_symbol_file) tmp.bottom > $@; \
+ rm tmp.top tmp.bottom; \
+ fi
else
version_arg =
libstdc++-symbol.ver:
@@ -106,7 +113,7 @@ time_members.cc: ${glibcxx_srcdir}/@CTIM
# particular host, but with ad hoc naming rules.
host_sources_extra = \
basic_file.cc \
- c++locale.cc
+ c++locale.cc
c++locale.cc: ${glibcxx_srcdir}/@CLOCALE_CC@
@LN_S@ ${glibcxx_srcdir}/@CLOCALE_CC@ ./$@ || true
@@ -157,7 +164,7 @@ libstdc___la_DEPENDENCIES = libstdc++-sy
libstdc___la_LDFLAGS = \
-version-info @libtool_VERSION@ ${version_arg} \
- -lm @LIBUNWIND_FLAG@
+ -lm @LIBUNWIND_FLAG@
# Use special rules for the deprecated source files so that they find
@@ -188,13 +195,13 @@ demangle.o: demangle.cc
# modified in a per-library or per-sub-library way. Need to manually
# set this option because CONFIG_CXXFLAGS has to be after
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
-# as the occasion call for it.
+# as the occasion calls for it.
AM_CXXFLAGS = \
-fno-implicit-templates \
$(LIBSUPCXX_CXXFLAGS) \
$(WARN_CXXFLAGS) \
$(OPTIMIZE_CXXFLAGS) \
- $(CONFIG_CXXFLAGS)
+ $(CONFIG_CXXFLAGS)
# libstdc++ libtool notes
@@ -216,7 +223,7 @@ AM_CXXFLAGS = \
# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
# attempt to infer which configuration to use
LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
# 3) We'd have a problem when building the shared libstdc++ object if
# the rules automake generates would be used. We cannot allow g++ to
@@ -234,13 +241,13 @@ all-local: build_debug
install-data-local: install_debug
else
all-local:
-install-data-local:
+install-data-local:
endif
debugdir = debug
# Build parallel set of debug objects here.
-stamp-debug:
+stamp-debug:
if test ! -d ${debugdir}; then \
mkdir -p ${debugdir}; \
(cd ${debugdir}; \
@@ -251,12 +258,12 @@ stamp-debug:
-e 's/install-data-local: install_debug/install-data-local:/' \
< ../Makefile > Makefile) ; \
fi; \
- echo `date` > stamp-debug;
+ echo `date` > stamp-debug;
build_debug: stamp-debug
(cd ${debugdir} && $(MAKE) CXXFLAGS='@DEBUG_FLAGS@' all)
# Install debug library here.
-install_debug:
+install_debug:
(cd ${debugdir} && $(MAKE) \
toolexeclibdir=@glibcxx_toolexeclibdir@/debug install)