[MLton] Re: PIC in amd64 assembly

Matthew Fluet fluet at tti-c.org
Wed Aug 20 21:07:23 PDT 2008


On Thu, 21 Aug 2008, Wesley W. Terpstra wrote:
> The thing that I'm still hung up on for i386, though, is how to get the PC.
> The sysv abi docs for ia32  say to use 'call', but I can't. So again my
> question: why %ebp instead of %esp? I can't find any x86 instruction other
> than 'call' to get me the PC, so this is a real problem.

Well, a normal C call will necessarily use %esp pointing to the C stack, 
inorder to match the calling convention.

If one only needs this trickery to for 'external' symbols and functions, 
then perhaps the 'internal' C function stub approach would be the easiest.




More information about the MLton mailing list