summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/sgx
diff options
context:
space:
mode:
authorJo Van Bulck <jo.vanbulck@cs.kuleuven.be>2023-10-05 17:38:46 +0200
committerDave Hansen <dave.hansen@linux.intel.com>2023-12-08 10:05:27 -0800
commit304b259e63b94c4f825e0648b33b15f8962955c7 (patch)
tree8c6a465fa237e610cb0bc2a542b60507a29ae30a /tools/testing/selftests/sgx
parentf79464658d858e07af0c4c9b30f5baedeeae0c04 (diff)
downloadlinux-stable-304b259e63b94c4f825e0648b33b15f8962955c7.tar.gz
linux-stable-304b259e63b94c4f825e0648b33b15f8962955c7.tar.bz2
linux-stable-304b259e63b94c4f825e0648b33b15f8962955c7.zip
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@cs.kuleuven.be> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Acked-by: Kai Huang <kai.huang@intel.com> Link: https://lore.kernel.org/all/20231005153854.25566-6-jo.vanbulck%40cs.kuleuven.be
Diffstat (limited to 'tools/testing/selftests/sgx')
-rw-r--r--tools/testing/selftests/sgx/Makefile2
1 files changed, 1 insertions, 1 deletions
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