Using the Linker
for (i=0;i<size;i++)
putchar(mp3[i]);
}
Because the compiler does not know in which space the linker will locate the imported binary, you have to make sure the symbols refer to the same space in which the linker will place the imported
binary. You do this by using the memory qualifier
__far
, otherwise the linker cannot bind your linker symbols.
Also note that if you want to use the export functionality of Eclipse, the binary file has to be part of your project.
8.6. Linker Optimizations
During the linking and locating phase, the linker looks for opportunities to optimize the object code. Both code size and execution speed can be optimized.
To enable or disable optimizations
1.
From the Project menu, select Properties
The Properties dialog appears.
2.
In the left pane, expand C/C++ Build and select Settings.
In the right pane the Settings appear.
3.
On the Tool Settings tab, select Linker » Optimization.
4.
Enable one or more optimizations.
You can enable or disable the optimizations described below. The command line option for each optimization is given in brackets.
This optimization removes unused sections from the resulting object file.
When the physical memory is fragmented or when address spaces are nested it may be possible that a given application cannot be located although the size of the available physical memory is larger than the sum of the section sizes. Enable the first-fit-decreasing optimization when this occurs and re-link your application.
The linker's default behavior is to place sections in the order that is specified in the LSL file (that is, working from low to high memory addresses or vice versa). This also applies to sections within an unrestricted group. If a memory range is partially filled and a section must be located that is larger than the remainder of this range, then the section and all subsequent sections are placed in a next memory range. As a result of this gaps occur at the end of a memory range.
231