Hello lists,
Some minor fallout resulting after the libffi merge. The code in
closures.c
is currently structured like this:
#if !defined(X86_WIN32) && !defined(X86_WIN64)
/* Use these for mmap and munmap within dlmalloc.c. */
static void *dlmmap(void *, size_t, int, int, int, off_t);
static int dlmunmap(void *, size_t);
#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */
#define mmap dlmmap
#define munmap dlmunmap
#include "dlmalloc.c"
#undef mmap
#undef munmap
#if !defined(X86_WIN32) && !defined(X86_WIN64)
[ definitions of dlmmap, dlmunmap ]
#endif
It currently causes bootstrap failure on cygwin like this:
libtool: link: /gnu/gcc/obj-patched3/./gcc/gcj
-B/gnu/gcc/obj-patched3/i686-pc-cygwin/libjava/ -B/gnu/gcc/obj-
patched3/./gcc/
-B/opt/gcc-tools/i686-pc-cygwin/bin/ -B/opt/gcc-tools/i686-pc-cygwin/
lib/
-isystem /opt/gcc-tools/i686-pc-cygwin/include -isystem
/opt/gcc-tools/i686-pc-cygwin/sys-include -ffloat-store -fomit-frame-
pointer
-Usun -g -O2 -o .libs/jv-convert.exe --main=gnu.gcj.convert.Convert
-shared-libgcc -L/gnu/gcc/obj-patched3/i686-pc-cygwin/libjava/.libs
-L/gnu/gcc/obj-patched3/i686-pc-cygwin/libjava ./.libs/libgcj.a -ldl
-L/opt/gcc-tools/lib/gcc/i686-pc-cygwin/4.5.0
/opt/gcc-tools/bin/ld: Dwarf Error: mangled line number section.
./.libs/libgcj.a(closures.o):closures.c:(.text+0x8af): undefined
reference to
`_dlmunmap'
./.libs/libgcj.a(closures.o):closures.c:(.text+0xe59): undefined
reference to
`_dlmmap'
./.libs/libgcj.a(closures.o):closures.c:(.text+0x1173): undefined
reference to
`_dlmmap'
./.libs/libgcj.a(closures.o):closures.c:(.text+0x1c82): undefined
reference to
`_dlmunmap'
./.libs/libgcj.a(closures.o):closures.c:(.text+0x1d5f): undefined
reference to
`_dlmunmap'
collect2: ld returned 1 exit status
make[3]: *** [jv-convert.exe] Error 1
Ignoring the dwarf error, which is caused by an unrelated problem,
it looks
to me like the intent of the above code is to provide - only on non-
windows
platforms - these two replacement functions and override dlmalloc's
use of
mmap/munmap with them. But in that case, the #defines should be
inside the
#if guards as well, otherwise we're unconditionally doing the
replacement but
only conditionally supplying the replacement functions!
I'm testing the attached on Cygwin. I'm not set up for win64
testing but I
don't suppose it offers dl* functions either; I'll see if I can find
one of
the w64 guys to comment.
libffi/ChangeLog:
* closures.c (mmap, munmap): Don't define replacement macros
pointing
to dl* versions on windows platforms.
Assuming it passes bootstrap, OK?
cheers,
DaveK
Index: libffi/src/closures.c
===================================================================
--- libffi/src/closures.c (revision 149030)
+++ libffi/src/closures.c (working copy)
@@ -189,18 +189,18 @@
/* Use these for mmap and munmap within dlmalloc.c. */
static void *dlmmap(void *, size_t, int, int, int, off_t);
static int dlmunmap(void *, size_t);
-#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */
#define mmap dlmmap
#define munmap dlmunmap
+#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */
#include "dlmalloc.c"
+#if !defined(X86_WIN32) && !defined(X86_WIN64)
+
#undef mmap
#undef munmap
-#if !defined(X86_WIN32) && !defined(X86_WIN64)
-
/* A mutex used to synchronize access to *exec* variables in this
file. */
static pthread_mutex_t open_temp_exec_file_mutex =
PTHREAD_MUTEX_INITIALIZER;