Microware C Compiler User's Guide for OS-9 Microware C Compiler User's Guide: for OS-9 Copyright © 1983 Microware Systems Corporation
Total Page:16
File Type:pdf, Size:1020Kb
Microware C Compiler User's Guide for OS-9 Microware C Compiler User's Guide: for OS-9 Copyright © 1983 Microware Systems Corporation. All rights reserved. Reproduction of this document, in part or whole, by any means, electrical or otherwise, is prohibited, except by written permission from Microware Systems Corporation. The information contained herein is believed to be accurate as of the date of publication, however, Microware will not be liable for any damages, including indirect or consequential, from use of the OS-9 operating system or reliance on the accuracy of this documentation. The information contained herein is subject to change without notice. Acknowledgements ...................................................................................................... vii Differences between Versions 1.1 and 1.0 ........................................................................ ix 1. The C Compiler System ............................................................................................. 1 1.1. Introduction .................................................................................................... 1 1.2. The Language Implementation ........................................................................... 1 1.3. Differences from the K & R Specification ........................................................... 1 1.4. Enhancements and Extensions ........................................................................... 1 1.4.1. The “Direct” Storage Class .................................................................... 1 1.4.2. Embedded Assembly Language ............................................................... 2 1.4.3. Control Character Escape Sequences ........................................................ 2 1.5. Implementation-dependent Characteristics ........................................................... 3 1.5.1. Data Representation and Storage Requirements .......................................... 3 1.5.2. Register Variables ................................................................................. 3 1.5.3. Access To Command Line Parameters ...................................................... 4 1.5.4. References to drive names ...................................................................... 4 1.6. System Calls and the Standard Library ................................................................ 4 1.6.1. Operating System Calls ......................................................................... 4 1.6.2. The Standard Library ............................................................................ 4 1.7. Run-time Arithmetic Error Handling ................................................................... 4 1.8. Achieving Maximum Program Performance ......................................................... 5 1.8.1. Programming Considerations .................................................................. 5 1.8.2. The Optimizer Pass ............................................................................... 5 1.8.3. The Profiler ......................................................................................... 5 1.9. C Compiler Component Files and File Usage ....................................................... 5 1.9.1. Temporary Files ................................................................................... 6 1.10. Running the Compiler .................................................................................... 6 1.11. Compiler Option Flags ................................................................................... 7 2. Characteristics of Compiled Programs ........................................................................... 9 2.1. The Object Code Module ................................................................................. 9 2.1.1. Module Header .................................................................................... 9 2.1.2. Execution Offset ................................................................................. 10 2.1.3. Storage Size ....................................................................................... 10 2.1.4. Module Name .................................................................................... 10 2.1.5. Information ........................................................................................ 10 2.1.6. Executable Code ................................................................................. 10 2.1.7. String Literals .................................................................................... 10 2.1.8. Initializing Data and its Size ................................................................. 10 2.1.9. Data References .................................................................................. 10 2.2. Memory Management .................................................................................... 11 2.2.1. Typical C Program Memory Map .......................................................... 11 2.2.2. Compile Time Memory Allocation ......................................................... 12 3. C System Calls ........................................................................................................ 15 Abort ................................................................................................................. 15 Access ............................................................................................................... 15 Chain ................................................................................................................. 16 Chdir ................................................................................................................. 16 Chmod ............................................................................................................... 17 Chown ............................................................................................................... 17 Close ................................................................................................................. 18 Crc .................................................................................................................... 18 Creat ................................................................................................................. 19 Defdrive ............................................................................................................. 20 Dup ................................................................................................................... 20 Exit ................................................................................................................... 20 Getpid ................................................................................................................ 21 Getstat ............................................................................................................... 21 Getuid ................................................................................................................ 22 Intercept ............................................................................................................. 23 iii Microware C Compiler User's Guide Kill ................................................................................................................... 24 Lseek ................................................................................................................. 24 Mknod ............................................................................................................... 25 Modload ............................................................................................................. 26 Munlink ............................................................................................................. 27 Open ................................................................................................................. 27 _os9 .................................................................................................................. 28 Os9fork .............................................................................................................. 29 Pause ................................................................................................................. 30 Prerr .................................................................................................................. 30 Read .................................................................................................................. 30 Sbrk .................................................................................................................. 31 Setpr .................................................................................................................. 32 Setime ............................................................................................................... 32 Setuid ................................................................................................................ 32 Setstat ................................................................................................................ 33 Signal ................................................................................................................ 33 Stacksize ............................................................................................................ 35 Strass ................................................................................................................. 35 Tsleep ...............................................................................................................