Cannot find entry symbol _start...
I'm using NASM. When I try to link the program (using this command "ld -s -o test test.o"), I get the below warning. As a result of that, when I run the progam it seg-faults. Does anyone have an idea what I'm screwing up?
Warning:
Code:
ld: warning: cannot find entry symbol _start; not setting start address
Code:
Code:
; test.asm
; this is where the variables are stored.
SECTION .DATA
hello: db 'Hello world!',10
helloLen: equ $-hello
; the beginning of the executing code.
SECTION .TEXT
GLOBAL _START
; this is a routine that will be called when the program starts running.
_START:
; Write 'Hello world!' to the screen
mov eax, 4 ; 'write' system call
mov ebx, 1 ; file descriptor 1 = screen
mov ecx, hello ; string to write
mov edx, helloLen ; length of string to write
int 80h ; call the kernel
; Terminate program
mov eax, 1 ; 'exit' system call
mov ebx, 0 ; exit with error code 0, we want to exit without any errors.
int 80h ; call the kernel
Re: Cannot find entry symbol _start...
are u using Linux or Windows?
This code is for Linux and will not run on Windows correctly.
Re: Cannot find entry symbol _start...
Quote:
Originally Posted by BytePtr
are u using Linux or Windows?
This code is for Linux and will not run on Windows correctly.
Linux.
Re: Cannot find entry symbol _start...
Ok, I got the answer from elsewhere. Apparently the tutorial that I was using had all of the symbols capitalized and the linker didn't like that, so I simply set everything back to lower-case letters and it did the trick.
Re: Cannot find entry symbol _start...
I am suffering the same promble, and i do modify the symbols capital to be lower-case letters now.
But it still doesn't work. here is my code partly:
.global INT_Initialize
INT_Initialize:
# **************** Begin target specific code ****************
# Symbol used for Standard C Program entry
.global main
main:
# Symbol used for Debugger entry
.global _start
_start:
.if (ENABLE_LE_MODE==NU_TRUE)
# Ensure that start of initizliation code is in Big Endian format since
# PowerPC defaults to Big Endian mode during reset.
.endian big
.endif # (ENABLE_LE_MODE==NU_TRUE)
# Ensure r0 is 0.
addis r0,0,0x0000
and i get the error message :
powerpc-linux-ld -o mpc5248.elf \
--start-group N:/build/liba/*.a --end-group -e _start -static -Map mpc5
248.map -T link_ram.lcf
powerpc-linux-ld: warning: cannot find entry symbol _start; not setting start ad
dress
powerpc-linux-objcopy -Ruv --gap-fill=0x0 -N .initcode,.rtinfo,.ucode,.vectors,.
text,.data,.sdata,.sdata2 -O binary mpc5248.elf mpc5248.rom
powerpc-linux-objcopy: there are no sections to be copied!
make[1]: *** [all] Error 1
make[1]: Leaving directory `/cygdrive/n/main'
make: *** [all] Error 2
i use nm tool to view the symbol in the object file correct:
bash-3.00$ powerpc-linux-nm.exe Plus/Demo/od/int.o | grep -n start
149: U _ld_bss_start
151: U _ld_data_RAM_start
152: U _ld_data_ROM_start
153:00000100 N _start
bash-3.00$
Would somebody give me any advise?