From nobody Mon Feb 9 10:28:07 2026 Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (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 38D7C47D941 for ; Tue, 20 Jan 2026 19:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768938912; cv=none; b=ahIB912m+3wCohJ9Mx21YDtPAcFgjUvSZRPf8/jZf5774RJYV0hBT81VVAU0BKUKjPdortXXGQ/HOZUoEuJk6ZTRRNzd83EETpfqhTRhZA7w/pOBHiN3sfcr5sb3aVP2td9gsyTfdmfbdvdU2clQi0Bl2YOCLFs2oIFjbi5cYwk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768938912; c=relaxed/simple; bh=LVjb51BubXtjCXFlaIflrd6zYn+Fs3tYXyrpiykRI2g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gW9qkYc5o7XoRrpZKhSGIlWcq2ZNmDJtU7AePPL6G2+kj3fyEqgo1uJUvdyhgXlaAHuuQdhsub6WgVOuHZHdOjF12o4CKSnEI2jNv5KGiEp8G3s78BZsklIJx55QgMpu7z1xB7fTBLXHW+MnLVfVozsYBhghKx1DJdARn3U/6PM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=GoCgxtX6; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="GoCgxtX6" Received: from mail.zytor.com ([IPv6:2601:646:8081:9483:12c5:bc8e:d949:3497]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 60KJsD3L3899199 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 20 Jan 2026 11:54:35 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 60KJsD3L3899199 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025122301; t=1768938877; bh=Y67Y9z1Bfloc55qymo/CX4LxL/c7ZFllEVhyJRIxejU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GoCgxtX6+1Yyzn6zMwaCrDps0qUr+H98ddGIRlV05URMYuXhGrjq8lKpv5fFWQukg ruIvydbBYtfyM1TipOHNtf+MKUjwugJ5VJECsmhkA8VbS1x/B3siefFt6gMqhAwopW nNFhnD19NoB4uJVg0bYgST5zYOCjHkms/Eyuf896wPej2fIU5hT0X4nM33VN/Z4TEY xormATv11e4hYhT5H2ZHGdssl/4URmgdjGpjDXAic1VYOapE6+9WnlQUF7sORaDaUl thIID8VKl0hqX8jq6MkYjzDsbtoOj8BGOhzXdjvDJUhGs5kghGW5wWhT4bhYR6i9CJ 9WcTAB4vF0SMw== From: "H. Peter Anvin" To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Uros Bizjak , Petr Mladek , Andrew Morton , Kees Cook , "Peter Zijlstra (Intel)" , Nathan Chancellor , Kiryl Shutsemau , Rick Edgecombe Cc: "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, x86@kernel.org, Thomas Gleixner , Ingo Molnar , Linus Torvalds Subject: [PATCH v1 14/14] compiler-gcc: Remove obsolete RELOC_HIDE() macro Date: Tue, 20 Jan 2026 11:54:06 -0800 Message-ID: <20260120195407.1163051-15-hpa@zytor.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260120195407.1163051-1-hpa@zytor.com> References: <20260119192923.651588-1-hpa@zytor.com> <20260120195407.1163051-1-hpa@zytor.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Uros Bizjak Remove the RELOC_HIDE() macro from include/linux/compiler-gcc.h. The GCC specific macro was historically used to workaround very old compiler bugs (including pre-4.1 ppc64 GCC). These compilers are long obsolete. The generic RELOC_HIDE() macro should be used instead. The removal of the GCC specific macro results in the following code size reduction: text data bss dec hex filename 28526453 4823511 737108 34087072 20820a0 vmlinux-old.o 28520945 4823463 737108 34081516 2080aec vmlinux-new.o ./bloat-o-meter vmlinux-old.o vmlinux-new.o add/remove: 4/14 grow/shrink: 189/674 up/down: 4433/-7865 (-3432) ... Total: Before=3D24103512, After=3D24100080, chg -0.01% Signed-off-by: Uros Bizjak Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Linus Torvalds --- include/linux/compiler-gcc.h | 25 ------------------------- include/linux/compiler.h | 8 ++++++++ 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 5de824a0b3d7..081e658754b9 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -10,31 +10,6 @@ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) =20 -/* - * This macro obfuscates arithmetic on a variable address so that gcc - * shouldn't recognize the original var, and make assumptions about it. - * - * This is needed because the C standard makes it undefined to do - * pointer arithmetic on "objects" outside their boundaries and the - * gcc optimizers assume this is the case. In particular they - * assume such arithmetic does not wrap. - * - * A miscompilation has been observed because of this on PPC. - * To work around it we hide the relationship of the pointer and the object - * using this macro. - * - * Versions of the ppc64 compiler before 4.1 had a bug where use of - * RELOC_HIDE could trash r30. The bug can be worked around by changing - * the inline assembly constraint from =3Dg to =3Dr, in this particular - * case either is valid. - */ -#define RELOC_HIDE(ptr, off) \ -({ \ - unsigned long __ptr; \ - __asm__ ("" : "=3Dr"(__ptr) : "0"(ptr)); \ - (typeof(ptr)) (__ptr + (off)); \ -}) - #if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__) #define __latent_entropy __attribute__((latent_entropy)) #endif diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 04487c9bd751..6affb7b44be7 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -148,6 +148,14 @@ void ftrace_likely_update(struct ftrace_likely_data *f= , int val, =3D (unsigned long)&sym; #endif =20 +/* + * This macro obfuscates arithmetic on a variable address so that the comp= iler + * shouldn't recognize the original var, and make assumptions about it. + * + * This is needed because the C standard makes it undefined to do pointer + * arithmetic on "objects" outside their boundaries and compilers assume + * this is the case. In particular they assume such arithmetic does not wr= ap. + */ #ifndef RELOC_HIDE # define RELOC_HIDE(ptr, off) \ ({ unsigned long __ptr; \ --=20 2.52.0