Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp909999rwl; Thu, 5 Jan 2023 06:19:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXvRLUDK8RlrQveia/ixGJlcpzyqefr1alauJ8KH06+r/INJ5DGiOg/SKVusAQ9SLYJ3bbQ3 X-Received: by 2002:a17:902:e74d:b0:189:6d2f:4bcd with SMTP id p13-20020a170902e74d00b001896d2f4bcdmr67762320plf.0.1672928352165; Thu, 05 Jan 2023 06:19:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672928352; cv=none; d=google.com; s=arc-20160816; b=pehdMZqGDO6IyJKFFP3L17whK9xQRqZMaaT+W0Gp3FQW8csnXhI28n4/lavqsJLie2 ueK3kA7FufsUpsSl5XWLvpAg6ZBJ0uzIfdUy5YCBKIVup/jCJwyxiD0D7pd/0RW+6wza y2HuOR08n6lvsVgUc5crV2L+X/YGEfHqI6IrSIUz/9YbAhuU8AR++yS3zJQYH0x0+mzn 4mL1dgHZwTNURuet48MUNWagtefTEnJzZQ+ryPE80FaCuK93eBE0lZ+EW3KPdoNd9eYF Gjt5kb+qLMJllGeIe9TDiXgf/2frQyjfxQGOF2Rv2O/W1mS43VS/FXiiKbZXMYNiIyUO zQJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QTsUQ1sYWKmE6XhlhLQnxBN+PbVBVcCR/OFSB37SXXk=; b=lmkIJD4WTq63/C0h283fmkLUp98ptzN8+ZYC/6zkBh4s+hjVgEWgaMOACnlxNrtmjh rU+ABAUhn/L68hlBLF5uv78mYT4GufmB37lRNJP2JG5VGlUPRHQvK/QRzXpDSlMHjyDQ ErxrXfLFpBIRl3VX0numS0E1LDGTuIyUfFPA4bSJdXIfMGDqM00d/w1CioBGD1HTojj9 1eQ7NydevNN/gSGP21f5dJR3DwDZ7YAhVC/Qs6EnLRmudbHsNFgVjI3ktV2f38GkofOC +XE8xHImGJguT0GzjfM/1P1omehfakDChfv9Hqn53noAsYirVfCr+nziA0qh7bdsOrua jTAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=WwSDQTP0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t15-20020a170902e84f00b001898558457dsi39609110plg.123.2023.01.05.06.19.03; Thu, 05 Jan 2023 06:19:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=WwSDQTP0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232854AbjAENYU (ORCPT + 56 others); Thu, 5 Jan 2023 08:24:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231927AbjAENYR (ORCPT ); Thu, 5 Jan 2023 08:24:17 -0500 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D49162003; Thu, 5 Jan 2023 05:24:15 -0800 (PST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4NnnHb3ZNQz4xwl; Fri, 6 Jan 2023 00:24:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1672925051; bh=QTsUQ1sYWKmE6XhlhLQnxBN+PbVBVcCR/OFSB37SXXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WwSDQTP0O+RGc33AQz0bKGVZ720wPJAqF3y3BD82q9g+6UpcEYilbbDc/1Qwlzs3s z/o8mweLhXRCC3Allh/ld8NDQA1eMbdCrAzDgsqJDhTRAdEDxlSO4eEuSAGKtaBkaa nEClg+3ffaCE2j8FMP2VLdDUNog+WakODNizO0wM512Y1dZXgXaSkBetLefKvxyJgP tYCT72k4gQ11D5HxKp+iCi9LzOdPPGdfit1onVGKe7qP4X8AxQekj7lZ0YYOVGYK51 UmR8N+0Yf88NvUJp6eKlxD8TJaSyX4Xo9ErJSn12aGnI3LtKhzsZLI+tCvMm+fqGck /WLZZk3urYKEw== From: Michael Ellerman To: Cc: , , , , ardb@kernel.org, Subject: [PATCH 2/3] powerpc/vmlinux.lds: Don't discard .rela* for relocatable builds Date: Fri, 6 Jan 2023 00:23:48 +1100 Message-Id: <20230105132349.384666-2-mpe@ellerman.id.au> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105132349.384666-1-mpe@ellerman.id.au> References: <20230105132349.384666-1-mpe@ellerman.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Relocatable kernels must not discard relocations, they need to be processed at runtime. As such they are included for CONFIG_RELOCATABLE builds in the powerpc linker script (line 340). However they are also unconditionally discarded later in the script (line 414). Previously that worked because the earlier inclusion superseded the discard. However commit 99cb0d917ffa ("arch: fix broken BuildID for arm64 and riscv") introduced an earlier use of DISCARD as part of the RO_DATA macro (line 137). With binutils < 2.36 that causes the DISCARD directives later in the script to be applied earlier, causing .rela* to actually be discarded at link time, leading to build warnings and a kernel that doesn't boot: ld: warning: discarding dynamic section .rela.init.rodata Fix it by conditionally discarding .rela* only when CONFIG_RELOCATABLE is disabled. Fixes: 99cb0d917ffa ("arch: fix broken BuildID for arm64 and riscv") Signed-off-by: Michael Ellerman --- arch/powerpc/kernel/vmlinux.lds.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index c5ea7d03d539..a4c6efadc90c 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -411,9 +411,12 @@ SECTIONS DISCARDS /DISCARD/ : { *(*.EMB.apuinfo) - *(.glink .iplt .plt .rela* .comment) + *(.glink .iplt .plt .comment) *(.gnu.version*) *(.gnu.attributes) *(.eh_frame) +#ifndef CONFIG_RELOCATABLE + *(.rela*) +#endif } } -- 2.39.0