[PATCH] Fix make closures.c use dlmmap,dlmunmap on cygwin.

View: New views
3 Messages — Rating Filter:   Alert me  

[PATCH] Fix make closures.c use dlmmap,dlmunmap on cygwin.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[ Re: http://gcc.gnu.org/ml/gcc-patches/2009-06/threads.html#02228 ]

    Hey all,

  Take 2 of this patch.  Works in the simplest way possible, by saying that
cygwin is an exception to the rule about win32/64 platforms not using the
local dlmmap/dlmunmap implementations.

  Sticklers for formatting will note that two of the #endif lines reach 81
characters, because of the comment repeating the #if condition.  I didn't
think it was worth wrapping the lines for such a tiny excess length in
something this trivial, but I'll do so before committing if that's what the
maintainers decide.

libffi/ChangeLog:

        * closures.c (mmap, munmap):  Don't define replacement macros pointing
        to dl* versions on windows platforms.

  Bootstrapping now.  Assuming it completes and libffi tests run alright, OK?

    cheers,
      DaveK

Index: libffi/src/closures.c
===================================================================
--- libffi/src/closures.c (revision 149030)
+++ libffi/src/closures.c (working copy)
@@ -185,11 +185,11 @@
 static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED;
 static void dlmalloc_stats(void) MAYBE_UNUSED;
 
-#if !defined(X86_WIN32) && !defined(X86_WIN64)
+#if !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__)
 /* 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) */
+#endif /* !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) */
 
 #define mmap dlmmap
 #define munmap dlmunmap
@@ -199,7 +199,7 @@
 #undef mmap
 #undef munmap
 
-#if !defined(X86_WIN32) && !defined(X86_WIN64)
+#if !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__)
 
 /* A mutex used to synchronize access to *exec* variables in this file.  */
 static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -514,7 +514,7 @@
 }
 #endif
 
-#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */
+#endif /* !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) */
 
 /* Allocate a chunk of memory with the given size.  Returns a pointer
    to the writable address, and sets *CODE to the executable

Re: [PATCH] Fix make closures.c use dlmmap,dlmunmap on cygwin.

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dave Korn wrote:

> [ Re: http://gcc.gnu.org/ml/gcc-patches/2009-06/threads.html#02228 ]
>
>     Hey all,
>
>   Take 2 of this patch.  Works in the simplest way possible, by saying that
> cygwin is an exception to the rule about win32/64 platforms not using the
> local dlmmap/dlmunmap implementations.
>
>   Sticklers for formatting will note that two of the #endif lines reach 81
> characters, because of the comment repeating the #if condition.  I didn't
> think it was worth wrapping the lines for such a tiny excess length in
> something this trivial, but I'll do so before committing if that's what the
> maintainers decide.
>
> libffi/ChangeLog:
>
> * closures.c (mmap, munmap):  Don't define replacement macros pointing
> to dl* versions on windows platforms.
>
>   Bootstrapping now.  Assuming it completes and libffi tests run alright, OK?

Sure: obvious/trivial, fixes bootstrap.

Commit upstream and gcc trees, please.

Andrew.

Re: [PATCH] Fix make closures.c use dlmmap,dlmunmap on cygwin.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrew Haley wrote:

> Dave Korn wrote:
>> [ Re: http://gcc.gnu.org/ml/gcc-patches/2009-06/threads.html#02228 ]
>>
>>     Hey all,
>>
>>   Take 2 of this patch.  Works in the simplest way possible, by saying that
>> cygwin is an exception to the rule about win32/64 platforms not using the
>> local dlmmap/dlmunmap implementations.
>>
>>   Sticklers for formatting will note that two of the #endif lines reach 81
>> characters, because of the comment repeating the #if condition.  I didn't
>> think it was worth wrapping the lines for such a tiny excess length in
>> something this trivial, but I'll do so before committing if that's what the
>> maintainers decide.
>>
>> libffi/ChangeLog:
>>
>> * closures.c (mmap, munmap):  Don't define replacement macros pointing
>> to dl* versions on windows platforms.
>>
>>   Bootstrapping now.  Assuming it completes and libffi tests run alright, OK?
>
> Sure: obvious/trivial, fixes bootstrap.
>
> Commit upstream and gcc trees, please.
>
> Andrew.

  Doesn't bootstrap directly.  Missing reference to `_is_selinux_enabled'.
Respin on the way.  (Will probably just "#define is_selinux_enabled 0" for
cygwin.)

    cheers,
      DaveK