OSDN Git Service

2001-10-31 Edward E. Meyer <edward.e.meyer@boeing.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / porting.texi
index d966578..9114806 100644 (file)
@@ -1,15 +1,3 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% File:   porting.texi
-% Author: Mark Mitchell
-% Date:   11/21/2000
-%
-% Contents:
-%
-% Copyright (c) 2000 by CodeSourcery, LLC.  All rights reserved. 
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
 \input texinfo
 
 @c ---------------------------------------------------------------------
@@ -24,7 +12,7 @@
 This file explains how to port libstdc++-v3 (the GNU C++ library) to 
 a new target.
 
-Copyright (c) 2000 Free Software Foundation, Inc.
+Copyright (c) 2000, 2001 Free Software Foundation, Inc.
 @end ifinfo
 
 @c ---------------------------------------------------------------------
@@ -36,7 +24,25 @@ Copyright (c) 2000 Free Software Foundation, Inc.
 @author Mark Mitchell
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 2000 Free Software Foundation, Inc.
+Copyright @copyright{} 2000, 2001 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.1 or
+any later version published by the Free Software Foundation; with the
+Invariant Sections being ``GNU General Public License'', the Front-Cover
+texts being (a) (see below), and with the Back-Cover Texts being (b)
+(see below).  A copy of the license is included in the section entitled
+``GNU Free Documentation License''.
+
+(a) The FSF's Front-Cover Text is:
+
+     A GNU Manual
+
+(b) The FSF's Back-Cover Text is:
+
+     You have freedom to copy and modify this GNU Manual, like GNU
+     software.  Copies published by the Free Software Foundation raise
+     funds for GNU development.
 @end titlepage
 
 @c ---------------------------------------------------------------------
@@ -68,7 +74,9 @@ Here are the primary steps required to port the library:
 * Operating system::    Configuring for your operating system.
 * Character types::     Implementing character classification.
 * Thread safety::       Implementing atomic operations.
+* Numeric limits::     Implementing numeric limits.
 * Libtool::             Using libtool.
+* GNU Free Documentation License:: How you can copy and share this manual.
 @end menu
 
 @c ---------------------------------------------------------------------
@@ -119,17 +127,33 @@ provide these macros.  Note that this file does not have to include a
 header file that defines @code{off_t}, or the other types; you simply
 have to provide the macros.
 
-In addition, several libstdc++-v3 source files unconditionally define the macro
-@code{_POSIX_SOURCE}.  On many systems, defining this macro causes large
-portions of the C library header files to be eliminated at preprocessing
-time.  Therefore, you may have to @code{#undef} this macro, or define
-other macros (like @code{_LARGEFILE_SOURCE} or @code{__EXTENSIONS__}).
-You won't know what macros to define or undefine at this point; you'll
-have to try compiling the library and seeing what goes wrong.  If you
-see errors about calling functions that have not been declared, look in
-your C library headers to see if the functions are declared there, and
-then figure out what macros you should but in @file{bits/os_defines.h}
-to make these declarations available.
+In addition, several libstdc++-v3 source files unconditionally define
+the macro @code{_POSIX_SOURCE}.  On many systems, defining this macro
+causes large portions of the C library header files to be eliminated
+at preprocessing time.  Therefore, you may have to @code{#undef} this
+macro, or define other macros (like @code{_LARGEFILE_SOURCE} or
+@code{__EXTENSIONS__}).  You won't know what macros to define or
+undefine at this point; you'll have to try compiling the library and
+seeing what goes wrong.  If you see errors about calling functions
+that have not been declared, look in your C library headers to see if
+the functions are declared there, and then figure out what macros you
+need to define.  You will need to add them to the
+@code{CPLUSPLUS_CPP_SPEC} macro in the GCC configuration file for your
+target.  It will not work to simply define these macros in
+@file{os_defines.h}.
+
+At this time, there are two libstdc++-v3-specific macros 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).
+@code{_GLIBCPP_AVOID_FSEEK} may be defined if seeking on an interactive
+stream (or one hooked to a pipe) is not allowed by the OS.  In this
+case, getc()/ungetc() will be used at some key locations in the library
+implementation instead of fseek().  Currently, the code path to avoid
+fseek() is only enabled when the seek size is 1 character away from the
+current stream position.  This is known to improve *-unknown-freebsd*
+and sparc-sun-solaris2.*.
 
 Finally, you should bracket the entire file in an include-guard, like
 this:
@@ -414,19 +438,53 @@ __atomic_add (_Atomic_word* __mem, int __val)
 @end example
 
 @c ---------------------------------------------------------------------
+@c Numeric limits
+@c ---------------------------------------------------------------------
+
+@node Numeric limits
+@chapter Numeric limits
+
+The C++ library requires information about the fundamental data types,
+such as the minimum and maximum representable values of each type.
+You can define each of these values individually, but it is usually
+easiest just to indicate how many bits are used in each of the data
+types and let the library do the rest.  For information about the
+macros to define, see the top of @file{include/bits/std_limits.h}.
+
+If you need to define any macros, you can do so in
+@file{os_defines.h}.  However, if all operating systems for your CPU
+are likely to use the same values, you can provide a CPU-specific file
+instead so that you do not have to provide the same definitions for
+each operating system.  To take that approach, create a new file
+called @file{limits.h} in your CPU configuration directory (e.g.,
+@file{config/cpu/i386/bits}) and then modify @file{configure.target}
+so that @code{LIMITSH} is set to the CPU directory (e.g.,
+@file{config/cpu/i386}).  Note that @code{LIMITSH} should not include
+the @samp{bits} part of the directory name.
+
+@c ---------------------------------------------------------------------
 @c Libtool
 @c ---------------------------------------------------------------------
 
 @node Libtool
 @chapter Libtool
 
-The C++ library is linked with libtool.  Explaining the full workings of
-libtool is beyond the scope of this document, but there is one
-particular bit that should be explained here.  The C++ run-time library
-contains initialization code that needs to be run as the library is
-loaded.  Often, that requires linking in special object files when the
-C++ library is built as a shared library, or taking other
-system-specific actions.
+The C++ library is compiled, archived and linked with libtool.
+Explaining the full workings of libtool is beyond the scope of this
+document, but there are a few, particular bits that are necessary for
+porting.
+
+Some parts of the libstdc++-v3 library are compiled with the libtool
+@code{--tags CXX} option (the C++ definitions for libtool).  Therefore,
+@file{ltcf-cxx.sh} in the top-level directory needs to have the correct
+logic to compile and archive objects equivalent to the C version of libtool,
+@file{ltcf-c.sh}.  Some libtool targets have definitions for C but not
+for C++, or C++ definitions which have not been kept up to date.
+
+The C++ run-time library contains initialization code that needs to be
+run as the library is loaded.  Often, that requires linking in special
+object files when the C++ library is built as a shared library, or
+taking other system-specific actions.
 
 The libstdc++-v3 library is linked with the C version of libtool, even though it
 is a C++ library.  Therefore, the C version of libtool needs to ensure
@@ -439,6 +497,12 @@ that sets @code{archive_cmds}.  Here, adjust the setting for your
 operating system.
 
 @c ---------------------------------------------------------------------
+@c GFDL
+@c ---------------------------------------------------------------------
+
+@include fdl.texi
+
+@c ---------------------------------------------------------------------
 @c Epilogue
 @c ---------------------------------------------------------------------