From patchwork Tue Jun 6 09:38:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1790950 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=ZYE3ynDi; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qb56Y05CKz20QH for ; Tue, 6 Jun 2023 19:39:48 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Qb56X5SRSz3f8h for ; Tue, 6 Jun 2023 19:39:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=ZYE3ynDi; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::633; helo=mail-pl1-x633.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=ZYE3ynDi; dkim-atps=neutral Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Qb55K2fmSz3cdy for ; Tue, 6 Jun 2023 19:38:45 +1000 (AEST) Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1b039168ba0so51015805ad.3 for ; Tue, 06 Jun 2023 02:38:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686044322; x=1688636322; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rpeeZgd8dl7+jipG6unqIFCk/08w4lAYvrkv9b5E8wM=; b=ZYE3ynDi4GphKxtLGj5SZaxE9q1eGFCPc/WBAMAHKkUNuoCYED+aUjEDNLPCen/ia6 nl2kTKhig2Z7yBwrckmrSswvCSCLN2AroJ2vrU7TBRNmICyg6Gb53uNbyovTewNYOm7v +k/kIuhpCM8gfNdRv7EdQo5ZH87D0fjUv14wkiUF7RADobNBdgfMCbPeV83FL0AwSIYu Z8CEXZBHYtN+MlUkNCMbjmWQXGX5Ll6PNBdlS+Z+txDixPaZiHEsWiCut2SHpYneb+iS QB9gGp21lQTxO6nPWZ95LqeoYaiU/oeH+HhlfQslaL+H5D/PFKrSDAP7nQEGEUEJznjG B8og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686044322; x=1688636322; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rpeeZgd8dl7+jipG6unqIFCk/08w4lAYvrkv9b5E8wM=; b=G0V0m2tSwOcsOijEc06k7StlPZRVHYcp6dpoAXXO8z0uITotUz+YkZ3kpa5ncKHf0o FZrnnHrp6boG86yqFuIel2PsZjt1T0QW1ikP3nJbLQFOPD5wvlU+plrXKu+U46KD3s0P m8blCu9KwJSW/tMi10HZmE+rmblz1WaMbap3LYAYViqPQZ3lokriT9veOpuI7fbpupb9 BCoV6Sd5BUPH2j9+8NKsjULSbsLZ1EG5PYKxMti6IaKeoFBJONgOchi2NiijAQ00tXve FexI5j3T0esfhWCYx68VqpuHC/dno2oPB3JjLCrywH0YQG0k6wpkWgVVDqRlBiqtYPvb 45/Q== X-Gm-Message-State: AC+VfDz8QenmFHGEdwSLBH7tgYZgisRTRUFvNKD7IUzNV0x8JcE33xoK ADzljdxaxR4Uf8FSn+uTUL5dAywK5W/ShQ== X-Google-Smtp-Source: ACHHUZ43RrlFMTKqF13b6+SdFVTlnxkb8X7i4iyW38D4qoPadtkGWVxMmp9wzGgyXisfGa/Y25TA1g== X-Received: by 2002:a17:902:d2c4:b0:1ae:622c:e745 with SMTP id n4-20020a170902d2c400b001ae622ce745mr2125866plc.1.1686044322070; Tue, 06 Jun 2023 02:38:42 -0700 (PDT) Received: from wheely.local0.net (58-6-230-127.tpgi.com.au. [58.6.230.127]) by smtp.gmail.com with ESMTPSA id s8-20020a170902ea0800b001ac8218ddb7sm8048442plg.84.2023.06.06.02.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 02:38:41 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 1/4] powerpc/64: Force ELFv2 when building with LLVM linker Date: Tue, 6 Jun 2023 19:38:29 +1000 Message-Id: <20230606093832.199712-2-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606093832.199712-1-npiggin@gmail.com> References: <20230606093832.199712-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nathan Chancellor , "Naveen N . Rao" , Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The LLVM linker does not support ELFv1 at all, so BE kernels must be built with ELFv2. The LLD version check was added to be conservative, LLD simply fails to link ELFv1 entirely, effectively requiring LLD >= 15 and ELFv2 for BE builds. Instead remove that restriction until proven otherwise (LLD 14.0 links a booting ELFv2 BE vmlinux for me). The minimum GNU binutils has increased such that ELFv2 is always supported, so remove that check while we're here. Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index bff5820b7cda..e34ff0e59585 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -624,10 +624,10 @@ config ARCH_HAS_KEXEC_PURGATORY def_bool KEXEC_FILE config PPC64_BIG_ENDIAN_ELF_ABI_V2 - bool "Build big-endian kernel using ELF ABI V2 (EXPERIMENTAL)" + prompt "Build big-endian kernel using ELF ABI V2 (EXPERIMENTAL)" if LD_IS_BFD + def_bool y if LD_IS_LLD depends on PPC64 && CPU_BIG_ENDIAN depends on CC_HAS_ELFV2 - depends on LD_VERSION >= 22400 || LLD_VERSION >= 150000 help This builds the kernel image using the "Power Architecture 64-Bit ELF V2 ABI Specification", which has a reduced stack overhead and faster @@ -638,8 +638,6 @@ config PPC64_BIG_ENDIAN_ELF_ABI_V2 it is less well tested by kernel and toolchain. However some distros build userspace this way, and it can produce a functioning kernel. - This requires GCC and binutils 2.24 or newer. - config RELOCATABLE bool "Build a relocatable kernel" depends on PPC64 || (FLATMEM && (44x || PPC_85xx)) From patchwork Tue Jun 6 09:38:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1790951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=Bf0Iilwt; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qb57T0B9jz20Ty for ; Tue, 6 Jun 2023 19:40:37 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Qb57S6BfYz3fbL for ; Tue, 6 Jun 2023 19:40:36 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=Bf0Iilwt; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::22e; helo=mail-oi1-x22e.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=Bf0Iilwt; dkim-atps=neutral Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Qb55M5Ph1z3dt3 for ; Tue, 6 Jun 2023 19:38:47 +1000 (AEST) Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-39a505b901dso5106447b6e.0 for ; Tue, 06 Jun 2023 02:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686044324; x=1688636324; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=amUxvwZP6+WobxnUM7Wj7zQ1DycHLz6BAAYtZzcHcqg=; b=Bf0IilwtiiOhxvyeX/8ZDi9fpO1cUQ7oQSblaHmucQ6y11hItNjxoe+jq/Lna3lykP dBcS0HUMYFYV+97wkpv6+xAQIcJXiXAqIuwnf5I8IL8j/6eQxzk5FvmDUFZvMM1PZ922 /anJ/9IKNXQSLb5XJJtEVzQb2TNQBoA+APEB4jdvhaRGKXTDvMxkLTMaUbnqtv/ZkTBo mod8VkKAF5AmGOrWRjNZEBYYxabPArtDe4pw0BGo8+2vN+Zpj5opxAUXyz4rXZjzL0IM EPf1B0+UYJjA4MisYwgk0qraLIK/3SnsDvWmWjnh7mHvylT1cJJfQF8K4PsmuMnvDX93 8wVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686044324; x=1688636324; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=amUxvwZP6+WobxnUM7Wj7zQ1DycHLz6BAAYtZzcHcqg=; b=BRkMhybX+1prkI+disOuj0g/8xlHGB1Enmf8tQ4LaZARBjIXKJo7g2chJcE1ePgFfJ 2g3Es3tJ352M8CaeqRzhuPfag6r5nWeUbWT8Zr2MiJt/3eky5lwMu4cx7a8JF8YZpvUr a6D+sbXC5oQuvG5TaQv/x7+dvWoFvDDBl8EsGL1KhVczhIKEeRyJyFfcj3S6ety359ch 5bjjzLlHxm91kZPgYWorZ1Cyda4CtFX3KkdsyiRwa06TZvbD5XJgNmpFC945YmoEfokj rOO7vPFZMcmZF/g7HAz6IoRXrheTk3fcBFtJPhpO14XCcio5a8X7LKYY25WvlPYizbbG G72g== X-Gm-Message-State: AC+VfDxODtysgMz/yrhsG/9UPw7Htj0IwCC+BKJDSPdrdkpzAArPGEN/ /opv6ts5kgaYSjnavelMkW32Cn3Z9NgWhA== X-Google-Smtp-Source: ACHHUZ7rrlk/ecvGwC30wg3olSPf2BIjdkvr09D7ZgS1g7sJpq7PMxakH7SnhQSyW/59UEB8IuBPpw== X-Received: by 2002:a54:4588:0:b0:39c:4553:9644 with SMTP id z8-20020a544588000000b0039c45539644mr1676002oib.42.1686044324780; Tue, 06 Jun 2023 02:38:44 -0700 (PDT) Received: from wheely.local0.net (58-6-230-127.tpgi.com.au. [58.6.230.127]) by smtp.gmail.com with ESMTPSA id s8-20020a170902ea0800b001ac8218ddb7sm8048442plg.84.2023.06.06.02.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 02:38:44 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 2/4] powerpc/64: Make ELFv2 the default for big-endian builds Date: Tue, 6 Jun 2023 19:38:30 +1000 Message-Id: <20230606093832.199712-3-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606093832.199712-1-npiggin@gmail.com> References: <20230606093832.199712-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Naveen N . Rao" , Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" All supported toolchains now support ELFv2 on big-endian, so flip the default on this and hide the option behind EXPERT for the purpose of bug hunting. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index e34ff0e59585..296e0448b5fc 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -624,8 +624,10 @@ config ARCH_HAS_KEXEC_PURGATORY def_bool KEXEC_FILE config PPC64_BIG_ENDIAN_ELF_ABI_V2 - prompt "Build big-endian kernel using ELF ABI V2 (EXPERIMENTAL)" if LD_IS_BFD - def_bool y if LD_IS_LLD + # Option is available to BFD, but LLD does not support ELFv1 so this is + # always true there. + prompt "Build big-endian kernel using ELF ABI V2" if LD_IS_BFD && EXPERT + def_bool y depends on PPC64 && CPU_BIG_ENDIAN depends on CC_HAS_ELFV2 help From patchwork Tue Jun 6 09:38:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1790954 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=Ys1w4a/6; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qb58N0DQlz20Ty for ; Tue, 6 Jun 2023 19:41:24 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Qb58M67v7z3dyX for ; Tue, 6 Jun 2023 19:41:23 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=Ys1w4a/6; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::229; helo=mail-oi1-x229.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=Ys1w4a/6; dkim-atps=neutral Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Qb55Q5s5bz3f0s for ; Tue, 6 Jun 2023 19:38:50 +1000 (AEST) Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-39ab96e6aefso2002640b6e.1 for ; Tue, 06 Jun 2023 02:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686044328; x=1688636328; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kCh6RVJI4h7nw2maw98k2ell5XwYb4yP+21lrC089v4=; b=Ys1w4a/6FCc9j6NvOaE9+7w4fuxadYIURiTEJim5ekaVKCKzhi5Kj53XtM8f61wR4v fz66GqNp0onlIJWdgFFac+Fc9JJ+CcsocEQ0b+0Eu+iR3q24Ef9FF6Ryde/m1gIPMy4x W6sKOBo1Pnc8jTpcJmFHH+e85JS7HYoDvXhtsFqR7wexNGdX/lFiLi7kfT0z9eDPu2dE 0C2ag9Pzf7uos+Gt7TiijiA7An9sCi0161gCt0AkqN9lThzJVXB969MX2z3AYVl3kypf Z/Qzh0RtiPZl9WyhZXz84YYaGpoNu9ujyrtKE+2dFc7ssCvcCgyRi8NZBU8ug0X7utt1 tQoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686044328; x=1688636328; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kCh6RVJI4h7nw2maw98k2ell5XwYb4yP+21lrC089v4=; b=HnB9V+wjpMQvcKd1+9dDl0O+M6bihf+4tjp2WHBbpCttXl5qr04nkSUaFnYz0TSEF1 EuKAw2SoEzRhAUQV9IrIE3fj5yesn0WbnxX37Fe16jH6gzxgyc+Apmdf3E94lTXALImC sjRIg+XYijy3pmBNJv1fJysx3sRpx9gCtaN3r71/6jr/dtyzM85ZBhazoY8vjA00qZpH 60irugGU4kCCKIOR3pmaEglFj6CQdPOo4DqWfm8orOUJV33dGp/L9+T7Iej1rw9txN5H /DdCVAxeuhCjq+nspqQmkARFvNdt9PYmXLJWquwv7+t27/WcLMxFDFvYaKzvnxEp7gxM su7A== X-Gm-Message-State: AC+VfDyqaEzyIdNSYwXwv3mgAlADWRtHtp3DALvLYe7ePY7bIj0v2ZD8 eHcy4tijgnMpN30yWRMi4Xe7n4LSpjqZ+g== X-Google-Smtp-Source: ACHHUZ7E/8oi8nxRWE7Cwv9fr4Es95LhTZYyXhaTIRsiIkkKDw+t8RG3Op6X3COs94l+wblvlQSTHQ== X-Received: by 2002:a05:6808:8fb:b0:39a:5ea3:6b16 with SMTP id d27-20020a05680808fb00b0039a5ea36b16mr1677958oic.41.1686044327883; Tue, 06 Jun 2023 02:38:47 -0700 (PDT) Received: from wheely.local0.net (58-6-230-127.tpgi.com.au. [58.6.230.127]) by smtp.gmail.com with ESMTPSA id s8-20020a170902ea0800b001ac8218ddb7sm8048442plg.84.2023.06.06.02.38.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 02:38:47 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 3/4] powerpc/64: Use -mprofile-kernel for big endian ELFv2 kernels Date: Tue, 6 Jun 2023 19:38:31 +1000 Message-Id: <20230606093832.199712-4-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606093832.199712-1-npiggin@gmail.com> References: <20230606093832.199712-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Naveen N . Rao" , Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" -mprofile-kernel is an optimised calling convention for mcount that Linux has only implemented with the ELFv2 ABI, so it was disabled for big endian kernels. However it does work with ELFv2 big endian, so let's allow that if the compiler supports it. Acked-by: Naveen N. Rao Suggested-by: Christophe Leroy Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 5 +++-- arch/powerpc/tools/gcc-check-mprofile-kernel.sh | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 296e0448b5fc..9db707829638 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -547,8 +547,9 @@ config LD_HEAD_STUB_CATCH If unsure, say "N". config MPROFILE_KERNEL - depends on PPC64 && CPU_LITTLE_ENDIAN && FUNCTION_TRACER - def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__) + depends on PPC64_ELF_ABI_V2 && FUNCTION_TRACER + def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -mlittle-endian) if CPU_LITTLE_ENDIAN + def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -mbig-endian) if CPU_BIG_ENDIAN config HOTPLUG_CPU bool "Support for enabling/disabling CPUs" diff --git a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh index 137f3376ac2b..a31a56016c09 100755 --- a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh +++ b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh @@ -7,20 +7,21 @@ set -o pipefail # To debug, uncomment the following line # set -x -# -mprofile-kernel is only supported on 64le, so this should not be invoked -# for other targets. Therefore we can pass in -m64 and -mlittle-endian -# explicitly, to take care of toolchains defaulting to other targets. +# -mprofile-kernel is only supported on 64-bit, so this should not be invoked +# for 32-bit. We pass in -m64 explicitly, and -mbig-endian and -mlittle-endian +# are passed in from Kconfig, which takes care of toolchains defaulting to +# other targets. # Test whether the compile option -mprofile-kernel exists and generates # profiling code (ie. a call to _mcount()). echo "int func() { return 0; }" | \ - $* -m64 -mlittle-endian -S -x c -O2 -p -mprofile-kernel - -o - \ + $* -m64 -S -x c -O2 -p -mprofile-kernel - -o - \ 2> /dev/null | grep -q "_mcount" # Test whether the notrace attribute correctly suppresses calls to _mcount(). echo -e "#include \nnotrace int func() { return 0; }" | \ - $* -m64 -mlittle-endian -S -x c -O2 -p -mprofile-kernel - -o - \ + $* -m64 -S -x c -O2 -p -mprofile-kernel - -o - \ 2> /dev/null | grep -q "_mcount" && \ exit 1 From patchwork Tue Jun 6 09:38:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1790958 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=QkaPvdTe; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qb59S0dxQz20Ty for ; Tue, 6 Jun 2023 19:42:19 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Qb59Q1nzsz3fhC for ; Tue, 6 Jun 2023 19:42:18 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=QkaPvdTe; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::533; helo=mail-pg1-x533.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=QkaPvdTe; dkim-atps=neutral Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Qb55T1ctvz3f0D for ; Tue, 6 Jun 2023 19:38:52 +1000 (AEST) Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5428f63c73aso2909505a12.1 for ; Tue, 06 Jun 2023 02:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686044330; x=1688636330; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BP7sv56sSZVGYKuG4xdF4PTVbcSuzFuYTXq7ORXVJsE=; b=QkaPvdTetHaBh2yTUt0SThgEn66LGUG+ecXfFHZHH8xyKBEM9T+eXCRAAQrGuM+jf2 yHBLgNzsRk9YqM/ayTlJiRyhpbVHaYV5QZsegaPBKcvNeQP311n5e0DXjaxrkJ+NAxr+ O21Dy5rEApMvLs3HmXJsk8In/nC7GT7PcBanzwdT64MwGJL/LUjMt/Idn4JuK9AQTcim Zw96d4Uv+0m7RC1U+KYBDzUR5SO+2iGTxe7hik08KoQHPYdfjJa/WRO8BUqkkcOPMDD6 jsHCdzsmSIybhr6n2iM36Of7XjES2rCururP7xS6Vrjvoj6iltzltzOZJ6vUBrPUo/cV FxFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686044330; x=1688636330; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BP7sv56sSZVGYKuG4xdF4PTVbcSuzFuYTXq7ORXVJsE=; b=BCUWjY94OIv9RhuQKYRNsPfVCdoSHpeZjcIy6cFgryf16lhChSxO3DZ418VunjVO+d e+zqrq52ASRTqmNY/JeO9ubYma0yvz3ueSiXc66WUI82Fp1SzY8qwkYCYKMSAIBfhb8R NEti2dgsbSrgbxgzdH1OHtCORvZhjGSHtNfxUfxTHyGMMHG0XsPq910l0qwMjCuNDdYf pX7vnmH99Bo4MwlPtC4957brw4xgFQDVm0Uh2J8MfC67LQB6YRiX3CIOxIQmfM3CRi1o jdhvTI0B2kTNlMUQ/S1kX6oI40OJIwzXoH4aJafWl/TZLqDA2kZAxJPpYxfkgHmN3MXP JEXQ== X-Gm-Message-State: AC+VfDz+s6cJ0DNfYneKmfMFvgEBdYzRblx2cVwAU3+J5GVyzcQ/o61D 3dpwwgXP9xya7bfLjQMo351ngj4csT4tuA== X-Google-Smtp-Source: ACHHUZ6BHXdy/Pg6hkTVsrV084gpFqYMFeyjThiQambRoeBhCA+9FDCMhwMwVdxwefZ0mrCJt3V42g== X-Received: by 2002:a05:6a20:914f:b0:10b:71c:20c5 with SMTP id x15-20020a056a20914f00b0010b071c20c5mr1563673pzc.51.1686044330458; Tue, 06 Jun 2023 02:38:50 -0700 (PDT) Received: from wheely.local0.net (58-6-230-127.tpgi.com.au. [58.6.230.127]) by smtp.gmail.com with ESMTPSA id s8-20020a170902ea0800b001ac8218ddb7sm8048442plg.84.2023.06.06.02.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 02:38:49 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 4/4] powerpc/64s: Remove support for ELFv1 little endian userspace Date: Tue, 6 Jun 2023 19:38:32 +1000 Message-Id: <20230606093832.199712-5-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606093832.199712-1-npiggin@gmail.com> References: <20230606093832.199712-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Naveen N . Rao" , Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" ELFv2 was introduced together with little-endian. ELFv1 with LE has never been a thing. The GNU toolchain can create such a beast, but anyone doing that is a maniac who needs to be stopped so I consider this patch a feature. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/elf.h | 6 ++++++ arch/powerpc/include/asm/thread_info.h | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h index 79f1c480b5eb..a26ca097d032 100644 --- a/arch/powerpc/include/asm/elf.h +++ b/arch/powerpc/include/asm/elf.h @@ -12,8 +12,14 @@ /* * This is used to ensure we don't load something for the wrong architecture. + * 64le only supports ELFv2 64-bit binaries (64be supports v1 and v2). */ +#if defined(CONFIG_PPC64) && defined(CONFIG_CPU_LITTLE_ENDIAN) +#define elf_check_arch(x) (((x)->e_machine == ELF_ARCH) && \ + (((x)->e_flags & 0x3) == 0x2)) +#else #define elf_check_arch(x) ((x)->e_machine == ELF_ARCH) +#endif #define compat_elf_check_arch(x) ((x)->e_machine == EM_PPC) #define CORE_DUMP_USE_REGSET diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h index bf5dde1a4114..bc5d39a835fe 100644 --- a/arch/powerpc/include/asm/thread_info.h +++ b/arch/powerpc/include/asm/thread_info.h @@ -183,9 +183,13 @@ static inline bool test_thread_local_flags(unsigned int flags) #define clear_tsk_compat_task(tsk) do { } while (0) #endif -#if defined(CONFIG_PPC64) +#ifdef CONFIG_PPC64 +#ifdef CONFIG_CPU_BIG_ENDIAN #define is_elf2_task() (test_thread_flag(TIF_ELF2ABI)) #else +#define is_elf2_task() (1) +#endif +#else #define is_elf2_task() (0) #endif