From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x933.google.com (mail-ua1-x933.google.com [IPv6:2607:f8b0:4864:20::933]) by sourceware.org (Postfix) with ESMTPS id C48323959C89 for ; Wed, 18 Mar 2020 22:21:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C48323959C89 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jimw@sifive.com Received: by mail-ua1-x933.google.com with SMTP id 8so23578uar.3 for ; Wed, 18 Mar 2020 15:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fbe8scz27KeOQJWirvXZTVibcoO3OPBinaPu1mlyLxM=; b=YU9Fkyxgt8cS5xt5ApdSR9RTdCOJUT2/zQMXqD36Jm6figtKA9xfagxoYwlGR034/r alqQnb/BNyIsivqdoAKZMi8GbokDUizilPagqWFfSYmXx+wdQvb42iE2fCriHcaK10Z4 RQupUTAmZ1A2bbnWJDB0mgxUhXQO/cAfeOrGKyKSUnFFFCIBQ/mkKvF4t9cOuTZR7leC L3NeyGKuhaVfFB0Vlu2ozYmvua5IhcPGwCkbWeUU/wb2lerTe/joLgpDAYLmMJiwvzo6 yopzECLPoYQ8OuCchfIijT0vhcfcpYPa+cEOGeCiGldNxLggamM9NOEtgEr/EwE/lMB8 RGSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fbe8scz27KeOQJWirvXZTVibcoO3OPBinaPu1mlyLxM=; b=VLynHJbv04PQTyRnKCn1lCBiypAVHa0HylOBFCVnmiUYJFaKHoDw1y/VH1WfTiJ6m1 v97SxLgpTncrUI38PeeQoO1ozqh9aqsxASIJK05k1giglSop/dOEipyqHlZPvh5IC8Rp fOrTcwBzsfm1HYx9bH7uueJcFpDg6EIvxIoi0iKlNSCo1r9STqBmXMRn120PTRjWV55g c0Qab7qF7JEN2Qv5dCC0hgQ4gjeN94vAY5mApe8jvijU5DjWbjQeT1WcXtfcQ31Dw9ZI xkNokTwFwyPR4rg+EisZHNIzJNqREOF2IXVyuDo+it1uCwV1EKekjUi+5FEWaqHkR2SN XD1g== X-Gm-Message-State: ANhLgQ0HhFB0VXDTzsVGE9yGrmB1UXBmBea+gEIENWZTHaC6a3aYYw1J N41Sbt/1Wa6f52FORfNHHmV62nHXwnBl0SiDMjKpHw== X-Google-Smtp-Source: ADFU+vv/dkvW7G2ebLQ82hamjuPgvkysrhB0qfgPkH6AkFvoNwMTJY0CowdXS61qHzAAtgZ2Vzcaa72F1jQmZXPLnD4= X-Received: by 2002:ab0:70d9:: with SMTP id r25mr4901563ual.67.1584570071292; Wed, 18 Mar 2020 15:21:11 -0700 (PDT) MIME-Version: 1.0 References: <7394ef90-f1f3-c126-1126-416293d169f7@gmail.com> In-Reply-To: <7394ef90-f1f3-c126-1126-416293d169f7@gmail.com> From: Jim Wilson Date: Wed, 18 Mar 2020 15:21:00 -0700 Message-ID: Subject: Re: Hot to test for _FORTIFY_SOURCE with Autoconf To: Martin Sebor Cc: noloader@gmail.com, Jonathan Wakely , gcc-help Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2020 22:21:12 -0000 On Tue, Mar 17, 2020 at 6:49 PM Martin Sebor via Gcc-help wrote: > > On Tue, Mar 17, 2020 at 8:11 PM Jonathan Wakely wrote: > > I think it is related to object size checking. > > In GCC 10 you can test __has_builtin (__builtin_object_size). In GCC > versions that don't support __has_builtin using __builtin_object_size > will either compile or not, depending on whether it's supported. It > doesn't depend on any macros. That is a good way to test if the compiler has object size checking support, but it is no guarantee that the C library has FORTIFY_SOURCE support. If it is fortify source support that you need, then you need to explicitly check for that. If it is just the object size checking support you need, then you can do the check this way. Jim