mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
76 lines
2.8 KiB
Plaintext
76 lines
2.8 KiB
Plaintext
|
|
Mercury on FreeBSD
|
|
==================
|
|
|
|
GCC 4.2.1 Compatibility
|
|
-----------------------
|
|
|
|
FreeBSD 9.1's default version of GCC (version 4.2.1) sometimes locks up when
|
|
compiling the C code generated by the Mercury compiler. Installing GCC
|
|
4.4.7 from ports and directing Mercury to use gcc44 as follows can fix this
|
|
problem:
|
|
|
|
CC=gcc44 ./configure <your normal configure arguments>
|
|
|
|
|
|
Shared library support
|
|
----------------------
|
|
|
|
For FreeBSD, the Boehm conservative garbage collector does not yet support
|
|
shared libraries. So Mercury does not yet support shared libraries on FreeBSD,
|
|
except in the (not very useful) case where you compile with GC disabled,
|
|
e.g. using the option `--gc none'.
|
|
|
|
This has not been retested recently.
|
|
|
|
The rest of this section contains some hints for eager FreeBSD hackers
|
|
about what would need to be done to make the Boehm collector support
|
|
shared libraries on FreeBSD.
|
|
|
|
The basic problem is that on FreeBSD the conservative collector does not
|
|
scan the memory regions that contain global variables from dynamically
|
|
linked shared object files.
|
|
|
|
First, check the `recent_changes' file at
|
|
<http://reality.sgi.com/boehm/gc_source/> to see if someone else has
|
|
already solved the problem.
|
|
|
|
In order to support dynamic linking, I think you need to implement the
|
|
GC_register_dynamic_libraries() function in boehm_gc/dyn_load.c. This
|
|
function needs to call GC_add_root(low_address, high_plus_one_address,
|
|
TRUE) for every memory region in dynamically loaded code that needs to
|
|
be scanned by the collector, so that the collector can scan global
|
|
variables defined in shared libraries.
|
|
|
|
If FreeBSD uses ELF and supports ELF in exactly the same way that Linux
|
|
does, then you could try the following patch, which just enables the
|
|
Linux code in the FreeBSD case. But most likely there are some
|
|
differences between FreeBSD and Linux in this respect, so this will
|
|
probably not work as is -- you should consider this just a starting
|
|
point.
|
|
|
|
Read the comments at the top of dyn_load.c for more details.
|
|
|
|
--- dyn_load.c Mon Aug 31 15:05:05 1998
|
|
+++ dyn_load.c.new Wed Jun 16 22:58:48 1999
|
|
@@ -260,7 +260,7 @@
|
|
# endif /* !USE_PROC ... */
|
|
# endif /* SUNOS */
|
|
|
|
-#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF)
|
|
+#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || defined(FREEBSD)
|
|
|
|
/* Dynamic loading code for Linux running ELF. Somewhat tested on
|
|
* Linux/x86, untested but hopefully should work on Linux/Alpha.
|
|
--- config.h Wed Oct 28 10:16:49 1998
|
|
+++ config.h.new Wed Jun 16 23:08:56 1999
|
|
@@ -699,6 +699,7 @@
|
|
# ifdef FREEBSD
|
|
# define OS_TYPE "FREEBSD"
|
|
# define MPROTECT_VDB
|
|
+# define DYNAMIC_LOADING
|
|
# endif
|
|
# ifdef NETBSD
|
|
# define OS_TYPE "NETBSD"
|
|
|