Hi, I'm encountering unexpected behaviour with a custom linker script for a coldfire embedded system. GCC is Version 4.7.3 targetting m68k-elf. In the script below I set the location counter to: . = 0x40040400; _data_ram = .; and then insert the .data-section: .data : AT(_data_flash) { *(.data) } _edata_ram = .; When examining the executable with "objdump -h", I can see that the linker actually put the .data-Section at address 0x40000000. The debugger tells me that: _data_ram points to 0x40040400 _edata_ram points to 0x400008E4 Can somebody explain what's going on here? I found two workarounds / solutions: 1. completely remove the memory command 2. add a dot to the .data-section line .data . : AT(_data_flash) { *(.data) } ^ This might point to the problem: --citation-- .text . : { *(.text) } and .text : { *(.text) } are subtly different. The first will set the address of the `.text' output section to the current value of the location counter. The second will set it to the current value of the location counter aligned to the strictest alignment of a `.text' input section. --/citation-- from http://www.scoberlin.de/content/media/http/informatik/gcc_docs/ld_3.html What is "strictest alignment"? Is the memory command changing the "strictest alignment" of the section? Regards Michael --full linker script-- MEMORY { flash_begin (rx) : ORIGIN = 0, LENGTH = 16k flash_bootloader (rx) : ORIGIN = 32k, LENGTH = 96K sdram (wx) : ORIGIN = 0x40000000, LENGTH = 0x02000000 core_sram (wx) : ORIGIN = 0x80000000, LENGTH = 0x00008000 } EXTERN(VECTOR_TABLE) ENTRY(entry) SECTIONS { . = 0x00000000; .vector : { *(.vector) } >flash_begin .boot : { *(.boot) } >flash_begin .text : { *(.text) } >flash_bootloader .rodata : { *(.rodata) } . = ALIGN(4); _data_flash = .; . = 0x40040400; _data_ram = .; .data . : AT(_data_flash) { *(.data) } _edata_ram = .; _edata_flash = _data_flash + SIZEOF(.data); . = ALIGN(4); _bss = .; .bss : { *(.bss) } >sdram _ebss = .; _data2_flash = (_edata_flash + 4 - 1) & ~(4 - 1); . = 0x80000000; _data2_ram = .; .bss_sram : AT(_data2_flash) { *(.data2) } >core_sram }