From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE2F2358369 for ; Wed, 1 Jul 2026 22:45:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782945914; cv=none; b=W2vtbQapUpxsH/QaM8bT+sk1QL8cji6qsX/0yfrN3X59bTUUNoXgjXIMluS0GusUAEgUquEYmsRSSkBERzVqsGVb6Msjkcgsd+ZmOrK5rGKVwxoVZNx3Oi0zWF1zaNne2s7wnuJPDxIk2ge/uY2pHZjqoPLSIdCspNsWsYzeuR4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782945914; c=relaxed/simple; bh=8ghl9CeLr29ncJi2XJRLgQlpx1MnRczHWGLJoc+84io=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=TS+8gVJsI5xvfg1yoecaVxWPDblrNbnTsWCIUaddvLK4mKhJydEfocPRIzq71sbZxaIWMwi9mkfVFt4zM6BIXZw4U7x9OMa3JT2dFG8CgqFlgV0eRF2dCedWBZZ7rbJxySv0F6yVnFzLHkQ1BaeEsnaC11dK4IXH8XcuV9S3BrY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=eAeirkm3; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="eAeirkm3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4373C1F000E9; Wed, 1 Jul 2026 22:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1782945913; bh=LunOyIQLgoXASWLh+3aKHwXewkMK2T46S0+2/foPrTw=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=eAeirkm36QE7c2WPKG+wmP+croTVHn78PDpQZP1lspgFE8kS5X/8QWGa7GCYwVUx7 jZctF+fwSDesIiwhmhW8SXaG5MsT+nc10KJkEIki8bx7xY2xqJENOqYK15Gf13ej8E j1vOYPDmmpQ7C+ye+GXX815skKp4dl3O2SslephA= Date: Wed, 1 Jul 2026 15:45:12 -0700 From: Andrew Morton To: "Joy H.J. Lee" Cc: Nathan Chancellor , David Laight , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] tools/compiler: match glibc 2.42 definition of __attribute_const__ Message-Id: <20260701154512.22e1e5377f21d8a2dd374cd5@linux-foundation.org> In-Reply-To: <20260701200635.3992767-1-rkr0k0r@gmail.com> References: <20260701200635.3992767-1-rkr0k0r@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 2 Jul 2026 05:06:35 +0900 "Joy H.J. Lee" wrote: > glibc 2.42 added __attribute_const__ to sys/cdefs.h: > > # define __attribute_const__ __attribute__ ((__const__)) > > GCC 15 warns when a macro is redefined to a different replacement list > (-Wbuiltin-macro-redefined). Since host tool Makefiles (resolve_btfids, > objtool) pass -Werror, this conflict becomes fatal. > > The warning is suppressed on standard native builds because GCC treats > /usr/include as a system header path (-isystem), and macro-redefinition > warnings from system headers are silently suppressed by GCC. It fires > when glibc headers are on a regular include path (-I) instead, which > is the case in cross-compilation setups such as NixOS, where the > sysroot's glibc is passed explicitly via -I rather than -isystem. > > Per (C11 6.10.3), identical replacement lists are accepted silently. > Match the glibc definition exactly, including the space before "((", so > the redefinition is accepted without warning regardless of whether > glibc headers are treated as system or non-system includes. > > ... > > --- a/tools/include/linux/compiler.h > +++ b/tools/include/linux/compiler.h > @@ -119,7 +119,7 @@ > #define __read_mostly > > #ifndef __attribute_const__ > -# define __attribute_const__ > +# define __attribute_const__ __attribute__ ((__const__)) > #endif > > #ifndef __maybe_unused I'm thinking this should be backported into earlier kernels, so they can be compiled successfully on glibc-2.42 systems. Do you agree?