The test profil01.c fails on powerpc64 because it is not 64-
bit safe. It use the int type for bsize and lotext to compute
the size the profil01's text segment. For 64-bit long int is
required.
Also this code does not acount for the use of function
descriptors. For powerpc64 the address of a function is the
address of the function descriptor (which contains the
function entry point address and the functions TOC
pointer). Function descriptors are data and are allocated in
the data section which follows the text.
So for platforms that use function descriptors the
computation &etext - &_start is not correct. &_start is the
address of the function descriptor (in the data section)
which has a higher address then etext. To get the true
address you must dereference the function descriptor to
obtain the function entry point address.
The attached patch fixes profil01.c for powerpc64 but there
may still be issues for other 64-bit and function descriptor
based ABIs.
PATCH make profil01.c 64-bit safe
Logged In: YES
user_id=236704
Patch applied to the CVS tree.