Rules For Procedures - HP eld Manual

Table of Contents

Advertisement

Binding of References
The linker uses the st_size field in the ELF symbol tables of its input files to
understand the sizes of data items. When there are multiple definitions of a
data item eld reports an error if the sizes are not the same.
It is not an error if some of the definitions have initial values (i.e., in the .data or
.sdata sections) and others don't (i.e., in the .bss or .sbss sections). However,
eld reports an error if the initial values are not the same in all the copies of the
data that are initialized. Data in the .bss and .sbss sections is considered to
have the initial value zero.
When there are multiple definitions of a data item, and it is not an error, the linker must
choose which copy to use. The linker makes this choice by comparing copies in the
following ways:
Choose an instance that is initialized over one that isn't (i.e., choose .data or
.sdata over .bss or .sbss).
If that doesn't narrow it down to one choice, choose an instance whose
language is C or C++ over one that isn't. Doing this, after the previous rule, is
convenient for enforcing the rules given above about initialized definitions in C
and C++.
If that doesn't narrow it down to one choice, choose the first instance
encountered.
Note that the linker does not care whether various definitions are short data (namely,
the .sdata, .srdata, and .sbss sections) versus long data (namely, the .data,
.rdata, and .bss sections). If the above rules cause the linker to choose a copy of a
symbol that cannot be reached by 22-bit GP-relative addressing, and 22-bit GP-
relative addressing is used for the symbol, it is an error.

Rules for Procedures

Here are the rules concerning multiple definitions of a procedure:
It is an error unless either the STO_MULTIPLE_DEF_OK bit is set in all the
corresponding ELF symbol table entries, or the -allow_duplicate_procs option
is used.
It is an error if any copy of the procedure has the CALLABLE or
KERNEL_CALLABLE attribute.
It is an error if the various copies do not all agree on the MAIN, SHELL,
EXTENSIBLE, and COMPILED_NONSTOP attributes.
There is no requirement that multiple definitions of the same procedure contain the
same code or have the same size.
When there are multiple definitions of a procedure, and it is not an error, the linker
must choose which copy to use.
eld Manual—527255-009
3-18
Rules for Procedures

Advertisement

Table of Contents
loading

Table of Contents