[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Assembler Language Reference

.hash Pseudo-op

Purpose

Associates a hash value with an external symbol.

Syntax

.hash Name,StringConstant

Description

The hash string value contains type-checking information. It is used by the link-editor and program loader to detect variable mismatches and argument interface errors prior to the execution of a program.

Hash string values are usually generated by compilers of strongly typed languages. The hash value for a symbol can only be set once in an assembly. See Type-Check Section in the XCOFF Object (a.out) File Format for more information on type encoding and checking.

Parameters

Name Represents a symbol. Because this should be an external symbol, Name should appear in an .extern or .global statement.
StringConstant Represents a type-checking hash string value. This parameter consists of characters that represent a hexadecimal hash code and must be in the set [0-9A-F] or [0-9a-f].

A hash string comprises the following three fields:

  • Language Identifier is a 2-byte field representing each language. The first byte is 0x00. The second byte contains predefined language codes that are the same as those listed in the .source pseudo-op.
  • General Hash is a 4-byte field representing the most general form by which a data symbol or function can be described. It is the greatest common denominator among languages supported by AIX. A universal hash can be used for this field.
  • Language Hash is a 4-byte field containing a more detailed, language-specified representation of data symbol or function.
Note: A hash string must have a length of 10 bytes. Otherwise, a warning message is reported when the -w flag is used. Since each character is represented by two ASCII codes, the 10-byte hash character string is represented by a string of 20 hexadecimal digits.

Examples

The following example illustrates the use of the .hash pseudo-op:

   .extern b[pr]
   .extern a[pr]
   .extern e[pr]
   .hash b[pr],"0000A9375C1F51C2DCF0"
   .hash a[pr],"ff0a2cc12365de30"  # warning may report
   .hash e[pr],"00002020202051C2DCF0"

Related Information

Pseudo-ops Overview.

Type-Check Section in XCOFF Object (a.out) File Format.

The .extern pseudo-op, .globl pseudo-op.


[ Previous | Next | Contents | Home | Search ]