From patchwork Thu Oct 19 16:50:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1851916 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=W3YtPnWJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SBDHx5WVwz20Zj for ; Fri, 20 Oct 2023 03:51:09 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C06BC3858004 for ; Thu, 19 Oct 2023 16:51:07 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 51D843858D1E for ; Thu, 19 Oct 2023 16:50:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 51D843858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 51D843858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697734259; cv=none; b=LRGdij6VQ3TsIV3Z9+/+isOYxxW9b+C/gScduvRM1K3BOyjHZVOGHaKecbX1RHcFzObRckeWHrvt2THCvfcb5c1czUOoz3KeyMysXJ2h/TlZHefYa1XglShZ36gEAi5CZ9+ib6g8qBIrfTQBPMxb6gd8GX4ILtDjuogaeJ8yCWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697734259; c=relaxed/simple; bh=RdX5egDjpQ0DFf1VQpUETCZYjVfmrVqECx9H+wOuNA4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=YvhkxDjiDSzLx21nbYEv9XPrY3j4ZPX2g+X+PA2et67G6vUGrDwjn2ZzrycH50QQmHtjZEqWvbLJJdL7tvUl86NIqyeBRjZhXGDdoNth93JzgFAGqnUvP+hlpfQ9Ql9Wk87Dg1LWdzouO4vb80VXg687nE/hK+ir5Obd3+ObS0Q= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1c9e06f058bso7941665ad.0 for ; Thu, 19 Oct 2023 09:50:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697734257; x=1698339057; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=yOK5Yq7i+HmCC75mpzI6WcCSV6Ry7pTlZD9mVIkE6Sw=; b=W3YtPnWJtku1BCQEwdxPoMLGstdHgQSDIOYH0pIQt4vtuXCBimHtbSd60MFKFzQRF6 GCH1Bb20PaBiP7Qf5BTj1+H5TPp1rb/AaLNDUa+Ypl6drqQaHXcasOzTo2nNuhiN5Egp T32L00p2gpWKndsZfaa9ay9IAqyvn+GeDINeGGRSf+qAMQnBdDlbKzE6xBtpiLQFE0n5 FkT96RTGbSfSs1Ib+KeQu/N8AvY3ZFFHWmKIpaJVszsZeAF1luBBxoNDHnfNSebduV5g TKq8DN8FItaWR8dpBJ87iYbQXhI3JGmyQm+JlHurh/SVBwJWpdOn9fGUIAHCg/05XEr8 pqTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697734257; x=1698339057; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yOK5Yq7i+HmCC75mpzI6WcCSV6Ry7pTlZD9mVIkE6Sw=; b=PsFllNEZvz0HDzBGHvklc7N2aJL1ki++BYiym3u/fCMrsq8CINgxFDYADciL/g1gma vpbHvvGw0wS4XQqYAOumEbw3fKEj5P8oZCNOwRTmSPHPsYRM9HXpDxBMPz5OUNLsQABN me+0CUGOaXAnleffd2jQPtf/o9gyc7MgpMkpfVx5t6RzPlVRIju8qsuNWvXZeIZuW8rx wgorAF5tcIrTwQCdPyq6ROI2SIUlu9PmflDVR4QI3nz/nK3ua6benrP11AYi6wfgCj1p VjIUh4mfzwuRbM63cwXo/G1kA9znKtVo5o0U+4HTFsfYboL3rWhvJq0FL7XYQQHXgp2B RBzg== X-Gm-Message-State: AOJu0YwAxcDpi7d6kvniDGmOztW0Rmi0Hpf+IQaYIwqWw1AuAr2/MNde qGe3Ts+9TcjCYpEAq3pLnaYFWSwJi4WI6kCbhMh22g== X-Google-Smtp-Source: AGHT+IEOiXW9+i2TiV32Tp485zJM7En0CkBTcKRdDMK8pbENBmMyxWdWrUIYuUliLQ7dlidX6sdmdQ== X-Received: by 2002:a17:903:22c2:b0:1b7:f64b:379b with SMTP id y2-20020a17090322c200b001b7f64b379bmr3579648plg.17.1697734256740; Thu, 19 Oct 2023 09:50:56 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:a647:8435:c932:f94b:575b]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c72f4334afsm2182890plb.20.2023.10.19.09.50.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 09:50:55 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH] malloc: Fix tst-tcfree3 build csky-linux-gnuabiv2 with fortify source Date: Thu, 19 Oct 2023 13:50:50 -0300 Message-Id: <20231019165050.2134920-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org With gcc 13.1 with --enable-fortify-source=2, tst-tcfree3 fails to build on csky-linux-gnuabiv2 with: ../string/bits/string_fortified.h: In function ‘do_test’: ../string/bits/string_fortified.h:26:8: error: inlining failed in call to ‘always_inline’ ‘memcpy’: target specific option mismatch 26 | __NTH (memcpy (void *__restrict __dest, const void *__restrict __src, | ^~~~~~ ../misc/sys/cdefs.h:81:62: note: in definition of macro ‘__NTH’ 81 | # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct | ^~~ tst-tcfree3.c:45:3: note: called from here 45 | memcpy (c, a, 32); | ^~~~~~~~~~~~~~~~~ Instead of relying on -O0 to avoid malloc/free to be optimized away, disable the builtin. Reviewed-by: DJ Delorie --- malloc/Makefile | 2 ++ malloc/tst-tcfree3.c | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/malloc/Makefile b/malloc/Makefile index c1db3347d8..f6cdf7bf0b 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -298,6 +298,8 @@ CPPFLAGS-malloc.c += -DUSE_TCACHE=1 # Uncomment this for test releases. For public releases it is too expensive. #CPPFLAGS-malloc.o += -DMALLOC_DEBUG=1 +CFLAGS-tst-tcfree3.c += -fno-builtin-malloc -fno-builtin-free + sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,') $(objpfx)mtrace: mtrace.pl diff --git a/malloc/tst-tcfree3.c b/malloc/tst-tcfree3.c index ce6d958f8a..30886b6f49 100644 --- a/malloc/tst-tcfree3.c +++ b/malloc/tst-tcfree3.c @@ -19,9 +19,6 @@ #include #include -/* Prevent GCC from optimizing away any malloc/free pairs. */ -#pragma GCC optimize ("O0") - static int do_test (void) {