This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

ld: memory assignments


Hello,

using gcc for cross m68k development i have a problem in assigning the
sections to memory regions. the linker script is

MEMORY {
   flash    :  ORIGIN = 0x01200000, LENGTH = 6M
   dram     :  ORIGIN = 0x04000000, LENGTH = 1M
   }

OUTPUT_FORMAT ( COFF )

SECTIONS {
   .data : AT ( ADDR(.text) + SIZEOF(.text) ) {
      } > dram = 0x0

   .text : {
      } > flash = 0xFF

   .bss : {
      } > dram = 0x0
   }

The linker does not locate the .text section as exspected to the region
beginning at 0x1200000. It locates it starting at 0x1000000 instead and
fails because the end of the .text section is not in the flash region.

Allocating common symbols
Common symbol       size              file

test_ui             0x10              r/test.o

Memory Configuration

Name             Origin             Length             Attributes
*default*        0x00000000         0xffffffff
flash            0x01200000         0x00600000
dram             0x04000000         0x00100000

Linker script and memory map

LOAD test.cmd
LOAD r/test.o
                0x00000000                PROVIDE (__stack, 0x0)

.text           0x01000000       0x24
 *(.text)
 .text          0x01000000       0x12 r/test.o
                0x01000000                Test
 *fill*         0x01000012        0x2 255
                0x01000014                .=ALIGN(0x4)
                0x01000014                etext=.
                0x01000014                __CTOR_LIST__=.
                0x01000014        0x4 LONG 0x0
(((__CTOR_END__-__CTOR_LIST__)/0x4)-0x2)
 *(.ctors)
                0x01000018        0x4 LONG 0x0
                0x0100001c                __CTOR_END__=.
                0x0100001c                __DTOR_LIST__=.
                0x0100001c        0x4 LONG 0x0
(((__DTOR_END__-__DTOR_LIST__)/0x4)-0x2)
 *(.dtors)
                0x01000020        0x4 LONG 0x0
                0x01000024                __DTOR_END__=.

.data           0x04000000       0x10 load address 0x01000024
 *(.data)
 .data          0x04000000       0x10 r/test.o
                0x04000000                test_i
                0x04000010                edata=.

.bss            0x04000010       0x18
                0x04000010                __bss_start=.
 *(.bss)
 .bss           0x04000010        0x8 r/test.o
 *(COMMON)
 COMMON         0x04000018       0x10 r/test.o
                                  0x0 (size before relaxing)
                0x04000018                test_ui
                0x04000028                end=ALIGN(0x8)
                0x04000028                _end=ALIGN(0x8)

.stab
 *(.stab)

.stabstr
 *(.stabstr)
OUTPUT(r/test.out coff-m68k)

So far so bad. Where is the fault?
--
Schöne Grüße aus Reutlingen

Wolfram Wadepohl
Entwicklung

--
INDUMAT GmbH & Co. KG
Transport- und Lagersysteme
Dieselstraße 6
D-72770 Reutlingen - Betzingen

Tel.  +49 (0)71 21/5 14-2 89
Fax   +49 (0)71 21/5 14-2 99
eMail W.Wadepohl@indumat.de
WWW   http://www.indumat.de
--



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]