SECTIONS { /* Trigger an error if I have an unuseable start address */ _bogus = ASSERT(_start >= 0xffff0000, "_start too low. Please decrease CONFIG_ROM_IMAGE_SIZE"); _ROMTOP = 0xfffffff0; . = _ROMTOP; .reset . : { *(.reset) . = 15 ; BYTE(0x00); } } ------------------------------------------------------------------ What does (.=15;) mean? It seems a mistake! and can be: . = .+1;
Am 01.02.2011 12:46, schrieb ali hagigat:
SECTIONS { /* Trigger an error if I have an unuseable start address */ _bogus = ASSERT(_start>= 0xffff0000, "_start too low. Please decrease CONFIG_ROM_IMAGE_SIZE"); _ROMTOP = 0xfffffff0; . = _ROMTOP; .reset . : { *(.reset) . = 15 ; BYTE(0x00); } }
What does (.=15;) mean? It seems a mistake! and can be: . = .+1;
. = 15; means "set the location pointer to 15". With the byte that's written right after that, this means that .reset is exactly 16 bytes. If it's less, ". = 15" pads the section to be larger, if it would have to be larger, ". = 15" makes the linker fail (because the location pointer must not go backwards).
I guess that also answers why ". = .+1" is no adequate substitute.
Patrick
Thank you for the reply.
Lets consider the lines of that linker script again! First the location counter is set to 0xfffffff0 and the output .reset section starts from VMA=0xfffffff0. I think we both agree on that so far. But after .reset section, .=15 forces the location counter to be 15!! It means the location counter suddenly jumps from the top of memory to some where in the bottom! and then linker asks for storing 0x00 in the address of 15! or at the beginning of memory. .=15 does not set the size of .reset as you wrote. My suggestion was .=.+1 instead of .=15, or set VMA to one byte after the final .reset and then ask for writing 0x00 at the address of 0xffffffff. We are using . in the linker script file, it means VMA (virtual memory address) .....
On Tue, Feb 1, 2011 at 8:15 PM, Patrick Georgi patrick@georgi-clan.de wrote:
Am 01.02.2011 12:46, schrieb ali hagigat:
SECTIONS { /* Trigger an error if I have an unuseable start address */ _bogus = ASSERT(_start>= 0xffff0000, "_start too low. Please decrease CONFIG_ROM_IMAGE_SIZE"); _ROMTOP = 0xfffffff0; . = _ROMTOP; .reset . : { *(.reset) . = 15 ; BYTE(0x00); } }
What does (.=15;) mean? It seems a mistake! and can be: . = .+1;
. = 15; means "set the location pointer to 15". With the byte that's written right after that, this means that .reset is exactly 16 bytes. If it's less, ". = 15" pads the section to be larger, if it would have to be larger, ". = 15" makes the linker fail (because the location pointer must not go backwards).
I guess that also answers why ". = .+1" is no adequate substitute.
Patrick
-- coreboot mailing list: coreboot@coreboot.org http://www.coreboot.org/mailman/listinfo/coreboot
Am 05.02.2011 05:55, schrieb ali hagigat:
Lets consider the lines of that linker script again! First the location counter is set to 0xfffffff0 and the output .reset section starts from VMA=0xfffffff0. I think we both agree on that so far. But after .reset section, .=15 forces the location counter to be 15!!
Inside a section definition, the location pointer is relative to the start of the section. The section's location isn't always known beforehand (but you're right that it is in our case).
It means the location counter suddenly jumps from the top of memory to some where in the bottom! and then linker asks for storing 0x00 in the address of 15! or at the beginning of memory.
That would lead to a linker error. If you try ". = 0" at the place, the linker will fail: cannot move location counter backwards (from fffffffd to fffffff0)
.=15 does not set the size of .reset as you wrote. My suggestion was .=.+1 instead of .=15, or set VMA to one byte after the final .reset and then ask for writing 0x00 at the address of 0xffffffff.
This relies on knowledge that *(.reset) yields 15 bytes of data, and might break on runtime if it's less, or on build time if it's more. With ". = 15" you get deterministic behaviour on build time.
Patrick