[MLton] PowerPC .deb built

Wesley W. Terpstra wesley@terpstra.ca
Tue, 17 May 2005 11:39:14 +0200


On Sat, May 14, 2005 at 09:31:14AM -0500, Henry Cejtin wrote:
> I don't know about _start (although I would guess that it probably should be
> a function pointer)

I disagree.

I know that in reality it _is_ a function.
However, what you actually want is it's address in the text segment.

Look at the offsets you get on hppa more closely:
                0001bd60 T _start
                0001e814 T MLtonProfile0
                0002f914 T MLtonProfile808
                00041270 A etext
The above come from 'nm' and are correct.

                Start: 59b7e
                Label 0: 58e9e
                Label 808: 5aa9e
                End: 59b06
These come from gc.c. Notice that the 'Start' (address of _start as a
function pointer) is total nonsense. It's past the actual end of the text
segment. Furthermore, the mapping doesn't preserve text segment order. The
first label comes before the address of start.

As I understand it now, on some platforms, all pointer types but 'char'
might be unusual. For example, int might be the same as a char pointer bit
shifted 2 bits right (b/c it has to always be aligned). Function pointers
can also be remapped to pointers to descriptors for platforms that need more
information that just the entry point (this is what hppa is diong).

Regarding '_etext', I think 'char' is the right thing to use in practice
regardless of what the standard you quoted says (who issued it?). If you
used 'int' you might get an offset that doesn't correspond to the offset
of the _text_ segment.

-- 
Wesley W. Terpstra <wesley@terpstra.ca>