[MLton] Re: [MLton-commit] r6675

Adam Goode adam at spicenitz.org
Sun Jul 27 15:30:27 PDT 2008


Wesley Terpstra wrote:
> This patch adds support for shared and static libraries to MLton. So far,
> the shared libraries probably only work on *nix. I have yet to make DLLs or
> dylibs for windows and mac osx respectively. However, the patch has already
> grown large enough and seems stable enough that I think this is a good
> check-point for committing it. I have tested all the codegens with all three
> compile modes (executable, archive, library) and they all work except
> amd64+shared. The problem here is that the output amd64 assembly code is not
> PIC. The amd64 codegen needs to be changed to use relocatable symbols, which
> shouldn't be too hard. In any case, both C and bytecode work on amd64. The
> x86 codegen also is not PIC, but x86 shared libraries work even when not
> relocatable. Nevertheless, when the amd64 codegen is updated, the x86 should
> be as well.


Actually, I believe that on Fedora, non-PIC x86 shared libraries will
also fail, because the tricks that the linker has to use to fix up the
non-PIC binary are forbidden at runtime (at least by default). This is
for security reasons (this kind of operation is often used by exploits
to generate code in memory), and I believe wastes extra pages of memory
as well (because of copy on write).

So, another good(?) reason to figure out how to emit PIC code from MLton.


Gory details and plenty of commentary are here for the interested:
http://people.redhat.com/drepper/textrelocs.html
http://people.redhat.com/drepper/selinux-mem.html
http://people.redhat.com/drepper/dsohowto.pdf


Adam





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
Url : http://mlton.org/pipermail/mlton/attachments/20080727/38ad66ba/signature.pgp


More information about the MLton mailing list