Sun WorkShop Compiler C++ 5.0 README ============================================================================ Introduction ============ The Sun WorkShop Compiler C++ (CC) 5.0 runs on SPARC(TM) processors running Solaris(TM) SPARC Platform Edition, and Intel(R) processors running Solaris x86 Platform Edition, versions 2.5.1, 2.6 and Solaris 7. Information unique to one or more platforms is identified as "(SPARC)" or "(x86)." The 64-bit SPARC architecture features in this development release are support for the C++ International Standard and for "-xarch=v9". Unsupported features and known problems are listed below. To file bugs or report a need for options from the unsupported list, see "Reporting Problems" below. ___________________________________________________________________________ Contents A. New and Changed Features/Patches B. Software Incompatibilities C. Known CC Bugs D. Fixed Software Bugs E. Documentation Errata F. Shippable Libraries ____________________________________________________________________________ A. New and Changed Features This section contains the following subsections: 0. 1. 2. 3. 4. 5. 6. Standards Compile for 64-bit Solaris 7 New/changed compiler options Changed compiler options Obsolete compiler options Access to C++ 4.2 compiler library man pages Patches 0. Standards ============= The C++ compiler (CC) supports the ISO standard for C++, ISO IS 14882:1998, Programming Language C++. The following list describes requirements in the standard not supported in this release: o o o o o o new syntax for function templates: f(args) non-type template parameters for function templates class member templates partial specialization of templates template template parameters (templates as template parameters) universal character names 1. Compile for 64-bit Solaris 7 ================================= This release of the compiler can produce 32-bit object files on any supported version of Solaris, whether SPARC or x86. It can produce SPARC v9 64-bit object files on: - a SPARC v9 system running Solaris 7 in 64-bit mode - any supported SPARC system running Solaris 7 in 32-bit mode if the appropriate v9 packages are also installed. The 64-bit executable files can be run only on a SPARC v9 system running Solaris 7 in 64-bit mode. Note: 32-bit and 64-bit binaries cannot be mixed in the same program. For the full story, see: * The CC.1 man page * The README file, "64bit_Compilers" in /opt/SUNWspro/READMEs * The math-libraries README file in the /SUNWspro/READMEs directory (usually, this is /opt/SUNWspro/READMEs/) * The "Solaris 7 64-bit Developer's Guide" in AnswerBook. 2. New Compiler Options ======================= The following new options are now in place and apply to SPARC processors only; please refer to the CC.1 man page or C++ User's Guide for details: -compat The C++ compiler has two principal modes, one accepts ARM semantics and language defined by the 4.2 compiler (compatibility mode). The other accepts constructs according to the ANSI/ISO standard (standard mode). These two modes are incompatible with each other because the ANSI/ISO standard forces significant, incompatible changes in name mangling, vtable layout and other ABI details. These two modes are differentiated by the -compat option as follows: -compat -compat=4 Sets the compiler for compatibility with C++ 4.0.1, C++ 4.1, and C++ 4.2 compilers. (Specifying -compat is equivalent to specifying -compat=4.) -compat=5 Sets the compiler for compatibility with full C++ 5.0 features. The default is -compat=5. -xcode=a Allows user to specify the memory address model for the compiled program. Available only on SPARC platforms. Enables compilation for 32-, 44-, or 64-bit absolute addresses, as well as the small and large "positionindependent code" models (equivalent to -pic and -PIC). -xhelp=flags Displays list of compiler options. Same as -help. -xhelp=readme Displays contents of online README file. Same as -readme. -xnolibmil Cancel -xlibmil on the command line. -xprefetch[-(yes|no)] (SPARC only) Enables the compiler to use prefetch instructions where appropriate on UltraSPARC II processors. 3. Changed Compiler Options =========================== -features=a Enables/disables various C++ language features. a can have the following values: anachronisms, altspell, arraynew, bool, except, explicit, export, iddollar, localfor, mutable, namespace, rtti. -instances=a Controls the placement and linkage of template instances. a can have the following values: extern, explicit, global semiexplicit, static. -library=l Incorporates specified CC-provided libraries into compilation and linking. l can have the following values: complex, Crun, Cstd, gc, gc_dbg, iostream, libC, rwtools7, rwtools7_dbg, %all, %none. -xarch=v9 Causes compilation for SPARC V9 architecture. The resulting object files are in 64-bit ELF format and can only be linked with other object files in the same format. The resulting executable can be linked and executed on 64-bit Solaris 7 software. (Option available only when compiling in the Solaris 7 environment.) -xarch=v9a Causes compilation for SPARC V9 architecture, adding the Visual Instruction Set (VIS) and extensions specific to UltraSPARC processors. Resulting object code can only be linked and executed on 64-bit UltraSPARC processor running Solaris 7. (Option available only when compiling in the Solaris 7 environment.) 4. Obsolete Compiler Options ============================ -vdelx This is an obsolete flag and will be removed in future releases. This flag is available only for -compat=4. Don't use this flag unless you have bought some software from a third-party vendor and the vendor recommends using this flag -Ztha Prepares code for analysis by the Thread Analyzer, the performance analysis tool for multithreaded code. 5. Access to C++ 4.2 compiler library man pages =============================================== You can access the C++ 4.2 library man pages (libC, libiostream) by using the command: man -s 3CC4 commandname For example, if you want the man page for the 4.2 fstream, type: man -s 3CC4 fstream If you don't use "-s 3CC4" you will get the man pages for the 5.0 iostreams library that is part of libCstd. 6. Patches ========== No information at this time. _________________________________________________________________________ B. Software Incompatibilities Compatibility Problems Between C++ 4.0, 4.1, 4.2 and C++ 5.0 ============================================================ You should compile new code in compatibility mode (-compat=4). You can use either compiler with libraries that are compiled with C++ but have a C interface, but consider the following cases: 1. C++ Interface ================ The mangled names, class layouts and calling sequences are different in C++ 4.0 (and 4.1 and 4.2) and C++ 5.0. There is no binary compatibility possible except with -compat. The following cases are based on the assumption that a library has a C interface and API, but is implemented in C++. Exceptions Exceptions propagated across the API, either from within the library or from routines called through C++ 5.0 code into the library. Array new and delete If arrays of classes allocated with array new or delete are passed across the interface and deleted outside the library, the data structures used for malloc and free will be corrupted. iostreams The C++ compiler now uses standard iostreams as default. However, tools.h++ version 7 is built with classic iostreams. This means that users of tools.h++ must add -library=iostream on the command line when compiling in standard mode. Mixing standard C++ iostreams and classic iostreams in the same program is likely to cause problems if the same file (including cin and cout) is accessed from both classic and standard iostream code. If a given file (including cin and cout) is accessed exclusively from within a library previously compiled with classic iostreams, using standard iostreams on different files should not cause any problems. 2. Libraries ============ Use -compat=4 for compatibility with 4.0.1, 4.1, and 4.2 compilers. Use -compat=5 for 5.0 compiler compatibility. 3. Linking on SPARC V9 Processors under Solaris 7 =================================================== Many static system libraries, such as libm.a and libc.a, are not available for SPARC V9 processors in the Solaris 7 environment. Only dynamic, shared libraries (libm.so, libc.so) are provided. This means that -Bstatic, -dn, and -staticlib may cause linking errors on SPARC V9 Solaris 7 environments. Applications must use the dynamic libraries in these cases. 4. Using multiple template repositories: ============================================= In compilers prior to C++ 5.0, the -ptr flag was used to designate repositories for template instantiations. With C++ 5.0, the -ptr flag is no longer required, as the compilation system automatically determines the location of the repository as well as instantiations. While the -ptr flag is still currently supported for some uses, its use is not recommended as it may not be supported in future releases. Using the -ptr option to share a single template repository for more than one application or library is discouraged. Attempting to do so could lead to compilation failure and unpredictable results at runtime because of template redefinitions. 5. Incompatible mangling of pointers to const member functions ============================================================== The C++ 4.0.1 compiler generated different mangled names for pointers to const member functions than do the C++ 4.1, C++ 4.2, and C++ 5.0 compilers. If you are unable to link with a library built with 4.0.1 and containing such names, you should either recompile the library, or compile the rest of the program with the " -compat -Qoption ccfe -abirel=4.0.1" flags. 6. Unparsable mangling of extern "C" functions as template arguments =================================================================== The C++ 4.0.1 and C++ 4.1 compilers generated a mangled name that was unparsable for templates instantiated with an extern "C" function. As a consequence, debugging tools behaved incorrectly. We have corrected the problem, but some users may be unable to link objects compiled with C++ 5.0 with libraries compiled with earlier compilers. This incompatibility should be extremely rare, but in the event that it does happen, you can either recompile the library with the C++ 5.0 Early Access Release (Refresh), or compile new objects with the "-compat=4" and "-Qoption ccfe -abirel=4.1" flags. _____________________________________________________________________ C. Known CC Bugs The following bugs are known and could not be fixed in time for this release. Check http://www.sun.com/workshop/users/ws.html for updated information about bugs, workarounds, and patches. 1. Using -xar to add generated templates ======================================== When using -xar to add generated templates to an archive, please be aware that this command will both update existing object files in the archive, and add new ones. Existing object files that may be obsolete will still be present. In these cases, the safest course of action would be to delete the .a file prior to the invocation of -xar. 2. Incorrect mangling of pointers to member functions ===================================================== In "compat=4" mode, the C++ compiler incorrectly mangles the link names for pointers to member functions. The consequence of this error is that the demangler, and hence some debugging tools, like dbx and c++filt, report the member functions as having an extra leading parameter consisting of a reference to the class type of which the function is a member. To correct this problem, add the flag "-Qoption ccfe -abiopt=pmfun1". Note, however, that sources compiled with this flag may be binary incompatible with sources compiled without the flag. In compat=5 mode, there is no problem with mangled names. 3. Uninitialized static data (LOCL/OBJT ELF symbols) have no size ================================================================= (Bug ID 4005207) Using -O -g, you can't print uninitialized static variables with dbx. 4. Applications that use an mt-hot library should be built with an -mt option. ========================================================================= (Bug ID 4045325) If your application is linked to a library that uses threads internally, then the application must be compiled/linked with an -mt option, even if the application does not use threads internally. Some of the system libraries on Solaris 2.6 and Solaris 7 use threads internally. An application that uses these libraries might work on earlier versions of Solaris but will have to be rebuilt with an -mt option for it to work on Solaris 2.6 and Solaris 7. 5. Problems mixing standard headers ==================================== Standard C++ now provides two forms of the headers that come from the C language. For each header of the form (for example, ) there is another header of the form (for example, ). You can include either version once or more than once in the same compilation with no ill effects. You can include one version in one compilation and the other version in another compilation and link the two modules together. But if you include both versions in the same module you might get compilation errors due to an error in the implementation. 6. The following Standard C++ library problems are known bugs. ========================================================== Header file problems: There are known problems with standard headers, particularly the new iostream headers. Among other things, they generate lots of warnings when +w is used. 4175225 get rid of many warnings from iostream lib 4174997 undefined symbols if template program uses static variables A program using templates and static objects causes link-time errors of undefined symbols. The compiler currently does not support reference to non-global file-scope objects from templates 7. Standard header problems =========================== There are known problems with standard headers, particularly the new iostream headers. Among other things, they generate numerous warnings when +w is used. __________________________________________________________________________ D. Fixed Software Bugs There is no new information at this time. ___________________________________________________________________________ E. Documentation Errata _____________________________________________________________________________ F. Shippable Libraries If your executable uses a Sun dynamic library listed in the file named below, your license includes the right to redistribute the library to your customer. Standard Install Install to /my/dir/ /opt/SUNWspro/READMEs/runtime.libraries /my/dir/SUNWspro/READMEs/runtime.libraries You may not redistribute or otherwise disclose the header files, source code, object modules, or static libraries of object modules in any form. The License to Use appears in the End User Object Code License, viewable from the back of the plastic case containing the CDROM. ____________________________________________________________________________ Solaris, SunOS, OpenWindows and AnswerBook are trademarks or registered trademarks of Sun Microsystems, Inc. All SPARC trademarks, including the SCD Compliant logo are trademarks of SPARC International, Inc.