caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: caml-list@inria.fr
Cc: caml-bugs@pauillac.inria.fr
Subject: THREADED_CODE: Why CODE32 defined on x86-64?
Date: Wed, 16 Nov 2005 15:23:30 +0000	[thread overview]
Message-ID: <20051116152330.GA9895@furbychan.cocan.org> (raw)


Why is CODE32 defined on the x86-64 architecture?  This architecture
has 64 bit pointers, and it seems like it's only by luck that the
bytecode interpreter normally works.

In particular, if you have the interpreter in a shared library, or (I
assume) address-space randomization, then the jump table is located
above the 4GB boundary, and the bytecode interpreter segfaults as soon
as it tries to jump to the first instruction.

I had to apply the following patch to allow the bytecode interpreter
to work in a shared library:

--- ocaml-3.09.0.orig/configure 2005-09-24 10:19:09.000000000 +0100
+++ ocaml-3.09.0/configure      2005-11-16 14:59:56.000000000 +0000
@@ -291,9 +291,7 @@
     exe=".exe"
     ostype="Cygwin";;
   gcc*,x86_64-*-linux*)
-    bytecccompopts="-fno-defer-pop $gcc_warnings"
-    # Tell gcc that we can use 32-bit code addresses for threaded code
-    echo "#define ARCH_CODE32" >> m.h;;
+    bytecccompopts="-fno-defer-pop $gcc_warnings";;
   gcc*)
     bytecccompopts="-fno-defer-pop $gcc_warnings";;
 esac


Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com


             reply	other threads:[~2005-11-16 15:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-16 15:23 Richard Jones [this message]
2005-11-16 15:21 ` [Caml-list] " Xavier Leroy
2005-11-16 16:36   ` Richard Jones
2005-11-16 18:55   ` skaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051116152330.GA9895@furbychan.cocan.org \
    --to=rich@annexia.org \
    --cc=caml-bugs@pauillac.inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).