linking question
Nick Papadonis
npapadon@yahoo.com
Tue May 22 07:14:00 GMT 2001
I'm trying to link a symbol into my program and am having trouble.
The following code is from my crt0.S and the symbol _start is
declared. When my program is linked, ld does NOT place _start at the
specified location in the linker script. Anyone know whats happening?
Thanks.
- Nick
crt0.S:
-----------------------------------------------------------------------------
.data
.align 2
SYM (environ):
.long 0
.align 2
.text
/*
* These values are set in the linker script, so they must be
* explicitly named here without SYM.
*/
.extern _sysstack .extern _sbss .extern _ebss
/*
* set things up so the application will run. This *must* be called
start.
*/
.global SYM (_start)
SYM (_start):
/*
* zero out the bss section.
*/
movel IMM(_sbss), d1
movel IMM(_ebss), d0
cmpl d0, d1
jbeq 3f
movl d1, a0
subl d1, d0
subql IMM(1), d0
ram.ld
----------------------------------------------------------------
OUTPUT_ARCH(m68k)
_DYNAMIC = 0;
MEMORY
{
ramvec : ORIGIN = 0x00000, LENGTH = 0x3FC
prgram : ORIGIN = 0x00400, LENGTH = 0xf0000 - 0x400
endram : ORIGIN = 0xf0000, LENGTH = 1
ramstk : ORIGIN = 0xf0000, LENGTH = 0xfffc
endstk : ORIGIN = 0xffffC, LENGTH = 1
}
SECTIONS
{
/*
* Put exception vector table in the beginning of RAM
*/
.ramvec :
{
_ramvec = . ;
*(.ramvec)
} > ramvec
.text :
{
_start = . ;
_stext = . ;
*(.text)
_etext = . ;
_ramstart = . ;
} > prgram
.data :
{
_sdata = . ;
*(.data)
_edata = . ;
} > prgram
.bss :
{
_sbss = . ;
*(.bss)
*(COMMON)
_ebss = . ;
_end = . ;
} > prgram
.endram :
{
_eram = . ;
} > endram
.sysstack :
{
*(.sysstack)
} > ramstk
.endstk :
{
_sysstack = . ;
*(.endstk)
} > endstk
}
--
Nick
PGP KEY: http://www.coelacanth.com/~nick/npapadon.public.asc
More information about the Binutils
mailing list