Page 1 of 1

Entry point C

Posted: Thu Sep 11, 2003 11:00 pm
by pepito
How can I calculate de 'entry point' of a C program, compiled using GCC-LD?

Thank you

pepito

RE:Entry point C

Posted: Thu Sep 11, 2003 11:00 pm
by knicos
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

Posted: Thu Sep 11, 2003 11:00 pm
by pepito
Thank you,

bye

pepito

RE:Entry point C

Posted: Fri Sep 12, 2003 11:00 pm
by df
the LD option -e {funcname} will define that as the start function.

RE:Entry point C

Posted: Fri Sep 12, 2003 11:00 pm
by beyondsociety
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.

RE:Entry point C

Posted: Sat Sep 13, 2003 11:00 pm
by pepito
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