Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RE: [Caml-list] [patch] PIC on amd64
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-01-25 (13:26)
From: Alexander Bottema <Alexander.Bottema@m...>
Subject: RE: [Caml-list] [patch] PIC on amd64
Hasn't support for PIC/AMD64 been fixed in the latest release of OCaml
(3.09.1)? Or have you found a bug in 3.09.1? I've tried to (native)
compile a simple program on AMD64 as a shared library and it worked

Alexander Bottema
(Software Developer @ The Mathworks)

-----Original Message-----
[] On Behalf Of Erik Bourget
Sent: Wednesday, January 25, 2006 7:52 AM
Subject: [Caml-list] [patch] PIC on amd64

Attached is a patch that makes ocaml able to compile proper PIC code on
This allows shared libraries to be created from ocaml code.

This patch needs work - in addition to being rough around the edges,
there is
a fairly major issue where it will generate patters as such:

     movq camlPcre@GOTPCREL(%rip), %r13
     movq 248(%r13), %r10
     call caml_apply8@PLT
    call (%r10) # should call camlPcre+248

This would be cool but %r10 is clobbered by the call in some
circumstances as
it's defined as a scratch register.  Ocaml's compiler seems to have
logic to
'spill' registers onto the stack but I haven't studied it hard enough to
it to use; maybe someone else is more familiar and will be able to mark
registers as live when they are used in this way?  :)

- Erik