From nobody Fri Sep 12 01:34:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0385BC04A94 for ; Tue, 8 Aug 2023 20:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234523AbjHHUYE (ORCPT ); Tue, 8 Aug 2023 16:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231178AbjHHUXk (ORCPT ); Tue, 8 Aug 2023 16:23:40 -0400 Received: from icts-p-cavuit-3.kulnet.kuleuven.be (icts-p-cavuit-3.kulnet.kuleuven.be [134.58.240.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18ED91E002; Tue, 8 Aug 2023 12:32:46 -0700 (PDT) X-KULeuven-Envelope-From: jo.vanbulck@cs.kuleuven.be X-KULeuven-Scanned: Found to be clean X-KULeuven-ID: 5DFB020171.A0C09 X-KULeuven-Information: Katholieke Universiteit Leuven Received: from icts-p-ceifnet-smtps-0.kuleuven.be (icts-p-ceifnet-smtps.service.icts.svcd [IPv6:2a02:2c40:0:51:144:242:ac11:2f]) by icts-p-cavuit-3.kulnet.kuleuven.be (Postfix) with ESMTP id 5DFB020171; Tue, 8 Aug 2023 21:32:42 +0200 (CEST) BCmilterd-Mark-Subject: no BCmilterd-Errors: BCmilterd-Report: SA-HVU#DKIM_VALID#0.00,SA-HVU#DKIM_VALID_AU#0.00,SA-HVU#DKIM_SIGNED#0.00 X-CAV-Cluster: smtps DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cs.kuleuven.be; s=cav; t=1691523162; bh=gKzN2ReysUr7DNEdL8dIhxZEnItry9NSaeuSyUxx+yA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iyVWKjHN03/VD4k5F/GsZjT/9ECQgPRrOGjmTJ+dqRoHfLHy0lfOVOG98KJpHgM3L 4g2+Um/vHrDwVZ3u4wkbKAc5rkxSLLtzy0tEUTsriv7kI/pDrvDyuNKe3z768cC3q7 dOUIDRwGqb3svl48ALvfvUq0gggvlGcfvVFb9L50= Received: from localhost.localdomain (rrcs-24-123-120-98.central.biz.rr.com [24.123.120.98]) (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 icts-p-ceifnet-smtps-0.kuleuven.be (Postfix) with ESMTPSA id B1087D4F79BEF; Tue, 8 Aug 2023 21:32:40 +0200 (CEST) X-Kuleuven: This mail passed the K.U.Leuven mailcluster From: Jo Van Bulck To: jarkko@kernel.org, kai.huang@intel.com, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org Cc: dave.hansen@linux.intel.com, Jo Van Bulck Subject: [PATCH 8/8] selftests/sgx: Specify freestanding environment for enclave compilation Date: Tue, 8 Aug 2023 12:31:45 -0700 Message-Id: <20230808193145.8860-9-jo.vanbulck@cs.kuleuven.be> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230808193145.8860-1-jo.vanbulck@cs.kuleuven.be> References: <20230808193145.8860-1-jo.vanbulck@cs.kuleuven.be> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use -ffreestanding to assert the enclave compilation targets a freestanding environment (i.e., without "main" or standard libraries). This fixes clang reporting "undefined reference to `memset'" after erroneously optimizing away the provided memset/memcpy implementations. Signed-off-by: Jo Van Bulck --- tools/testing/selftests/sgx/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/sgx/Makefile b/tools/testing/selftests= /sgx/Makefile index 2de970f7237c..19a07e890009 100644 --- a/tools/testing/selftests/sgx/Makefile +++ b/tools/testing/selftests/sgx/Makefile @@ -14,8 +14,8 @@ endif INCLUDES :=3D -I$(top_srcdir)/tools/include HOST_CFLAGS :=3D -Wall -Werror -g $(INCLUDES) -fPIC HOST_LDFLAGS :=3D -z noexecstack -lcrypto -ENCL_CFLAGS :=3D -Wall -Werror -static-pie -nostdlib -nostartfiles -fPIE \ - -fno-stack-protector -mrdrnd $(INCLUDES) +ENCL_CFLAGS :=3D -Wall -Werror -static-pie -nostdlib -ffreestanding -fPIE \ + -nostartfiles -fno-stack-protector -mrdrnd $(INCLUDES) ENCL_LDFLAGS :=3D -Wl,-T,test_encl.lds,--build-id=3Dnone =20 TEST_CUSTOM_PROGS :=3D $(OUTPUT)/test_sgx --=20 2.34.1