From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10022 invoked by alias); 2 Mar 2014 17:21:05 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 9999 invoked by uid 89); 2 Mar 2014 17:21:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: limerock02.mail.cornell.edu Received: from limerock02.mail.cornell.edu (HELO limerock02.mail.cornell.edu) (128.84.12.100) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 02 Mar 2014 17:21:02 +0000 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite3.serverfarm.cornell.edu [10.16.197.8]) by limerock02.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id s22HL0bC020388 for ; Sun, 2 Mar 2014 12:21:00 -0500 Received: from [192.168.1.5] (cpe-67-249-194-47.twcny.res.rr.com [67.249.194.47]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id s22HKw0Z021649 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Sun, 2 Mar 2014 12:20:59 -0500 Message-ID: <53136870.200@cornell.edu> Date: Sun, 02 Mar 2014 17:21:00 -0000 From: Ken Brown User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: Building libsigsegv on Cygwin64 References: <530771A3.7000603@alice.it> In-Reply-To: <530771A3.7000603@alice.it> Content-Type: multipart/mixed; boundary="------------030601000304020509080304" X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00026.txt.bz2 --------------030601000304020509080304 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Content-length: 2379 On 2/21/2014 10:32 AM, Angelo Graziosi wrote: > Trying to build libsigsegv-2.10 on Cygwin64 (using the src tarball and > its .cygport file from x86 distribution), fails as follows > > [...] > libtool: compile: gcc -DHAVE_CONFIG_H -I. > -I/works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src -I.. -I. > -I/works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src -ggdb -O2 -pipe > -Wimplicit-function-declaration > -fdebug-prefix-map=/works/tmp/libsigsegv-2.10-1/build=/usr/src/debug/libsigsegv-2.10-1 > -fdebug-prefix-map=/works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10=/usr/src/debug/libsigsegv-2.10-1 > -c /works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src/handler.c > -DDLL_EXPORT -DPIC -o .libs/handler.o > In file included from > /works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src/handler.c:20:0: > /works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src/handler-win32.c: In > function 'main_exception_filter': > /works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src/handler-win32.c:218:43: > error: 'struct _CONTEXT' has no member named 'Esp' > ExceptionInfo->ContextRecord->Esp = new_safe_esp; > ^ > /works/tmp/libsigsegv-2.10-1/src/libsigsegv-2.10/src/handler-win32.c:220:43: > error: 'struct _CONTEXT' has no member named 'Eip' > ExceptionInfo->ContextRecord->Eip = (unsigned > long)&stack_overflow_handler; > ^ > Makefile:399: set di istruzioni per l'obiettivo "handler.lo" non riuscito > make[1]: *** [handler.lo] Errore 1 > make[1]: uscita dalla directory "/works/tmp/libsigsegv-2.10-1/build/src" > Makefile:344: set di istruzioni per l'obiettivo "install-recursive" non > riuscito > make: *** [install-recursive] Errore 1 > > Since my Cygwin64 is a fesh installation, I wonder if I missed to > installe some needed packages... or is that error to be expected on > Cygwin64? I found the problem (or at least I found *a* problem): There's a configure test "checking whether a fault handler according to POSIX works", which passes on 32-bit Cygwin but fails on 64-bit Cygwin. I'm attaching a file containing the configure test. Here's what happens in the 64-bit case: $ gcc -o fault fault.c $ ./fault.exe $ echo $? 1 In the 32-bit case, the exit code is 0. I don't know if this indicates a Cygwin bug or something wrong with the test. Ken --------------030601000304020509080304 Content-Type: text/plain; charset=windows-1252; name="fault.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fault.c" Content-length: 1651 #include #include #include #include #include # include # define zero_fd -1 # define map_flags MAP_ANON | MAP_PRIVATE # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL unsigned long page; int handler_called = 0; void sigsegv_handler (int sig, siginfo_t *sip, void *ucp) { void *fault_address = (void *) (sip->si_addr); handler_called++; if (handler_called == 10) exit (4); if (fault_address != (void*)((page + 0x678) & ~SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS)) exit (3); if (mprotect ((void *) page, 0x10000, PROT_READ | PROT_WRITE) < 0) exit (2); } void crasher (unsigned long p) { *(int *) (p + 0x678) = 42; } int main () { void *p; struct sigaction action; /* Preparations. */ /* Setup some mmaped memory. */ p = mmap ((void *) 0x12340000, 0x10000, PROT_READ | PROT_WRITE, map_flags, zero_fd, 0); if (p == (void *)(-1)) exit (2); page = (unsigned long) p; /* Make it read-only. */ if (mprotect ((void *) page, 0x10000, PROT_READ) < 0) exit (2); /* Install the SIGSEGV handler. */ sigemptyset(&action.sa_mask); action.sa_sigaction = &sigsegv_handler; action.sa_flags = SA_SIGINFO; sigaction (SIGSEGV, &action, (struct sigaction *) NULL); sigaction (SIGBUS, &action, (struct sigaction *) NULL); /* The first write access should invoke the handler and then complete. */ crasher (page); /* The second write access should not invoke the handler. */ crasher (page); /* Check that the handler was called only once. */ if (handler_called != 1) exit (1); /* Test passed! */ return 0; } --------------030601000304020509080304 Content-Type: text/plain; charset=us-ascii Content-length: 218 -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple --------------030601000304020509080304--