Attached is a patch that makes ocaml able to compile proper PIC code on amd64. 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: some_label: movq camlPcre@GOTPCREL(%rip), %r13 movq 248(%r13), %r10 call caml_apply8@PLT ... caml_apply8: 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 put 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