mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 05:13:48 +00:00
65 lines
2.8 KiB
Plaintext
65 lines
2.8 KiB
Plaintext
Mercury has only been ported to Linux/x86, not to Linux/Alpha
|
|
Linux/PowerPC, Linux/m68k, etc. Those other ports should
|
|
not be difficult, but this file documents just the Linux/x86 port.
|
|
|
|
On Linux with a.out, shared libraries are not supported.
|
|
If you still have an old a.out system, the auto-configuration might
|
|
wrongly assume your Linux system uses ELF; if that happens, you will you
|
|
have to manually edit the EXT_FOR_SHARED_LIB variable in Mmake.common.
|
|
|
|
If you are using libc6, then you need to apply the patch listed at
|
|
the end of this file. Just type `patch boehm_gc/os_dep.c < README.Linux'.
|
|
|
|
On Linux with ELF, shared libraries are supported. However, ELF shared
|
|
libraries require position-independent code, and (partly due to
|
|
limitations in our current compilation technology, but partly due to
|
|
limitations in the x86 architecture) this is quite costly for Mercury --
|
|
probably considerably more costly than it is for C.
|
|
|
|
Nevertheless, since shared libraries reduces disk usage, improve link
|
|
times, and allow run-time sharing of the Mercury libraries between
|
|
different applications, using them is a good idea.
|
|
|
|
Currently the default is that programs do *not* use the Mercury shared
|
|
libraries. (Probably it ought to be the other way around, but that
|
|
happened to be a little bit harder to implement. We may change this in
|
|
a future release.)
|
|
|
|
To use the shared libraries, you must compile your program with
|
|
`mmc --cflags -DPIC_REG' and link with `ml --mercury-libs shared'
|
|
or add `MGNUCFLAGS=-DPIC_REG' and `MLFLAGS=--mercury-libs shared'
|
|
to your Mmake file.
|
|
|
|
Mercury code compiled with `-DPIC_REG' or `-fpic' has what we shall call
|
|
"PIC linkage", whereas Mercury code compiled without these options has
|
|
"non-PIC linkage". The static version of the Mercury libraries has
|
|
non-PIC linkage, while the shared version has PIC linkage.
|
|
Be very careful that you do not try to link Mercury code
|
|
with PIC linkage and Mercury code with non-PIC linkage into the same
|
|
executable, otherwise your code will *almost certainly crash*.
|
|
(The reason for this is that standard non-PIC Mercury code uses the
|
|
`ebx' register in ways that are incompatible with its uses as the global
|
|
offset table pointer register in PIC code. If only the Intel
|
|
architecture wasn't so register-starved, we wouldn't need to use `ebx',
|
|
and then PIC and non-PIC code could be mixed without any problems.)
|
|
|
|
--------------------
|
|
|
|
diff -u -r1.9 os_dep.c
|
|
--- os_dep.c 1997/03/06 02:51:19 1.9
|
|
+++ os_dep.c 1997/08/07 14:14:26
|
|
@@ -23,9 +23,11 @@
|
|
/* for some early 1.3.X releases. Will hopefully go away soon. */
|
|
/* in some later Linux releases, asm/sigcontext.h may have to */
|
|
/* be included instead. */
|
|
+# if 0
|
|
# define __KERNEL__
|
|
# include <asm/signal.h>
|
|
# undef __KERNEL__
|
|
+# endif
|
|
# endif
|
|
# if !defined(OS2) && !defined(PCR) && !defined(AMIGA) &&
|
|
!defined(MACOS)
|
|
# include <sys/types.h>
|
|
|