How can I calculate de 'entry point' of a C program, compiled using GCC-LD?
Thank you
pepito
Entry point C
RE:Entry point C
The entry point will be a function called _start. I usually write this in asm but i assume you can write it in C. Also, you can specify an offset for all addresses (ld -Ttext=0x00000000 ...). So the entry point should be the first byte, or if a program file header (PE or ELF) then they give entry point.
RE:Entry point C
You can also use a linker script to do the loading for you.
I, myself do this as it makes the compiling of my operating system easier. Eventually you will want to use a linker script if you decide to add certain features like paging which uses virtual addresses and physical ones, zeroing the .bss and .end of the linker script for c language, etc.
Hope this helps.
I, myself do this as it makes the compiling of my operating system easier. Eventually you will want to use a linker script if you decide to add certain features like paging which uses virtual addresses and physical ones, zeroing the .bss and .end of the linker script for c language, etc.
Hope this helps.
RE:Entry point C
Thank you all of you!
Exactly, I need to know the 'entry point' and 'stack pointer' values at RUN TIME i.e. the OS must know where the CODE, DATA and STACK sections are to correctly create the process.
pepito
Exactly, I need to know the 'entry point' and 'stack pointer' values at RUN TIME i.e. the OS must know where the CODE, DATA and STACK sections are to correctly create the process.
pepito