From owner-svn-src-head@freebsd.org Wed Nov 13 04:20:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56CB917CFD3; Wed, 13 Nov 2019 04:20:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CWc31Vmhz4WPS; Wed, 13 Nov 2019 04:20:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 0A273F766; Wed, 13 Nov 2019 04:20:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f171.google.com with SMTP id e187so622871qkf.4; Tue, 12 Nov 2019 20:20:03 -0800 (PST) X-Gm-Message-State: APjAAAX80mY2II6BpJDGxfCqWwjhzcrpVGAuD2rjcOhp/IZ5HqBcva/u 4oIJHh+Ri7e+ztgeEicMBwMUuY3sGglgozCFLi4= X-Google-Smtp-Source: APXvYqxgsLe+n6wEd7bxthCxslbCmXSIqXFv/VCxdcByYvxyAWvxKcr5LFNW1M3m2ZvjMpfgMqi6jKQM0d3NcAxB30Q= X-Received: by 2002:a37:a00f:: with SMTP id j15mr869026qke.103.1573618802378; Tue, 12 Nov 2019 20:20:02 -0800 (PST) MIME-Version: 1.0 References: <201911130300.xAD30WUE099996@repo.freebsd.org> <80479651-f60d-e352-1f40-f01939aff9fd@FreeBSD.org> In-Reply-To: <80479651-f60d-e352-1f40-f01939aff9fd@FreeBSD.org> From: Kyle Evans Date: Tue, 12 Nov 2019 22:19:49 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354672 - head/lib/libc/secure To: Pedro Giffuni Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 04:20:03 -0000 On Tue, Nov 12, 2019, 22:04 Pedro Giffuni wrote: > > On 12/11/2019 22:00, Kyle Evans wrote: > > Author: kevans > Date: Wed Nov 13 03:00:32 2019 > New Revision: 354672 > URL: https://svnweb.freebsd.org/changeset/base/354672 > > Log: > ssp: rework the logic to use priority=200 on clang builds > > The preproc logic was added at the last minute to appease GCC 4.2, and > kevans@ did clearly not go back and double-check that the logic worked out > for clang builds to use the new variant. > > It turns out that clang defines __GNUC__ == 4. Flip it around and check > __clang__ as well, leaving a note to remove it later. > > > clang reports itself as GCC 4.2, the priority argument was introduced in > GCC 4.3. > > Reported by: cem > > Modified: > head/lib/libc/secure/stack_protector.c > > Modified: head/lib/libc/secure/stack_protector.c > ============================================================================== > --- head/lib/libc/secure/stack_protector.c Wed Nov 13 02:22:00 2019 (r354671) > +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 03:00:32 2019 (r354672) > @@ -47,13 +47,15 @@ __FBSDID("$FreeBSD$"); > * they're either not usually statically linked or they simply don't do things > * in constructors that would be adversely affected by their positioning with > * respect to this initialization. > + * > + * This conditional should be removed when GCC 4.2 is removed. > */ > -#if defined(__GNUC__) && __GNUC__ <= 4 > -#define _GUARD_SETUP_CTOR_ATTR \ > - __attribute__((__constructor__, __used__)); > -#else > +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) > #define _GUARD_SETUP_CTOR_ATTR \ > __attribute__((__constructor__ (200), __used__)); > +#else > +#define _GUARD_SETUP_CTOR_ATTR \ > + __attribute__((__constructor__, __used__)); > #endif > > extern int __sysctl(const int *name, u_int namelen, void *oldp, > > Please fix properly. Assuming clang always supported it, something like: > > #if __GNUC_PREREQ__(4, 3) || __has_attribute(__constructor__) > > should work > > Cheers, > I considered something of this sort, but searching for information on the priority argument in the first place was annoying enough that I had too much search-fatigue to figure out when GCC actually corrected this, thus assuming that GCC5 (which seemed to be an all-around good release if memory serves) and later (since I confirmed GCC6) was sufficient. I'll fix it in the morning (~8 hours) if I receive no further objections to address. Thanks! >