C User’s Guide Sun™ Studio 10 Sun Microsystems, Inc. www.sun.com Part No. 819-0494-10 January 2005, Revision A Submit comments about this document at: http://www.sun.com/hwdocs/feedback Copyright © 2005 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Use is subject to license terms. This distribution may include materials developed by third parties. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and in other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, Java, and JavaHelp are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon architecture developed by Sun Microsystems, Inc. This product is covered and controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited. DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. Copyright © 2005 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, Etats-Unis. Tous droits réservés. L’utilisation est soumise aux termes de la Licence. Cette distribution peut comprendre des composants développés par des tierces parties. Des parties de ce produit pourront être dérivées des systèmes Berkeley BSD licenciés par l’Université de Californie. UNIX est une marque déposée aux Etats-Unis et dans d’autres pays et licenciée exclusivement par X/Open Company, Ltd. Sun, Sun Microsystems, le logo Sun, Java, et JavaHelp sont des marques de fabrique ou des marques déposées de Sun Microsystems, Inc. aux Etats-Unis et dans d’autres pays.Toutes les marques SPARC sont utilisées sous licence et sont des marques de fabrique ou des marques déposées de SPARC International, Inc. aux Etats-Unis et dans d’autres pays. Les produits portant les marques SPARC sont basés sur une architecture développée par Sun Microsystems, Inc. Ce produit est soumis à la législation américaine en matière de contrôle des exportations et peut être soumis à la règlementation en vigueur dans d’autres pays dans le domaine des exportations et importations. Les utilisations, ou utilisateurs finaux, pour des armes nucléaires,des missiles, des armes biologiques et chimiques ou du nucléaire maritime, directement ou indirectement, sont strictement interdites. Les exportations ou réexportations vers les pays sous embargo américain, ou vers des entités figurant sur les listes d’exclusion d’exportation américaines, y compris, mais de manière non exhaustive, la liste de personnes qui font objet d’un ordre de ne pas participer, d’une façon directe ou indirecte, aux exportations des produits ou des services qui sont régis par la législation américaine en matière de contrôle des exportations et la liste de ressortissants spécifiquement désignés, sont rigoureusement interdites. LA DOCUMENTATION EST FOURNIE "EN L’ÉTAT" ET TOUTES AUTRES CONDITIONS, DECLARATIONS ET GARANTIES EXPRESSES OU TACITES SONT FORMELLEMENT EXCLUES, DANS LA MESURE AUTORISEE PAR LA LOI APPLICABLE, Y COMPRIS NOTAMMENT TOUTE GARANTIE IMPLICITE RELATIVE A LA QUALITE MARCHANDE, A L’APTITUDE A UNE UTILISATION PARTICULIERE OU A L’ABSENCE DE CONTREFAÇON. Contents Before You Begin xxxiii Typographic Conventions xxxiv Shell Prompts xxxv TABLE P-2Supported Platforms –xxxv Accessing Sun Studio Software and Man Pages xxxv Accessing Compilers and Tools Documentation xxxviii Accessing Related Solaris OS Documentation xl Resources for Developers xli Contacting Sun Technical Support xli Sending Your Comments xli 1. Introduction to the C Compiler 1–1 1.1 New Features and Functionality of the Sun Studio 10 C 5.7 Compiler 1–1 1.2 New Features and Functionality of the Sun Studio 9 C 5.6 Compiler 1–2 1.2.1 Improved Performance 1–2 1.2.2 Improved Optimization 1–4 1.2.3 Expanded C99 Compliance 1–5 1.2.4 Expanded Support for the x86 Architecture 1–5 1.2.5 Support for New SPARC Chips 1–7 1.2.6 New Security Checks 1–7 iii 1.3 Standards Conformance 1–7 1.4 C Readme File 1–8 1.5 Man Pages 1–9 1.6 Organization of the Compiler 1–9 1.7 C-Related Programming Tools 1–11 2. C-Compiler Information Specific to Sun’s Implementation 2–1 2.1 Constants 2–1 2.1.1 Integral Constants 2–1 2.1.2 Character Constants 2–2 2.2 Linker Scoping Specifiers 2–3 2.3 Thread Local Storage Specifier 2–3 2.4 Floating Point, Nonstandard Mode 2–4 2.5 Labels as Values 2–5 2.6 long long Data Type 2–8 2.6.1 Printing long long Data Types 2–8 2.6.2 Usual Arithmetic Conversions 2–8 2.7 Assertions 2–9 2.8 Pragmas 2–10 2.8.1 align 2–10 2.8.2 does_not_read_global_data 2–11 2.8.3 does_not_return 2–11 2.8.4 does_not_write_global_data 2–12 2.8.5 error_messages 2–12 2.8.6 fini 2–12 2.8.7 hdrstop 2–13 2.8.8 ident 2–13 2.8.9 init 2–14 2.8.10 inline 2–14 iv C User’s Guide • January 2005 2.8.11 int_to_unsigned 2–15 2.8.12 MP serial_loop 2–15 2.8.13 MP serial_loop_nested 2–15 2.8.14 MP taskloop 2–15 2.8.15 nomemorydepend 2–15 2.8.16 no_side_effect 2–16 2.8.17 opt 2–16 2.8.18 pack 2–16 2.8.19 pipeloop 2–17 2.8.20 rarely_called 2–18 2.8.21 redefine_extname 2–18 2.8.22 returns_new_memory 2–19 2.8.23 unknown_control_flow 2–20 2.8.24 unroll 2–20 2.8.25 weak 2–21 2.9 Predefined Names 2–22 2.10 The Value of errno 2–23 2.11 _Restrict Keyword 2–23 2.12 _ _asm Keyword 2–23 2.13 Environment Variables 2–24 2.13.1 OMP_DYNAMIC 2–24 2.13.2 OMP_NESTED 2–24 2.13.3 OMP_NUM_THREADS 2–24 2.13.4 OMP_SCHEDULE 2–24 2.13.5 PARALLEL 2–24 2.13.6 SUN_PROFDATA 2–24 2.13.7 SUN_PROFDATA_DIR 2–25 2.13.8 SUNPRO_SB_INIT_FILE_NAME 2–25 Contents v 2.13.9 SUNW_MP_THR_IDLE 2–25 2.13.10 TMPDIR 2–25 2.14 How to Specify Include Files 2–26 2.14.1 Using the -I- Option to Change the Search Algorithm 2–27 3. Parallelizing Sun C Code 3–1 3.1 Overview 3–1 3.1.1 Example of Use 3–1 3.2 Parallelizing for OpenMP 3–2 3.2.1 Handling OpenMP Runtime Warnings 3–2 3.3 Environment Variables 3–2 3.4 Data Dependence and Interference 3–5 3.4.1 Parallel Execution Model 3–7 3.4.2 Private Scalars and Private Arrays 3–8 3.4.3 Storeback 3–10 3.4.4 Reduction Variables 3–11 3.5 Speedups 3–11 3.5.1 Amdahl’s Law 3–12 3.6 Load Balance and Loop Scheduling 3–15 3.6.1 Static or Chunk Scheduling 3–15 3.6.2 Self Scheduling 3–15 3.6.3 Guided Self Scheduling 3–16 3.7 Loop Transformations 3–16 3.7.1 Loop Distribution 3–16 3.7.2 Loop Fusion 3–17 3.7.3 Loop Interchange 3–19 3.8 Aliasing and Parallelization 3–20 3.8.1 Array and Pointer References 3–20 3.8.2 Restricted Pointers 3–21 vi C User’s Guide • January 2005 3.8.3 Explicit Parallelization and Pragmas 3–22 4. Incremental Link Editor (ild) 4–1 4.1 Introduction 4–1 4.2 Overview of Incremental Linking 4–2 4.3 How to Use ild 4–2 4.4 How ild Works 4–4 4.5 What ild Cannot Do 4–5 4.6 Reasons for Full Relinks 4–5 4.6.1 ild Deferred-Link Messages 4–6 4.6.2 ild Relink Messages 4–6 4.6.3 Example 1: Internal Free Space Exhausted 4–7 4.6.4 Example 2: Running strip 4–7 4.6.5 Example 3: ild Version 4–8 4.6.6 Example 4: Too Many Files Changed 4–8 4.6.7 Example 5: Full Relink 4–8 4.6.8 Example 6: New Working Directory 4–9 4.7 ild Options 4–9 4.7.1 -a 4–9 4.7.2 -B dynamic | static 4–10 4.7.3 -d y|n 4–10 4.7.4 -e epsym 4–10 4.7.5 -g 4–10 4.7.6 -I name 4–10 4.7.7 -i 4–11 4.7.8 -Lpath 4–11 4.7.9 -lx 4–11 4.7.10 -m 4–11 4.7.11 -o outfile 4–11 Contents vii 4.7.12 -Q y|n 4–12 4.7.13 -Rpath 4–12 4.7.14 -s 4–12 4.7.15 -t 4–12 4.7.16 -u symname 4–12 4.7.17 -V 4–12 4.7.18 -xildoff 4–13 4.7.19 -xildon 4–13 4.7.20 -YP,dirlist 4–13 4.7.21 -z allextract|defaultextract| weakextract 4–13 4.7.22 -z defs 4–13 4.7.23 -z i_dryrun 4–14 4.7.24 -z i_full 4–14 4.7.25 -z i_noincr 4–14 4.7.26 -z i_quiet 4–14 4.7.27 -z i_verbose 4–14 4.7.28 -z nodefs 4–14 4.8 Options Passed to ild From the Compilation System 4–14 4.8.1 -a 4–15 4.8.2 -e epsym 4–15 4.8.3 -I name 4–15 4.8.4 -m 4–15 4.8.5 -t 4–15 4.8.6 -u symname 4–15 4.8.7 Environment 4–16 4.9 ld Options Not Supported by ild 4–17 4.9.1 -B symbolic 4–18 4.9.2 -b 4–18 viii C User’s Guide • January 2005 4.9.3 -G 4–18 4.9.4 -h name 4–18 4.9.5 -z muldefs 4–18 4.9.6 -z text 4–19 4.10 Additional Unsupported Commands 4–19 4.10.1 -D token,token, … 4–19 4.10.2 -F name 4–19 4.10.3 -M mapfile 4–19 4.10.4 -r 4–19 4.11 Files That ild Uses 4–20 5.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages474 Page
-
File Size-