From patchwork Wed Jan 21 09:07:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 431380 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6585114010F for ; Wed, 21 Jan 2015 20:07:37 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=SKAjjajiH5WxrjKz cnUMffqDSqqedKOcnT4iNVFS7WpmECi+TgvYDLnngk0FO9nIc4jeiLDIsEbx8CQh 019JFgIFzhI/g1Ei2BKUpFfy9KcKo45UzwVbs6+n8eJoxfJS/cXklH/Z5wzyG/gk K1+lc3OBearAQBlM/LSEuwNbj5o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=sL3y5GrRaHZUHp3tM4e+1c VqKQw=; b=scMbpHt3ozZIUgfzrt4/IN3KeYYg3mGLYFLeoM7RFPwZxrsOBpwtKA 72MYH5H6Em4j1GQJzbFyOpud7dVSRgka/76Kgmu4qFB34Di9IJ0u4iYCJqXcUswq Hv4fpQxhV5Q7XtkEddKw5GKVvoU5mNp2tKZ0ze6xDwv8DV9Jt6O2E= Received: (qmail 7988 invoked by alias); 21 Jan 2015 09:07:28 -0000 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 Received: (qmail 7976 invoked by uid 89); 21 Jan 2015 09:07:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS autolearn=ham version=3.3.2 X-HELO: smtp-relay.CeBiTec.Uni-Bielefeld.DE Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Jan 2015 09:07:23 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 02C5919A; Wed, 21 Jan 2015 10:07:21 +0100 (CET) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id nixeE7Hh+Of9; Wed, 21 Jan 2015 10:07:18 +0100 (CET) Received: from fuego.CeBiTec.Uni-Bielefeld.DE (p54879715.dip0.t-ipconnect.de [84.135.151.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id 3CDFF199; Wed, 21 Jan 2015 10:07:18 +0100 (CET) From: Rainer Orth To: Jeff Law Cc: Daniel Gutson , Marcos =?iso-8859-1?Q?D=EDaz?= , "gcc-patches\@gcc.gnu.org" Subject: Re: [patch] gcc fstack-protector-explicit References: <528AFE96.3040301@redhat.com> <528D09D9.9020902@redhat.com> <53B2EEEC.9030003@redhat.com> <54B75073.4020501@redhat.com> Date: Wed, 21 Jan 2015 10:07:14 +0100 In-Reply-To: <54B75073.4020501@redhat.com> (Jeff Law's message of "Wed, 14 Jan 2015 22:30:27 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Jeff Law writes: > On 07/01/14 15:34, Daniel Gutson wrote: >> On Tue, Jul 1, 2014 at 2:25 PM, Jeff Law wrote: >>> On 03/19/14 08:06, Marcos Díaz wrote: >>>> >>>> Well, finally I have the assignment, could you please review this patch? >>> >>> Thanks. >>> >>> My first thought was that if we've marked the function with an explicit >>> static protector attribute, then it ought to be protected regardless of any >>> flags. Is there some reason to require the -fstack-protect-explicit? >> >> They can work separately, since the logic is: >> >> if NOT stack-protect-explicit >> a function can be protected by the current logic OR it has the attribute >> (a function may be not automatically protected with the current logic) >> ELSE // stack-protect-explicit >> only functions marked with the attribute will be protected. >> >> IOW, when no stack-protect-explicit, the functions may not be >> protected due to current logic, so the attribute acts as an override >> to request protection. > Sorry this took so long. I fixed a variety of whitespace errors, wrote a > better ChangeLog, re-bootstrapped and regression tested the patch (given > the long delay, I felt it was the least I could do). Approved and > installed. Unfortunately, the new gcc.dg/stackprotectexplicit1.c FAILs on Solaris (both SPARC and x86): FAIL: gcc.dg/stackprotectexplicit1.c (test for excess errors) WARNING: gcc.dg/stackprotectexplicit1.c compilation failed to produce executable Excess errors: Undefined first referenced symbol in file __stack_chk_guard /var/tmp//ccv9aOr1.o ld: fatal: symbol referencing errors. No output written to . This doesn't occur on Linux since that defines TARGET_THREAD_SSP_OFFSET, while Solaris (and doubtlessly other targets) need to link with -lssp to get a definition of __stack_chk_guard. The following patch does just that. Not yet tested because currently trunk doesn't bootstrap (libstdc++.so link failure). Ok for mainline once that has been done? Thanks. Rainer 2015-01-20 Rainer Orth * gcc.c (LINK_SSP_SPEC): Handle -fstack-protector-explicit. # HG changeset patch # Parent 32ee1d2fb4ac6498d6363a1841482f8c9fa521d7 Handle -fstack-protector-explicit in LINK_SSP_SPEC diff --git a/gcc/gcc.c b/gcc/gcc.c --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -730,7 +730,7 @@ proper position among the other output f #ifdef TARGET_LIBC_PROVIDES_SSP #define LINK_SSP_SPEC "%{fstack-protector:}" #else -#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-strong|fstack-protector-all:-lssp_nonshared -lssp}" +#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-strong|fstack-protector-explicit|fstack-protector-all:-lssp_nonshared -lssp}" #endif #endif