From patchwork Thu Feb 23 21:03:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Howarth X-Patchwork-Id: 142707 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id A8246B6EE7 for ; Fri, 24 Feb 2012 08:03:35 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1330635816; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=Dk8LklJOikTIgIO2VED1sjLibgY=; b=K45X4G/pvQcEGwK vQYuA1KXNuHt0DKtuBk9eo8lIbMYElzS07texLyV/0gMdERqsj4AOj3yu8bL06et N9t7c7B9S43r6sjEFBS2xeUyxrWnLBqm/nJUmUfiFMAn/l+6Scij634h7EeELX9W iGaUmRRbOHLbrWJXzSsV0vrfusK8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=wHS99247qjtgzn6B8sUbAqdjIQXGSR7PqM/CNIHjUo9oucbtbWX1ismjHGw1GU y8xgDvZXmA2+imZFIW5RorngrcawnzXhu+iJjp7yXpCN1FGZb5mPV4ho+7Z3rZFu DJBNNoHAo1wv8m3UcbH08+EWMx9HUnNSxYqYMfVAmyB3s=; Received: (qmail 8194 invoked by alias); 23 Feb 2012 21:03:31 -0000 Received: (qmail 8182 invoked by uid 22791); 23 Feb 2012 21:03:30 -0000 X-SWARE-Spam-Status: No, hits=0.2 required=5.0 tests=AWL, BAYES_00, TW_IB, T_RP_MATCHES_RCVD, URIBL_BLACK X-Spam-Check-By: sourceware.org Received: from bromo.med.uc.edu (HELO bromo.med.uc.edu) (129.137.3.146) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Feb 2012 21:03:17 +0000 Received: from bromo.med.uc.edu (localhost.localdomain [127.0.0.1]) by bromo.med.uc.edu (Postfix) with ESMTP id DBF27400008; Thu, 23 Feb 2012 16:03:15 -0500 (EST) Received: (from howarth@localhost) by bromo.med.uc.edu (8.14.3/8.14.3/Submit) id q1NL3FwY006158; Thu, 23 Feb 2012 16:03:15 -0500 Date: Thu, 23 Feb 2012 16:03:15 -0500 From: Jack Howarth To: gcc-patches@gcc.gnu.org Cc: patrick.marlier@gmail.com, mikestump@comcast.net, iains@gcc.gnu.org Subject: [PATCH]: Fix PR52179 and remove hack from PR48299 Message-ID: <20120223210315.GA6156@bromo.med.uc.edu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The attached patch implements the fix for supporting aslr on darwin11 and later which exists in current upstream boehm-gc, as discussed in https://github.com/ivmai/bdwgc/issues/13; see https://github.com/ivmai/bdwgc/commit/faef04e7cb3741163dfdf65900ef5d2a0530be0f. This change eliminates the test failures in boehm-gc testsuite except for random failures WARNING: program timed out. FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test Running /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20120222/boehm-gc/testsuite/boehm-gc.lib/lib.exp due to PR48299. Fixing PR52179 allows us to stop passing -Wl,-no_pie on SYSTEMSPEC, by reverting r175182, without regressions in the libjava testsuite. Bootstrap and regression tested on x86_64-apple-darwin11. Okay for gcc trunk for gcc 4.7 since this is target specific? Jack 2012-02-23 Patrick Marlier Jack Howarth boehm-gc/ PR boehm-gc/52179 * include/gc_config.h.in: Undefine HAVE_PTHREAD_GET_STACKADDR_NP. * include/private/gcconfig.h (DARWIN): Define STACKBOTTOM with pthread_get_stackaddr_np when available. * configure.ac (THREADS): Check availability of pthread_get_stackaddr_np. * configure: Regenerate. libjava/ PR target/49461 * configure.ac (SYSTEMSPEC): No longer pass -no_pie for darwin11. * configure: Regenerate. Index: boehm-gc/configure.ac =================================================================== --- boehm-gc/configure.ac (revision 184521) +++ boehm-gc/configure.ac (working copy) @@ -380,6 +380,7 @@ esac oldLIBS="$LIBS" LIBS="$LIBS $THREADLIBS" AC_CHECK_FUNCS([pthread_getattr_np]) +AC_CHECK_FUNCS([pthread_get_stackaddr_np]) LIBS="$oldLIBS" # Configuration of machine-dependent code Index: boehm-gc/include/gc_config.h.in =================================================================== --- boehm-gc/include/gc_config.h.in (revision 184521) +++ boehm-gc/include/gc_config.h.in (working copy) @@ -87,6 +87,9 @@ /* Define to 1 if you have the `pthread_getattr_np' function. */ #undef HAVE_PTHREAD_GETATTR_NP +/* Define to 1 if you have the `pthread_get_stackaddr_np_np' function. */ +#undef HAVE_PTHREAD_GET_STACKADDR_NP + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H Index: boehm-gc/include/private/gcconfig.h =================================================================== --- boehm-gc/include/private/gcconfig.h (revision 184521) +++ boehm-gc/include/private/gcconfig.h (working copy) @@ -1331,7 +1331,11 @@ These aren't used when dyld support is enabled (it is by default) */ # define DATASTART ((ptr_t) get_etext()) # define DATAEND ((ptr_t) get_end()) -# define STACKBOTTOM ((ptr_t) 0xc0000000) +# ifdef HAVE_PTHREAD_GET_STACKADDR_NP +# define STACKBOTTOM (ptr_t)pthread_get_stackaddr_np(pthread_self()) +# else +# define STACKBOTTOM ((ptr_t) 0xc0000000) +# endif # define USE_MMAP # define USE_MMAP_ANON # define USE_ASM_PUSH_REGS @@ -2014,7 +2018,11 @@ These aren't used when dyld support is enabled (it is by default) */ # define DATASTART ((ptr_t) get_etext()) # define DATAEND ((ptr_t) get_end()) -# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000) +# ifdef HAVE_PTHREAD_GET_STACKADDR_NP +# define STACKBOTTOM (ptr_t)pthread_get_stackaddr_np(pthread_self()) +# else +# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000) +# endif # define USE_MMAP # define USE_MMAP_ANON # ifdef GC_DARWIN_THREADS Index: libjava/configure.ac =================================================================== --- libjava/configure.ac (revision 184521) +++ libjava/configure.ac (working copy) @@ -898,14 +898,9 @@ case "${host}" in SYSTEMSPEC="-lunicows $SYSTEMSPEC" fi ;; - *-*-darwin9*) + *-*-darwin[[912]]*) SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" ;; - *-*-darwin[[12]]*) - # Something is incompatible with pie, would be nice to fix it and - # remove -no_pie. PR49461 - SYSTEMSPEC="-no_pie %{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" - ;; *) SYSTEMSPEC= ;;