eld Manual

Table Of Contents
Other eld Processing
eld Manual527255-009
4-17
Specification of the Main Entry Point
Checks are only performed against DLLs that the linker actually saw. For example, the
linker is not required to search for indirect DLLs if it is not presetting and not checking
for unresolved symbols, so in that case it is not required to perform floating point
consistency checking against such indirect DLLs.
Whenever the linker builds a new linkfile or loadfile it checks for the consistency of the
data model among its input linkfiles, because the two data models cannot be
intermixed in the same loadfile, and the data model of the input linkfiles determines the
data model for the output file. More specifically, at the present time, the linker does not
allow the 64-bit data model at all, but in the future that will be relaxed. There is no
checking for consistency against DLLs, because loadfiles with different data models
are allowed in the same process.
Specification of the Main Entry Point
There are two ways to specify the main entry point of a loadfile. One is to use the -e
option, specifying the name of a procedure. The other way is for a procedure to have
the MAIN attribute.
In a program, the e_entry field is filled in with the address of the real code for the main
entry point. In a DLL, if it has a main entry point, then that procedure must have an
official function descriptor, and the e_entry field contains the address of that official
function descriptor.
When the -e option is specified the linker checks that it is the name of a procedure
that is defined in this object file (otherwise it is an error). eld reports an error if this
procedure has the CALLABLE or KERNEL_CALLABLE attribute. Additional rules
depend on the type of file that the linker is building:
If the linker is building a program then eld reports an error if no main entry
point has been specified by either of the above methods. The linker will put out
a warning if the -e option is used and the program has a procedure with the
MAIN attribute, unless the same procedure is indicated in both cases. The
linker uses the -e option to determine the main entry point, overriding the fact
that a procedure had the MAIN attribute.
If the linker is building a DLL then eld reports an error if any procedure has the
MAIN attribute. However, the -e option is allowed. If the -e option is not
provided then the e_entry field contains zero.
If the linker is building a linkfile then the -e option has a different purpose.
Namely, it turns on the MAIN attribute in the .procinfo entry for the specified
name. The e_entry field of the ELF header in a linkfile always contains zero.
When the linker is building a loadfile
eld reports an error if more than one procedure
has the MAIN attribute, unless the -allow_multiple_mains option is used. When
there are multiple procedures with the MAIN attribute, and this is not an error, the linker
pays attention to the MAIN attribute on the first procedure that it sees with it. This
ordering is implied by the order in which the linker finds linkfiles from the command
stream and the ordering of the entries in the .procinfo sections of the linkfiles.