ASSERT Attribute
The ASSERT attribute is used to specify the expected
characteristics of the symbol. The link-editor compares the symbol
characteristics that result from the link-edit to those given by
ASSERT attributes. If the real and asserted attributes do
not agree, a fatal error is issued and the output object is not created.
The interpretation of the ASSERT attribute is dependent on
whether the STUB_OBJECT directive or
-z stub command line option are used. The three
possible cases are as follows.
-
ASSERTattributes are not required when theSTUB_OBJECTdirective is not used. However, ifASSERTattributes exist, their attributes are verified against the real values collected with the link-edit. Should anyASSERTattributes not match their associated real values, the link-edit terminates unsuccessfully. -
When the
STUB_OBJECTdirective is used, and the-z stubcommand line option is specified, the link-editor uses theASSERTdirectives to define the attributes of the global symbols provided by the object. See Stub Objects. -
When the
STUB_OBJECTdirective is used, and-z stubcommand line option is not specified, the link-editor requires that all global data in the resulting object have an associatedASSERTdirective that declares it as data and supplies a size. In this mode, if theTYPEASSERTattribute is not specified,GLOBALis assumed. Similarly, ifSH_ATTRis not specified, a default value ofBITSis assumed. These defaults ensure that the data attributes of the stub and real objects are compatible. The resultingASSERTstatements are evaluated in the same manner as in the first case. See STUB_OBJECT Directive.
ASSERT accepts the following attributes.
-
ALIAS -
Defines an alias for a previously defined symbol. An alias symbol has the same type, value, and size as the main symbol. The
ALIASattribute cannot be used with theTYPE,SIZE, andSH_ATTRattributes. WhenALIASis specified, the type, size, and section attributes are obtained from the alias symbol. -
BINDING -
Specifies an ELF symbol_binding, which can be any of the
STB_values defined in<sys/elf.h>, with theSTB_prefix removed. For example,GLOBAL, orWEAK. -
TYPE -
Specifies an ELF symbol_type, which can be any of the
STT_constants defined in<sys/elf.h>, with theSTT_prefix removed. For example,OBJECT,COMMON, orFUNC. In addition, for compatibility with othermapfileusage,FUNCTIONandDATAcan be specified forSTT_FUNCandSTT_OBJECT, respectively.TYPEcannot be used withALIAS. -
SH_ATTR -
Specifies attributes of the section associated with the symbol. The section_attributes that can be specified are given in Table 10-9.
SH_ATTRcannot be used withALIAS. -
SIZE -
Specifies the expected symbol size.
SIZEcannot be used withALIAS. The syntax for the size_value argument is as described in the discussion of theSIZEattribute. See SIZE Attribute. -
VALUE -
Specifies the expected symbol value.
Table 10-9
SH_ATTR Values
| Section Attribute | Meaning |
|---|---|
|
|
Section is not of type
|
|
|
Section is of type |