[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ld and link scripts
From: |
Moth Attack! |
Subject: |
ld and link scripts |
Date: |
Tue, 29 Jun 2004 18:09:57 -0700 (PDT) |
I hope this is the correct place for a question about ld. I'm using
a link script, and it seems that, within a section, data are always
aligned to the next 16 bytes. I couldn't find anything about this
alignment in the documentation. For example:
rom _rom_vma : AT(_rom_lma) {
_rom_start = ABSOLUTE(.);
*(rom);
_rom_end = ABSOLUTE(.);
_rom_length = _rom_end - _rom_start;
}
If I use the above section, _rom_end is always rounded up to the
nearest 0x10, and therefore _rom_length is always a multiple of 16.
This isn't a major problem, but I thought it was strange. Can this
be changed? Does it depend on the output architecture?
A bigger problem is that the extra bytes at the end are filled with
repeating copies of four random bytes. FILL(0) and =0 both have no
effect on these bytes, but filling does work. Another example:
rom _rom_vma : AT(_rom_lma) {
*(rom);
} = 0
This section will end with, e.g.:
12 34 56 78 00 00 a0 e1 00 00 a0 e1 00 00 a0 e1
The bytes "12 34 56 78" are the actual end of the section, and the
rest is filling to the next 0x10. But if I do this:
rom _rom_vma : AT(_rom_lma) {
*(rom);
. = ALIGN(32);
} = 0
This section will end with:
12 34 56 78 00 00 a0 e1 00 00 a0 e1 00 00 a0 e1
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
So the =0 expression works. It's just this 16-byte internal
alignment that's causing trouble.
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- ld and link scripts,
Moth Attack! <=