[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CUYZSZWSDUHC.2QB1Z9GD76HF6@suppilovahvero>
Date: Tue, 22 Aug 2023 13:14:09 +0300
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "Jo Van Bulck" <jo.vanbulck@...kuleuven.be>, <kai.huang@...el.com>,
<linux-sgx@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Cc: <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH v3 9/9] selftests/sgx: Specify freestanding environment
for enclave compilation
On Sat Aug 19, 2023 at 12:43 PM EEST, Jo Van Bulck wrote:
> 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 <jo.vanbulck@...kuleuven.be>
> ---
> 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 2de970f72..19a07e890 100644
> --- a/tools/testing/selftests/sgx/Makefile
> +++ b/tools/testing/selftests/sgx/Makefile
> @@ -14,8 +14,8 @@ endif
> INCLUDES := -I$(top_srcdir)/tools/include
> HOST_CFLAGS := -Wall -Werror -g $(INCLUDES) -fPIC
> HOST_LDFLAGS := -z noexecstack -lcrypto
> -ENCL_CFLAGS := -Wall -Werror -static-pie -nostdlib -nostartfiles -fPIE \
> - -fno-stack-protector -mrdrnd $(INCLUDES)
> +ENCL_CFLAGS := -Wall -Werror -static-pie -nostdlib -ffreestanding -fPIE \
> + -nostartfiles -fno-stack-protector -mrdrnd $(INCLUDES)
> ENCL_LDFLAGS := -Wl,-T,test_encl.lds,--build-id=none
>
> TEST_CUSTOM_PROGS := $(OUTPUT)/test_sgx
> --
> 2.25.1
Do you still need nostdfiles and nostartfiles with freestanding?
BR, Jarkko
Powered by blists - more mailing lists