GCC start address location.

Brian Witt aleks@spoda.gentoo.com
Fri May 16 13:57:00 GMT 1997


I'm using GCC2.7 and binutsil 2.7 to target a little 68010 system
(AT&T 3b1 without UNIX).  The executables I download need to
start at $3000, which I am able to do.  However, when I use
objdump, all the dis-assembled addresses start at 0, even though
the jumps and load/store addresses are correct.

	target=m68k-unknown-aout
	host=solaris2.5
	exec-prefix=68-

	GCC 2.7.0 (no patches)
	BinUtils 2.7 (no patches)


I would like to know what to tell the linker to locate the VMA
and LMA to $3000 also.  I'm using _Ttext 0x03000 to locate things.
I was using a linker script but the got unwiedly.  It does work
correctly, it just this utility output that is wierd.  I drive
"ld" directly, instead of using GCC.


---------------------------------------
float % 68-objdump -d -r --show-raw-insn my_os.dli
	:
    00000114 <__start-2eec> 4e b9 00 00 3c 06  jsr 00003c06 <___main>
	:
---------------------------------------
( $3000 - $2eec = $114 )


When I get header info from "objdump" it reveals:

---------------------------------------
float % 68-ld -V
ld version 2.7 (with BFD 2.7)
  Supported emulations:
   m68kaout
float % 68-objdump -h my_os.dli

my_os.dli:     file format a.out-zero-big

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000c8c  00000000  00000000  00000020  2**2
                  CONTENTS, ALLOC, LOAD, CODE
  1 .data         00000020  00000c8c  00000c8c  00000cac  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          0000002c  00000cac  00000cac  00000000  2**2
                  ALLOC
float % 
---------------------------------------

Both VMA and LMA are $0 for .text, when they should be $03000.

I link with this (inside a script):
---------------------------------------
ld -N -Ttext 0x03000 -Map mapfile -o $DEST $LIB/crt0.o $OBJS \
	-lspede -lgcc -lspede
---------------------------------------

A portion of the linker map.
---------------------------------------

Memory Configuration

Name             Origin             Length
*default*        0x00000000         0xffffffff

Linker script and memory map

Address of section .text set to 0x3000
LOAD /usr/local/spede/gcc68/m68k-unknown-aout/lib/crt0.o
LOAD t1.o
LOAD /usr/local/spede/gcc68/m68k-unknown-aout/lib/libspede.a
LOAD /usr/local/spede/gcc68/m68k-unknown-aout/lib/libgcc.a
LOAD /usr/local/spede/gcc68/m68k-unknown-aout/lib/libspede.a
                0x00000000                PROVIDE (__stack, 0x0)
                0x00002000                .=0x2000

.text           0x00003000      0xc8c
 CREATE_OBJECT_SYMBOLS
 *(.text)
 .text          0x00003000       0x6c /usr/local/spede/gcc68/m68k-unknown-aout/l
ib/crt0.o
                0x00003000                _start
                0x0000306a                GDBexit
 .text          0x0000306c       0xb4 t1.o

    :		    :			:
 .bss           0x00003cac        0x8 /usr/local/spede/gcc68/m68k-unknown-aout/l
ib/libspede.a(brk.o)
 .bss           0x00003cb4        0x4 /usr/local/spede/gcc68/m68k-unknown-aout/l
ib/libgcc.a(__main.o)
 *(COMMON)
 COMMON         0x00003cb8       0x10 t1.o
                0x00003cb8                latest
 COMMON         0x00003cc8       0x10 /usr/local/spede/gcc68/m68k-unknown-aout/l
ib/libgcc.a(__main.o)
                0x00003cc8                __DTOR_LIST__
                0x00003cd0                __CTOR_LIST__
                0x00003cd8                _end=ALIGN(0x4)
                0x00003cd8                __end=ALIGN(0x4)
OUTPUT(my_os.dli a.out-zero-big)
---------------------------------------



--- The railroad train will come no more.
--- brian witt






More information about the crossgcc mailing list