About _init and _start
About _init and _start
Just a quick question: _init is for data intialization and it is executed before _start... is this right? Because ELF header sets entry point for _start address.
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
when i don"t declare _start and declare module_start the linker complain about _start missing.
sp-gcc -I. -I/home/f731/pspdev/psp/sdk/include -O2 -G0 -Wall -mno-crt0 -nostartfiles -I. -I/home/f731/pspdev/psp/sdk/include -O2 -G0 -Wall -mno-crt0 -nostartfiles -o helloworld.o helloworld.s
/home/f731/pspdev/lib/gcc/psp/4.3.2/../../../../psp/bin/ld: AVERTISSEMENT: ne peut trouver le symbole d'entrée _start; utilise par défaut 0000000008900018
i try to make a hello world program in asm mips for kernel 3.x
when i add .globl _start the warning dissaspear
Code: Select all
.globl module_info
.section .rodata.sceModuleInfo,"a",@progbits
.align 4
.type module_info, @object
.size module_info, 52
module_info:
.half 0
.byte 1
.byte 1
.ascii "Hello world\000"
.space 15
.byte 0
.word _gp
.word __lib_ent_top
.word __lib_ent_bottom
.word __lib_stub_top
.word __lib_stub_bottom
.set push
.section .lib.ent.top, "a", @progbits
.align 2
.word 0
__lib_ent_top:
.section .lib.ent.btm, "a", @progbits
.align 2
__lib_ent_bottom:
.word 0
.section .lib.stub.top, "a", @progbits
.align 2
.word 0
__lib_stub_top:
.section .lib.stub.btm, "a", @progbits
.align 2
__lib_stub_bottom:
.word 0
IMPORT_START "LoadExecForKernel",0x00010000
IMPORT_FUNC "LoadExecForKernel",0x05572A5F,sceKernelExitGame
.set pop
.text
.rdata
.align 2
$LC2:
.ascii "Hello World from ASM Mips!\000"
.align 2
.globl module_start
.set nomips16
.text
_start:
module_start:
.set noreorder
addiu $sp,$sp,-8
sw $31,4($sp)
sw $fp,0($sp)
move $fp,$sp
# jal pspDebugScreenInit
# nop
lui $2,%hi($LC2)
addiu $4,$2,%lo($LC2)
# jal pspDebugScreenPrintf
# nop
jal sceKernelExitGame
nop
move $2,$0
move $sp,$fp
lw $31,4($sp)
lw $fp,0($sp)
addiu $sp,$sp,8
j $31
nop
/home/f731/pspdev/lib/gcc/psp/4.3.2/../../../../psp/bin/ld: AVERTISSEMENT: ne peut trouver le symbole d'entrée _start; utilise par défaut 0000000008900018
i try to make a hello world program in asm mips for kernel 3.x
when i add .globl _start the warning dissaspear
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
Done JF thx a lot. I was studying mips assembler with a emulator called
yams. But there was a lot of pseudo code generated that are elf related and not
mips related like progbits etc ...(thx m0skit0 for the explantion)
The purpose was just to make a hello world in asm working on the psp on en 3.x firmware.
nb: I was obliged to add the -c so the linkedit is not performed and the .S file
is not deleted but if you do that you must also see at the source of the crt0.s
of the sdk to have a working sample ;)
psp-gcc -I/home/f731/pspdev/psp/sdk/include -O2 -G0 -Wall -c -S main.c
yams. But there was a lot of pseudo code generated that are elf related and not
mips related like progbits etc ...(thx m0skit0 for the explantion)
The purpose was just to make a hello world in asm working on the psp on en 3.x firmware.
nb: I was obliged to add the -c so the linkedit is not performed and the .S file
is not deleted but if you do that you must also see at the source of the crt0.s
of the sdk to have a working sample ;)
psp-gcc -I/home/f731/pspdev/psp/sdk/include -O2 -G0 -Wall -c -S main.c