Download H8S, H8/300 Series C/C++ Compiler Package Application Note

Transcript
Section 9 Optimizing Linkage Editor
• Examples
The following example shows how empty areas of boundary alignment are reduced.
(file1.c)
short s1;
char c1;
(file2.c)
char c2;
<When data_stuff is not specified>
When data_stuff is not specified, one byte empty area of boundary alignment is generated between file1.c and file2.c,
because boundary alignment value is 2 for H8 CPU specification.
In this example, if the size of the top data which is linked next is one byte, there is no need of this boundary alignment.
But the top data of the next file is 2 bytes or more, boundary alignment at the end of this file (file1.c) should be performed.
As a result, data alignment and data size are
s1(2 bytes) + c1(1 byte) + empty area(1 byte) + c2(1 byte) = 5 bytes
0000
0002
0004
s1
c1
empty area
c2
<When data_stuff is specified>
When data_stuff is specified, empty area of boundary alignment is not generated, if the size of the top data which is
linked next is one byte as this example.
As a result, data alignment and data size are
s1(2 bytes) + c1(1 byte) + c2(1 byte) = 4 bytes
Here, the data size is reduced to 4 bytes.
As this program example, empty areas generated as the boundary alignment of sections are filled at linkage. However, the
order of data allocation is not changed.
0000
0002
s1
c1
c2
Rev.3.00 2005.09.12 9-17
REJ05B0464-0300