• Keine Ergebnisse gefunden

Branch Optimization Function

CHAPTER 5 L INKER

5.11 Branch Optimization Function

The PC relative branch instructions (jr, jrc, jrnc, jrz, jrnz and calr) need an address extension instruction (ldb %ext, imm8) when the relative distance to the destination address exceeds the -127 to 128 range.

Since the location of relocatable sections is not decided until the linking process is completed, the linker has a function that automatically inserts, removes or corrects the extension codes. This makes it possible to omit the address extension instruction in the source. However, this function is valid only for the branch instructions that use a label to specify the destination address.

This function can be disabled by specifying the -d option. The -dr option can also be specified to disable only the extension code deletion function (in the case of the -d option is not specified).

The linker checks the distance from a PC relative branch instruction code to the branch destination label, and inserts, removes or corrects the extension codes according to the check results.

(1) When the branch destination is located within the -127 to +128 range from the branch instruction:

If the branch instructon code does not have an extension code, no extension code is inserted.

If the branch instruction has an extension code, it is removed (if the -dr option is specified, existing expansion code will not be removed).

Examples:

jr LABEL → jr LABEL

ldb %ext,LABEL@rh

calr LABEL@rl → calr LABEL@rl

(2) When the branch destination is located outside the -127 to +128 range from the branch instruction:

If the branch instructon code does not have an extension code, an appropriate extension code is inserted.

If the branch instruction has an illegal extension code, it is replaced with a correct extension code.

Examples:

jr LABEL → ldb %ext,LABEL@rh jr LABEL@rl ldb %ext,LABEL1@rh → ldb %ext,LABEL2@rh calr LABEL2@rl calr LABEL2@rl

5.12 Error/Warning Messages

5.12.1 Errors

When an error occurs, the linker will immediately terminate the processing after displaying an error message. No object file will be output. Other files will be delivered only in the part which was processed prior to the occurrence of the error.

The error messages are given below.

Error message Description

Branch destination too far from <address> The branch destination address is out of range.

CALZ for non zero page at <address> The specified address is out of the range (0x0000–0x00ff).

Cannot create absolute object file <FILE NAME> The absolute object file cannot be created.

Cannot open <file kind> file <FILE NAME> The file cannot be opened.

Cannot read <file kind> file <FILE NAME> The file cannot be read.

Cannot relocate <section kind> section of The relocatable section cannot be allocated.

<FILE NAME>

Cannot write <file kind> file <FILE NAME> Data cannot be written to the file.

Illegal address range <address> for a code at The address specified by TST/SET/CLR is out of the range

<address> (0x0000–0x003f or 0xffC0–0xffff).

Illegal file name <FILE NAME> The file name is incorrect.

Illegal file name <FILE NAME> specified with The file name specified with the option is incorrect.

option <option>

Illegal ICE parameter at line <line number> of The ICE parameter file contains an illegal parameter setting.

<FILE NAME>

Illegal object <FILE NAME> The input file is not an object file in IEEE-695 format.

Illegal option <option> An illegal option is specified.

No address specified with option <option> Address is not specified with the option.

No code to locate There is no valid code for mapping.

No ICE parameter file specified ICE parameter file is not specified.

No name and address specified with option <option> Name and address are not specified with the option.

No object file specified Object files to be linked are not specified.

Out of memory Cannot secure memory space.

<section kind> section <address>-<address> overlaps The address range of the section overlaps with another with <section kind> section <address>-<address> section's address range.

<section kind> section <address>-<address> overlaps The address range of the section overlaps with the

with the unavailable memory unavailable memory.

Unresolved external <label> in <FILE NAME> Reference was made to an undefined symbol.

Unusable instruction code <instruction code> The object contains an instruction invalid for the model.

in <FILE NAME>

5.12.2 Warning

Even when a warning appears, the linker continues with the processing. It completes the processing after displaying a warning message, unless, in addition, an error takes place. The output files will all be delivered, but the operation of the program cannot be guaranteed.

The warning messages and their contents are given below.

Warning message Description

Cannot create <file kind> file <FILE NAME> The file cannot be created.

Cannot open <file kind> file <FILE NAME> The file cannot be opened.

No debug information in <FILE NAME> Debugging information is not included in the file.

No symbols found Symbols cannot be found.

Second definition of label <label> in The label has already been defined.

<FILE NAME>

Second ICE parameter file <FILE NAME> ignored Two or more ICE parameter files are specified.

5.13 Precautions

(1) Upper limits, such as a maximum section count and the number of objects to be linked, depend on the free memory space.

(2) To load the absolute object file created by the linker to the debugger, the same ICE parameter file must be specified when the debugger is invoked.