caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* THREADED_CODE: Why CODE32 defined on x86-64?
@ 2005-11-16 15:23 Richard Jones
  2005-11-16 15:21 ` [Caml-list] " Xavier Leroy
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Jones @ 2005-11-16 15:23 UTC (permalink / raw)
  To: caml-list; +Cc: caml-bugs


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-16 18:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-16 15:23 THREADED_CODE: Why CODE32 defined on x86-64? Richard Jones
2005-11-16 15:21 ` [Caml-list] " Xavier Leroy
2005-11-16 16:36   ` Richard Jones
2005-11-16 18:55   ` skaller

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).