Relocation format for linking

Data processing: software development – installation – and managem – Software program development tool – Linking

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

Reexamination Certificate

active

06704928

ABSTRACT:

FIELD OF THE INVENTION
The present invention relates to a relocation format for linking, and in particular to a method of linking, a linker and a computer program product containing relocation instructions.
BACKGROUND OF THE INVENTION
Linkers for producing executable programs are known. Generally speaking, a linker acts to link a number of object code modules to form a single executable program. Object code modules are usually generated from program source code modules, these modules being written in a high level language. An assembler/compiler reads each source code module and assembles and/or compiles the high level language of the source code module to produce an object code module. The assembler also generates a number of relocations which are used to combine the object code modules at link time in a linker.
The ELF (executable linking format) standard defines a convention for naming relocations belonging to a given section, e.g. rela.abc is relocation section of section space .abc. Standard relocations under the ELF format allow an offset in section data to be defined where patching is to occur and a symbol whose value is to be patched. A type field also exists which is used to describe the appropriate method of encoding the value of the symbol into the instruction or data of the section data being patched. According to the existing arrangements, the relocation type definitions are usually created on an ad hoc basis for each instruction set targeted. The 32 bit ELF standard allows only 256 distinct relocation types, so the same types are reascribed to different semantics for each instruction set.
The existing linkers each have to be set up to understand the particular semantics used for the type definitions in the relocations for each instruction set. Moreover, the relocation operations which can be defined by the relocations are limited in the existing ELF standard.
It is an object of the present invention to increase the flexibility of operation of a linker at link time, in particular in relation to code optimizations for the executable program.
SUMMARY OF THE INVENTION
According to an aspect of the present invention there is provided a method of preparing an executable program from a plurality of object code modules, at least one of said object code modules including section data specifying a plurality of code sequences each associated with relocation instructions identifying condition parameters, the method comprising: reading said relocation instructions and determining for each condition parameter whether or not the condition specified for that parameter is satisfied; on the basis of the determination of the condition parameters, selecting only one of said code sequences for inclusion in the executable program; and preparing the executable program including said selected code sequence in the section data.
One of the relocation instructions causes a value for use for determining the condition to be pushed onto a stack.
Another relocation instruction conveys an index so that the top of the stack value can be held in a condition array at the index for subsequent use. To access the value, a fetch relocation instruction conveys the index which allows the value to be recalled from the condition array.
The optional code sequences can be held in a special section (.macro) of the object code module itself, the location of the special section being identified in the relocation instructions. Alternatively, the code sequences can be held within the section data itself where the selected code sequence is to be included.
As a further alternative, the code sequences can be held in library object files separate from the object code module which are read by the linker at link time, the code sequences being specified by the relocation instructions.
The invention provides in a further aspect a linker for preparing an executable program from a plurality of object code modules, each module containing section data specifying a plurality of optional code sequences, each associated with relocation instructions, the linker comprising: a stack for holding values; a relocation module for reading said relocation instructions and carrying out relocation operations on the section data; wherein the relocation module is responsive to a value recalled from the stack to select one of said code sequences in dependence on said value; a section data module for holding section data which is subject to said relocation operations; and a program forming module for preparing the executable program, wherein the program forming module introduces only the selected code sequence into the section data.
The linker can comprise a parameter array holding a set of parameters each associated with a respective index, said parameters modifying said optional code sequences.
The relocation module can comprise means for implementing calculations conveyed by the relocation instructions using the values on the stack.
The linker can include a symbol table which holds values in association with symbols, said symbols being conveyed by the relocation instructions.
In another aspect the invention provides a computer program product in the form of an object code module comprising section data specifying a plurality of code sequences each having relocation instructions associated therewith, wherein the computer program product is cooperable with a linker to resolve conditions conveyed by the relocation instructions based on values held at the linker in order to determine which of said code sequences is to be included in a final executable program formed by the linker.
A still further aspect of the invention provides a method of assembling an object code module for linking to form an executable program, said object code module including section data for inclusion in the executable program and relocation instructions for controlling relocation operation at link time, the method comprising: executing a set of assembler directives and generating said relocation instructions responsive to the assembler directives, said directives including a conditional directive; responsive to the conditional directive, marking a plurality of code sequences in the section data as optional code sequences for conditional inclusion in the executable program, said marking step including generating relocation instructions identifying conditions resolvable at link time to determine which of said code sequences is to be included in the executable program.
The following described embodiment of the present invention allows code sequences to be conditionally included in section data. Conditional assembler directors are provided which instruct the linker to delete section data. In the simplest embodiment, all the alternative sequences are present in the section. This can cause object files to become bloated in the case of commonly used idioms, and therefore it can be useful to locate the alternative code sequences in a special section of the object code module or to rely on library object files.
At link time, the linker makes multiple passes over the sections relocations recording which conditional passages are included. This considerably increases the possibilities of optimization at link time, or linker relaxation.


REFERENCES:
patent: 5029078 (1991-07-01), Iwai
patent: 5193180 (1993-03-01), Hastings
patent: 5317704 (1994-05-01), Izawa et al.
patent: 5355475 (1994-10-01), Tanaka et al.
patent: 5553286 (1996-09-01), Lee
patent: 5604905 (1997-02-01), Tevanian et al.
patent: 5613120 (1997-03-01), Palay et al.
patent: 5659753 (1997-08-01), Murphy et al.
patent: 5819097 (1998-10-01), Brooks et al.
patent: 5835701 (1998-11-01), Hastings
patent: 5845118 (1998-12-01), Gheith
patent: 6112025 (2000-08-01), Mulchandani et al.
patent: 6205580 (2001-03-01), Hirose
patent: 6206584 (2001-03-01), Hastings
patent: 6219830 (2001-04-01), Eidt et al.
patent: 6298479 (2001-10-01), Chessin et al.
patent: 6351848 (2002-02-01), Chessin
patent: 6467084 (2002-10-01), Howard et al.
patent: 6496910 (2002-12-01), Baentsch et al.
patent: 0 962 859 (1999-12-01), None
Data Relocation and P

LandOfFree

Say what you really think

Search LandOfFree.com for the USA inventors and patents. Rate them and share your experience with other people.

Rating

Relocation format for linking does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Relocation format for linking, we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Relocation format for linking will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3249850

  Search
All data on this website is collected from public sources. Our data reflects the most accurate information available at the time of publication.