Chapter Contents

Previous

Next
Code Generation Conventions

Compiler-generated Names

During compilation, the compiler creates names for various data objects in the compilation. In general, compiler-generated names are based on the section name. The section name, in turn, can be specified by the sname option or determined by default.

In general, compiler-generated external names are created by appending one or more special characters to the section name. Each type of data object has a unique special character associated with it. If the section name is less than seven characters long, then all of the created names are suffixed by an @ , followed by the special character for the data object type (unless that is a second @ ). If the section name is exactly seven characters long, then only the special character is used as the suffix.


Control Section Names

The compiler creates one or more control sections (CSECTs) for a compilation. Each CSECT contains a specific type of data; for example, there is a separate CSECT for the executable code for the functions in the compilation. The number of CSECTs created varies depending on the compilation and the compiler options used. Control Section Suffixes lists the possible CSECT suffixes and compiler options that may cause the CSECT to be created.

Control Section Suffixes
Suffix Type of Data Compiler Options
@ executable code (any)
: constants (any)
$ string literals (any)
$ static data norent, rentext
= initialization data rent, rentext
? line number/offset table lineno, debug
+ run-time constants (always generated)
> extended funtion names extname
< extended identifiers other than function names extname


Run-time constants

The run-time constants CSECT contains data items used by the library or the debugger during program execution. The program itself, or another program, such as a dump analysis program, may also refer to the data in the run-time constants CSECT.

The following structure definition shows how the compiler stores the run-time constants in this CSECT:

struct Run_Time_Constants {
   int RESERVED1;
   int RESERVED2;
   void *RESERVED3;
   void *ext_names;
   char datetime1[16] ;
   char sname[8] ;
   time_t datetime2
   void *statics;
   int RESERVED4;
   int dbg_filename_len;
   char dbg_fileneame[1];
};

The ext_names field is a pointer to the extended function names CSECT or is NULL if an extended function names CSECT does not exist. The datetime1 field is the compilation date and time in character format. The date and time field is 16 bytes long and is in the following format:

ddMMMyy hh:mm:ss

An example of the format of the date and time field follows:

19DEC90 12:34:56

Under OS/390, the sname field contains the section name of the compilation and is terminated by a 0 byte. Under CMS, the sname field contains the filename of the source file. The filename is not terminated with a 0 byte if it is exactly eight characters long. The datetime2 field is the compilation date and time in numeric time_t format. For more information on the type time_t see "Timing Functions," in Chapter 2 of SAS/C Library Reference, Volume 2. The statics field is the pointer to the static data or string literal CSECT, that is, the CSECT with a name ending in a dollar sign ($).

Note:    All of the fields in this structure definition are reserved for use by the compiler, library, or debugger and should not be modified. Modification may result in unpredictable results.  [cautionend]

At runtime, the address of the run-time constants CSECT is at offset +8 in the constants CSECT. General register 4 always contains the address of the constants CSECT at execution time. The address of the constants CSECT is also stored at decimal offset 36 from the start of each function.

OMD370 disassembles the run-time constants CSECT when the verbose option is specified.

Extended names CSECTs

The CSECTs for extended function names and extended identifiers other than function names are created when the extname option is specified. See External Variables for a detailed discussion of the extended names CSECTs. OMD370 displays the extended names CSECTs when the verbose option is specified.

Exceptions

When the norent option is used, function pointers are defined as CSECTs. If the function name is seven or fewer characters long, the CSECT name is created by prefixing an ampersand ( & ) to the function name. If the function name is longer than seven characters, the compiler generates a special name, only distantly related to the actual name of the function, beginning with an unusual character.

In addition to the names described above, the compiler may generate other CSECTs or pseudoregisters that do not follow the same naming convention. Typical examples are @EXTERN#, the CSECT containing initialization data for external variables stored in pseudoregisters; and @ISOL@, used for a CSECT when no section name can be determined. (This occurs only when the compilation contains no externally visible functions or data.)


Pseudoregister Names

When the compiler options rent and rentext are used, the compiler creates pseudoregisters to contain certain types of external and static data (see External Variables). The names of the pseudoregisters are created as described in the previous sections. The table below lists the possible pseudoregister suffixes

Suffix
*
&


The const Type Qualifier

If either the rent or rentext compiler option is used, defined external and static objects that are qualified as const are placed in the string literal CSECT if possible. See Placement of Data


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.