[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231005153854.25566-6-jo.vanbulck@cs.kuleuven.be>
Date: Thu, 5 Oct 2023 17:38:46 +0200
From: Jo Van Bulck <jo.vanbulck@...kuleuven.be>
To: jarkko@...nel.org, kai.huang@...el.com, linux-sgx@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: dave.hansen@...ux.intel.com,
Jo Van Bulck <jo.vanbulck@...kuleuven.be>
Subject: [PATCH v7 05/13] selftests/sgx: Specify freestanding environment for enclave compilation
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.
Still need to instruct the linker from using standard system startup
functions, but drop -nostartfiles as it is implied by -nostdlib.
Signed-off-by: Jo Van Bulck <jo.vanbulck@...kuleuven.be>
Reviewed-by: Jarkko Sakkinen <jarkko@...nel.org>
Acked-by: Kai Huang <kai.huang@...el.com>
---
tools/testing/selftests/sgx/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/sgx/Makefile b/tools/testing/selftests/sgx/Makefile
index dcdd04b322f8..7eb890bdd3f0 100644
--- a/tools/testing/selftests/sgx/Makefile
+++ b/tools/testing/selftests/sgx/Makefile
@@ -14,7 +14,7 @@ endif
INCLUDES := -I$(top_srcdir)/tools/include
HOST_CFLAGS := -Wall -Werror -g $(INCLUDES) -fPIC
HOST_LDFLAGS := -z noexecstack -lcrypto
-ENCL_CFLAGS += -Wall -Werror -static -nostdlib -nostartfiles -fPIC \
+ENCL_CFLAGS += -Wall -Werror -static -nostdlib -ffreestanding -fPIC \
-fno-stack-protector -mrdrnd $(INCLUDES)
ENCL_LDFLAGS := -Wl,-T,test_encl.lds,--build-id=none
--
2.25.1
Powered by blists - more mailing lists