From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18F4F330B3E for ; Tue, 23 Dec 2025 20:20:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766521250; cv=none; b=cH73/XmKB274p0/Cqco0Q5LBhxTkw6HDX8NA+tk0fA66Yzlg4TzFXK8W0QBt5pzJh3gFiS1oKTW9LKhEAKj21eTCGBoVvWCW3KV/xQBWdcI/CgDH8IouQilriQY3ShJdxsw0U5RfbK3TgaxdD7iIjQXp4QXAtNdys4F+9oULl4k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766521250; c=relaxed/simple; bh=M8jU18A4neK6H69cUgfSmHcK+5RPJ+WWHv+9ZAv8NXE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=PNXaTZ1oyReRqtw/+ovXou2e/rSCEjRyjG4h0dErITzcN5uM4HUAOW+1mqWrBMXVozvqmIH16AMPWuEadzcbq64w5nlKcBex97QrKzYjkNOu6v9xXXoD1/Edmo2bzcjn44GCqlA7Ue9tTFeLgD7kNx8CjbiJWuwYfiq5wRl7FVk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CPAInJuO; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CPAInJuO" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-64ba9a00b5aso5698822a12.2 for ; Tue, 23 Dec 2025 12:20:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766521246; x=1767126046; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=giT2MRHg1/rwnza8PcWLC1iUWG6i2ozqYzIehY6QmgM=; b=CPAInJuOA9WArV9v+FvwB9tiDN34pRbz3SiNVIPMYJCyTYHsnD4ndWX85p/Zz3XCcS pR+wmploGSfJ0gBO6BmYqRmjbBSIx01A5/PxcqVLVYz7KYHMz5B3dWPi9qJA7DEuq8zj mFqdMez6NcFXseAESppxp2CbbMQL0hfylKVYUBoYcTvcTF9kPvhPatON/Tdt4Q6ivFRw xAR8cIuQZ43tiy+KxQtL9sJ7GH1v5fr5nj0DfC+SkhZGEFsQ/vFcNRYUDnSlw9qXV4my 4W7A7fyyn12D+E3WrDtmRDvACEavz2BYRfbvv6wAzLnwg22q2aUI1/wg8YKnGc/Rx58d T2sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766521246; x=1767126046; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=giT2MRHg1/rwnza8PcWLC1iUWG6i2ozqYzIehY6QmgM=; b=Ok+oNCq1Vir0EKiX1MPiAsWAWTDakOPZboq/7mfBRZx3jV+YzU9eTEU/nfRol6rf78 J3d1VjriFs+KWsJxsN4QHW+XACy5LkLeOkLOCVb4IAleA43RVpfjISwa/zhEVeA05xgZ hS4AL0Pq+ymu05hFM7XEXAf/+sQ5oWkaNtyxou3Ms/ARD90FZySbNMUiby4wDj59XJPt 5GI0jzPtL3CLsMVgzQXZe31YdebgSWrxXooGlEOSa8qZPghXYLAIxxKr0ifJ69TjZDPW 07QXhUjqOm+3EGJtJrP7C/0vHOe5zJHlz4M6DTweVoTM9UVwrV2wEAxWdWqSacP8fUVp n6rQ== X-Forwarded-Encrypted: i=1; AJvYcCUgugsf5a35lyi348TS6wRZK9WAbqVyv05wwtjeSX2D0LV3zMTo/GUyhPeQyF7oMsGSzt4IVdg3xIzzoH4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxuruu2dQnSMn9HWvmafzzijJ+hB1HbZTP9e9KWhAUr8mC3LFMD zYuhonwBgEZDbNwVoC5YsgyaQR38W35rx+GrvOGK9KwvY8PktjQ7m3PK X-Gm-Gg: AY/fxX57GKNs3R+//LQI7tBb2UHIit5Pa+TLXOarn/Uw/Gn5Zf+ryvuqVXKVpxWti2k ZY+RVAWpJs4ivLGWWSdt54KQC9BUJ/PveTUqaTIguPfQHnIUlmWk8FkHA/hpEGs6VAA9K34ziPu pHGZ2ia49xIdk8iI2YX2GDHiROHfZ+9ACOI/fua8ao+LUftbnQ0ZbQGTcPMzesQGqRbTJyV9jZX wmfHzg4zA6//gqwAsuffiayjcPyiMyvG+Pz9EFwwiDYdkkNIRmsrOZyuE5ulJC6g5mixZE7J6jS 21+tYOdAmQ07I4sh2XQVP2Ol+fUbyVRmZIZZ0f+HkI6ANDMpUthFLoemSPN9DVQ+g8b/X4kLIoQ 0moqL6kgL/s2txC4oMlEzDdzwZu7wDyNpsB1/YyM/IbMM4cdADWeptr+Z74z4wN0vRBnPoToTeS GKBXgvHS/GBru+5ovm0UmX6MsTkYBcqdCCw63GUhz7jHb9itH4jUKfFw== X-Google-Smtp-Source: AGHT+IHJnO4iYaAbKsFEpGyXM0mOf+COyhROD5FUCAZ10D4C7Ki9KMqPgwKbpfX/lyO84Fn9ubfb4w== X-Received: by 2002:a17:907:7295:b0:b72:d56f:3468 with SMTP id a640c23a62f3a-b803718321fmr1526935566b.50.1766521246096; Tue, 23 Dec 2025 12:20:46 -0800 (PST) Received: from fedora ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64b91599844sm14707177a12.25.2025.12.23.12.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 12:20:44 -0800 (PST) From: Uros Bizjak To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Linus Torvalds Subject: [PATCH 0/3] Remove obsolete RELOC_HIDE() macro from compiler-gcc.h Date: Tue, 23 Dec 2025 21:18:55 +0100 Message-ID: <20251223202038.91200-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.52.0 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=UTF-8 Content-Transfer-Encoding: 8bit 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 causes GCC to detect several reads from addresses below 4kB in the boot code. GCC treats absolute addresses smaller than min-pagesize param (defaulting to 4kB) as assumed results of pointer arithmetics from NULL. The following code, when compiled with -O2 -Warray-bounds (included in -Wall): int foo (void) { return *(int *)0x123; } will emit a rather cryptic warning: warning: array subscript 0 is outside array bounds of ‘int[0]’ [-Warray-bounds=] 1 | int foo (void) { return *(int *)0x123; } | ^~~~~~~~~~~~~ cc1: note: source object is likely at address zero To solve the issue, replace open-coded inline assembly used for FS/GS memory accesses in arch/x86/boot/boot.h with segment-qualified pointer dereferences. The compiler allows pointer arithmetic from NULL in __seg_fs and __seg_gs named address spaces. The early boot environment does not guarantee any minimum page size, so explicitly setting the minimum page size to zero by adding --param=min-pagesize=0 to the compiler flags when building the x86 boot code with GCC inhibits warnings for addresses below 4kB. 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=24103512, After=24100080, chg -0.01% Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Linus Torvalds Uros Bizjak (3): x86/boot: replace FS/GS inline asm with segment-qualified accesses x86/boot: disable GCC min-pagesize assumption in boot code compiler-gcc: Remove obsolete RELOC_HIDE() macro arch/x86/boot/Makefile | 3 ++ arch/x86/boot/boot.h | 58 +++++++++++------------------------- include/linux/compiler-gcc.h | 25 ---------------- 3 files changed, 21 insertions(+), 65 deletions(-) -- 2.52.0