From owner-svn-ports-head@freebsd.org Sun Nov 19 21:50:51 2017 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9802DDBF4A0; Sun, 19 Nov 2017 21:50:51 +0000 (UTC) (envelope-from gerald@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 695E2651BD; Sun, 19 Nov 2017 21:50:51 +0000 (UTC) (envelope-from gerald@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAJLoo1L075685; Sun, 19 Nov 2017 21:50:50 GMT (envelope-from gerald@FreeBSD.org) Received: (from gerald@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAJLooZf075683; Sun, 19 Nov 2017 21:50:50 GMT (envelope-from gerald@FreeBSD.org) Message-Id: <201711192150.vAJLooZf075683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gerald set sender to gerald@FreeBSD.org using -f From: Gerald Pfeifer Date: Sun, 19 Nov 2017 21:50:50 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r454504 - in head/lang/gcc5: . files X-SVN-Group: ports-head X-SVN-Commit-Author: gerald X-SVN-Commit-Paths: in head/lang/gcc5: . files X-SVN-Commit-Revision: 454504 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Nov 2017 21:50:51 -0000 Author: gerald Date: Sun Nov 19 21:50:50 2017 New Revision: 454504 URL: https://svnweb.freebsd.org/changeset/ports/454504 Log: Backport two fixes from lang/gcc6: [1] Make sure what we install is stripped (i.e., debug info is removed). (For more background see revisions 454177 and 454422.) [2] Add a patch that we pulled into gcc6-devel via upstream a week ago that addresses a real-world issue around threading and unwinding as files/patch-freebsd-unwind.h . Bump PORTREVISION since [2] is a functional change and [1] changes the package. Reported by: Ports QA Framework, miwi, sobomax [1] Discussed with: tijl, miwi [1] Tested by: sobomax [1] Differential Revision: https://reviews.freebsd.org/D10357 [1] Added: head/lang/gcc5/files/patch-freebsd-unwind.h - copied unchanged from r454468, head/lang/gcc6/files/patch-freebsd-unwind.h Modified: head/lang/gcc5/Makefile Modified: head/lang/gcc5/Makefile ============================================================================== --- head/lang/gcc5/Makefile Sun Nov 19 21:48:19 2017 (r454503) +++ head/lang/gcc5/Makefile Sun Nov 19 21:50:50 2017 (r454504) @@ -3,6 +3,7 @@ PORTNAME= gcc PORTVERSION= 5.5.0 +PORTREVISION= 1 CATEGORIES= lang MASTER_SITES= GCC/releases/gcc-${DISTVERSION} PKGNAMESUFFIX= ${SUFFIX} @@ -78,6 +79,10 @@ CONFIGURE_ARGS+=--disable-bootstrap .else CONFIGURE_ARGS+=--with-build-config=bootstrap-debug ALL_TARGET= bootstrap-lean +.endif +INSTALL_TARGET= install-strip +.if ${UID} != 0 +BINMODE= 755 .endif INSTALL_TARGET= install-strip .if ${UID} != 0 Copied: head/lang/gcc5/files/patch-freebsd-unwind.h (from r454468, head/lang/gcc6/files/patch-freebsd-unwind.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/gcc5/files/patch-freebsd-unwind.h Sun Nov 19 21:50:50 2017 (r454504, copy of r454468, head/lang/gcc6/files/patch-freebsd-unwind.h) @@ -0,0 +1,90 @@ +2017-11-05 Andreas Tobler + + Backport from mainline + 2017-11-04 Andreas Tobler + + PR libgcc/82635 + * config/i386/freebsd-unwind.h (MD_FALLBACK_FRAME_STATE_FOR): Use a + sysctl to determine whether we're in a trampoline. + Keep the pattern matching method for systems without + KERN_PROC_SIGTRAMP sysctl. + +--- UTC +--- libgcc/config/i386/freebsd-unwind.h 2017/11/05 17:24:37 254430 ++++ libgcc/config/i386/freebsd-unwind.h 2017/11/05 19:30:41 254431 +@@ -28,7 +28,10 @@ + + #include + #include ++#include ++#include + #include ++#include + #include + + #define REG_NAME(reg) sf_uc.uc_mcontext.mc_## reg +@@ -36,6 +39,38 @@ + #ifdef __x86_64__ + #define MD_FALLBACK_FRAME_STATE_FOR x86_64_freebsd_fallback_frame_state + ++#ifdef KERN_PROC_SIGTRAMP ++/* FreeBSD past 9.3 provides a kern.proc.sigtramp. sysctl that ++ returns the location of the signal trampoline. Use this to find ++ out whether we're in a trampoline. ++*/ ++static int ++x86_64_outside_sigtramp_range (unsigned char *pc) ++{ ++ static int sigtramp_range_determined = 0; ++ static unsigned char *sigtramp_start, *sigtramp_end; ++ ++ if (sigtramp_range_determined == 0) ++ { ++ struct kinfo_sigtramp kst = {0}; ++ size_t len = sizeof (kst); ++ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_SIGTRAMP, getpid() }; ++ ++ sigtramp_range_determined = 1; ++ if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0) ++ { ++ sigtramp_range_determined = 2; ++ sigtramp_start = kst.ksigtramp_start; ++ sigtramp_end = kst.ksigtramp_end; ++ } ++ } ++ if (sigtramp_range_determined < 2) /* sysctl failed if < 2 */ ++ return 1; ++ ++ return (pc < sigtramp_start || pc >= sigtramp_end); ++} ++#endif ++ + static _Unwind_Reason_Code + x86_64_freebsd_fallback_frame_state + (struct _Unwind_Context *context, _Unwind_FrameState *fs) +@@ -43,6 +78,7 @@ + struct sigframe *sf; + long new_cfa; + ++#ifndef KERN_PROC_SIGTRAMP + /* Prior to FreeBSD 9, the signal trampoline was located immediately + before the ps_strings. To support non-executable stacks on AMD64, + the sigtramp was moved to a shared page for FreeBSD 9. Unfortunately +@@ -62,12 +98,15 @@ + && *(unsigned int *)(context->ra + 8) == 0x01a1c0c7 + && *(unsigned int *)(context->ra + 12) == 0x050f0000 )) + return _URC_END_OF_STACK; ++#else ++ if (x86_64_outside_sigtramp_range(context->ra)) ++ return _URC_END_OF_STACK; ++#endif + + sf = (struct sigframe *) context->cfa; + new_cfa = sf->REG_NAME(rsp); + fs->regs.cfa_how = CFA_REG_OFFSET; +- /* Register 7 is rsp */ +- fs->regs.cfa_reg = 7; ++ fs->regs.cfa_reg = __LIBGCC_STACK_POINTER_REGNUM__; + fs->regs.cfa_offset = new_cfa - (long) context->cfa; + + /* The SVR4 register numbering macros aren't usable in libgcc. */