how are "etext" and "end" defined on Darwin??

Joined
Apr 3, 2008
Messages
1
Reaction score
0
Points
1
Hello all, mac fellows!

I am trying to compile some basic low-level programs I had made on Linux, this time with Mac OSX 10.4.9 with Xcode Tools installed, wich gives me a gcc-based enviroment to start coding on MAC OSX.
I want to get some low-level memory access trial-and-error fun in the proccess, but I have found &etext and &end aren't defined.

In Linux, something like this works flawlessly:

extern etext;
exter end;

main () {
printf ("\n&etext = 0x0%d", &etext);
printf ("\n&end = 0x0%d", &end);}
}


In darwin, using gcc 4.0.1, trying to compile it bings some linked problem with undefined symbols: ld can' find where etext or end are defined!
I have read they are defined as DATASTART or something, but I've trued to extern those or define them myself with no luck.
Please, do you know how can I find the end of the code segment, globals segment, etc, in Darwin?? Where are those defined? How?

Thanks!!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top