From patchwork Wed Nov 9 00:03:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 17284 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp54975wru; Tue, 8 Nov 2022 16:27:37 -0800 (PST) X-Google-Smtp-Source: AMsMyM4GJ17lpqDMrSTpj5WK/2v3sdfkaSnzHOV7tmvEU+KFvRGPSXcclrYUFlVEUTB8gAbRkojx X-Received: by 2002:a17:907:6d25:b0:7aa:f5a4:5f66 with SMTP id sa37-20020a1709076d2500b007aaf5a45f66mr53903122ejc.216.1667953656878; Tue, 08 Nov 2022 16:27:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667953656; cv=none; d=google.com; s=arc-20160816; b=BRuTD8r7XAKCYz+Pa3U6qYT0XSxxFmCWQdYK3y2fpf2bOjUCloC3DP/0kWIuOQUb+i b3GQHxf4vGQ5dZtnLjVAHcQxGsKdTE7rOu2ZXT5MARH9x/vefl0tZd4/8+SyiVtp2dwc pSctUqPWUFkhJvaXqbGiIbhe5liD5kLulmpiPZiPvFy45KUconkFd80PS+zg16pMP5hA JaJxWJZ4gDN4T8pEEiNqb6Nk/nTkJjsGwT8kc4sh78vKQg0XBxNVY9sBSy89OW1ZAc/j Ie+/AQ0uc1DOITSP/BYwDWLj9WOl9UvyKbdzi6kGnreajbRRrK+kLAD0hBnZKRxjMiWt sHaQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=R8i0lNf/+tOciWxAm/E3PkYyBv/344T8euYk4T84Uco=; b=szFYU526gqBdk3lmE+r9kaFgtlKRXCCh7/G6iMHbsNmAkWf8EM6EzPtOQP66reaMSp hhbGH9xWYMXd9jy82HviIEDFn8Z6naCF5o5g2QwFDx3wePWXa7/MtbdQp8y3+VOZfbbL 11LKqzeDSStO8qSdYDI7XshjTC4jzpT8g0WhBBe8wZbf03LleIt6IK1m7vBRZYcy4b6D H5L7/MHB/2j/ex3doqIVlacd0TGLWIQGtoWYEUs9ERDOK11bVdyXw/dW0pSbk5+QesmV f1S6FgSc3eofftoStdQZS/41BuXSyYBBdt88x8pfsth1m0r6NvbA4JQt8AEK0TsYmYSw aMxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MNBKSJZ1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc26-20020a1709071c1a00b007820e1a4302si16626262ejc.675.2022.11.08.16.27.10; Tue, 08 Nov 2022 16:27:36 -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=@kernel.org header.s=k20201202 header.b=MNBKSJZ1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229802AbiKIAE5 (ORCPT + 99 others); Tue, 8 Nov 2022 19:04:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbiKIAEz (ORCPT ); Tue, 8 Nov 2022 19:04:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DFD75EFBF for ; Tue, 8 Nov 2022 16:04:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 37E78617E7 for ; Wed, 9 Nov 2022 00:04:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13C6BC433C1; Wed, 9 Nov 2022 00:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667952293; bh=q6xWKkEfyPavV0D6lBApe8O7RpHUwHY2qmgNGpjeGok=; h=From:To:Cc:Subject:Date:From; b=MNBKSJZ1GVZ+AEDsNWUzAZOtiCepw859zd6bUVt+w6aHfUkpT2qt3h7g3eGpMqSQ/ BtuSSaQDoFfkhnsqkXozmAoFKiFubILgXRNQsb4NcXMnZGToKaAS/ZGl5HOkkqfxlX 5MlF0V9s0jFWcsZaDT8qyxiq6ij+h2dl8v3bp2Ty8foRXYEyxXRP56m75eJsvJqF2a uFL1+AvSTPbhWIPGdZBJEITmEWUFionWfBDKGPsVpFfEBRU6AfbLjDtSDPAMN4pRYX 0odwF9WhIDe8fKxwlMCkdkH5ZBwxQ8MDwFIh4P9NkycLmGlzpQsDNL53G5sLq+JxM7 3vxTlGMR/vlwQ== From: Nathan Chancellor To: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Nathan Chancellor Subject: [PATCH] x86/vdso: Conditionally export __vdso_sgx_enter_enclave Date: Tue, 8 Nov 2022 17:03:07 -0700 Message-Id: <20221109000306.1407357-1-nathan@kernel.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748976174191004937?= X-GMAIL-MSGID: =?utf-8?q?1748976174191004937?= Recently, ld.lld moved from '--undefined-version' to '--no-undefined-version' as the default, which breaks building the vDSO when CONFIG_X86_SGX is not set: ld.lld: error: version script assignment of 'LINUX_2.6' to symbol '__vdso_sgx_enter_enclave' failed: symbol not defined __vdso_sgx_enter_enclave is only included in the vDSO when CONFIG_X86_SGX is set. Only export it if it will be present in the final object, which clears up the error. Link: https://github.com/ClangBuiltLinux/linux/issues/1756 Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers --- It would be nice if this could be picked up for an -rc release but I won't argue otherwise. Alternatively, we could add '--undefined-version' to the vDSO ldflags but this does not seem unreasonable to me. arch/x86/entry/vdso/vdso.lds.S | 2 ++ 1 file changed, 2 insertions(+) base-commit: f0c4d9fc9cc9462659728d168387191387e903cc diff --git a/arch/x86/entry/vdso/vdso.lds.S b/arch/x86/entry/vdso/vdso.lds.S index 4bf48462fca7..e8c60ae7a7c8 100644 --- a/arch/x86/entry/vdso/vdso.lds.S +++ b/arch/x86/entry/vdso/vdso.lds.S @@ -27,7 +27,9 @@ VERSION { __vdso_time; clock_getres; __vdso_clock_getres; +#ifdef CONFIG_X86_SGX __vdso_sgx_enter_enclave; +#endif local: *; }; }