assembly/profiling question

Henry Cejtin
Thu, 23 Aug 2001 21:46:19 -0500

I don't understand what he wants to do.  You can't use
	addl	X, (bin_symbol + (. - _start))
(ignoring linker problems) because the bis are going to be word sized, so
you have to scale.  Besides that, it would require an array whose size is the
same as the size of the program times 4.  (The profiler uses this much.)
If you are willing to do that, then it is only one extra indirection.  You
store the base address of the array minus _start in some cell, and then
the store is to the contents of that word plus `.'.
I can understand the convenience of having the output file be in the same
format (what ever that exactly means) as the mlprof.out file, but the data
in memory can just be what ever and be traversed when the file is written out.
A linked list is just fine.  You follow the links into a new array, sort them
and write it out.  What is the problem?
Note, either way the code being space-prof'd is going to be slower, so you
can just call a C function at each allocation point.  This function can now
compute where you are (from the return address) and just needs to get the
size in some register.
I must be missing something since all of these seem really simple to me.