This is an automated email from the ASF dual-hosted git repository.
rduan pushed a commit to branch v2.0.0-preview
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git
The following commit(s) were added to refs/heads/v2.0.0-preview by this push:
new a50445b0 Update makefile
a50445b0 is described below
commit a50445b0f63a9a8ea8dd80c52ed6644f5defadf0
Author: volcano <[email protected]>
AuthorDate: Thu Sep 29 10:56:45 2022 +0800
Update makefile
---
buildenv.mk | 6 ----
common/inc/sgx_trts.h | 2 +-
common/inc/sgx_urts.h | 2 +-
common/inc/tlibc/time.h | 2 +-
samplecode/backtrace/Makefile | 12 ++++----
samplecode/cov/Makefile | 16 +++++++----
samplecode/crypto/Makefile | 32 ++++++++++++++-------
samplecode/helloworld/Makefile | 32 ++++++++++++++-------
samplecode/httpreq/Makefile | 28 ++++++++++++------
samplecode/hyper-rustls-https-server/Makefile | 28 ++++++++++++------
.../hyper-rustls-https-server/enclave/Cargo.toml | 2 +-
samplecode/logger/Makefile | 28 ++++++++++++------
samplecode/mutual-ra/Makefile | 28 ++++++++++++------
samplecode/mutual-ra/Readme.md.gpg | Bin 983 -> 0 bytes
samplecode/regex/Makefile | 28 ++++++++++++------
samplecode/rpc/client/Makefile | 28 ++++++++++++------
samplecode/rpc/client/enclave/Cargo.toml | 6 ++--
samplecode/rpc/server/Makefile | 28 ++++++++++++------
samplecode/rpc/server/enclave/Cargo.toml | 6 ++--
samplecode/seal/Makefile | 32 ++++++++++++++-------
samplecode/switchless/Makefile | 32 ++++++++++++++-------
samplecode/template/Makefile | 28 ++++++++++++------
samplecode/zlib-lazy-static-sample/Makefile | 28 ++++++++++++------
sgx_backtrace/sgx_backtrace_sys/build.rs | 2 ++
sgx_crypto/sgx_crypto_sys/tcrypto/Makefile | 4 ++-
sgx_edl/edl/sgx_asyncio.edl | 2 +-
sgx_libc/sgx_tlibc_sys/tlibc/Makefile | 5 ++--
sgx_libc/sgx_tlibc_sys/tsafecrt/Makefile | 6 ++--
sgx_no_tstd/build.rs | 2 +-
sgx_oc/src/linux/edl/asyncio.rs | 2 +-
sgx_oc/src/linux/ocall/asyncio.rs | 2 +-
sgx_unwind/build.rs | 2 +-
sgx_urts/src/ocall/asyncio.rs | 6 ++--
tests/Makefile | 12 ++++++--
34 files changed, 312 insertions(+), 167 deletions(-)
diff --git a/buildenv.mk b/buildenv.mk
index 1bc803ce..a2125f5a 100644
--- a/buildenv.mk
+++ b/buildenv.mk
@@ -67,12 +67,6 @@ else
COMMON_FLAGS += -fstack-protector-strong
endif
-ifdef DEBUG
- COMMON_FLAGS += -O0 -g -DDEBUG -UNDEBUG
-else
- COMMON_FLAGS += -O2 -D_FORTIFY_SOURCE=2 -UDEBUG -DNDEBUG
-endif
-
COMMON_FLAGS += -ffunction-sections -fdata-sections
# turn on compiler warnings as much as possible
diff --git a/common/inc/sgx_trts.h b/common/inc/sgx_trts.h
index 42a18a19..63c11ad8 100644
--- a/common/inc/sgx_trts.h
+++ b/common/inc/sgx_trts.h
@@ -48,7 +48,7 @@ extern "C" {
* 2 - SIM mode
* 3 - HYPER mode
*/
-int SGXAPI sgx_get_enclave_mode();
+int SGXAPI sgx_get_enclave_mode(void);
/* sgx_is_within_enclave()
* Parameters:
diff --git a/common/inc/sgx_urts.h b/common/inc/sgx_urts.h
index 162abdc7..be45b05b 100644
--- a/common/inc/sgx_urts.h
+++ b/common/inc/sgx_urts.h
@@ -121,7 +121,7 @@ sgx_status_t SGXAPI rsgx_get_metadata(const char*
enclave_file, metadata_t *meta
* 2 - SIM mode
* 3 - HYPER mode
*/
-int SGXAPI rsgx_get_enclave_mode();
+int SGXAPI rsgx_get_enclave_mode(void);
#ifdef __cplusplus
}
diff --git a/common/inc/tlibc/time.h b/common/inc/tlibc/time.h
index 28061786..cdb8bde7 100644
--- a/common/inc/tlibc/time.h
+++ b/common/inc/tlibc/time.h
@@ -114,7 +114,7 @@ struct tm * _TLIBC_CDECL_ gmtime_r (const time_t
*__restrict, struct tm *__restr
// ocall
int nanosleep(const struct timespec *, struct timespec *);
int clock_gettime(clockid_t, struct timespec *);
-clock_t clock();
+clock_t clock(void);
time_t time(time_t *);
__END_DECLS
diff --git a/samplecode/backtrace/Makefile b/samplecode/backtrace/Makefile
index a7992ac1..16a10e9f 100644
--- a/samplecode/backtrace/Makefile
+++ b/samplecode/backtrace/Makefile
@@ -40,6 +40,8 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+SGX_COMMON_CFLAGS += -O0 -g
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -65,7 +67,7 @@ Enclave_EDL_Files := enclave/enclave_t.c enclave/enclave_t.h
app/enclave_u.c app
App_Rust_Flags := --release
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
App_Rust_Path := ./app/target/release
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
@@ -82,7 +84,7 @@ Rust_Build_Target := x86_64-unknown-linux-sgx
Rust_Target_Path := $(ROOT_DIR)/rustlib
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := -Zbuild-std=core,alloc
Rust_Std_Features := --features backtrace
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
@@ -94,7 +96,7 @@ RustEnclave_Src_Files := $(shell find enclave/ -type f -name
'*.rs') $(shell fin
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
@@ -139,7 +141,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -167,7 +169,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r $(Rust_Target_Path)/std/target/$(Rust_Build_Target)/debug/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
diff --git a/samplecode/cov/Makefile b/samplecode/cov/Makefile
index 8f17f935..00f05d34 100644
--- a/samplecode/cov/Makefile
+++ b/samplecode/cov/Makefile
@@ -40,6 +40,12 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+else
+ SGX_COMMON_CFLAGS += -O2
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -65,7 +71,7 @@ Enclave_EDL_Files := enclave/enclave_t.c enclave/enclave_t.h
app/enclave_u.c app
App_Rust_Flags := --release
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
App_Rust_Path := ./app/target/release
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
@@ -91,7 +97,7 @@ Rust_Build_Target := x86_64-unknown-linux-sgx
Rust_Target_Path := $(ROOT_DIR)/rustlib
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := -Zbuild-std=core,alloc
Rust_Std_Features := --features profiler
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
@@ -103,7 +109,7 @@ RustEnclave_Src_Files := $(shell find enclave/ -type f
-name '*.rs') $(shell fin
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
@@ -148,7 +154,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -175,7 +181,7 @@ ifeq ($(BUILD_STD), cargo)
@cd $(Rust_Target_Path)/std && RUSTFLAGS="-Cpanic=abort" cargo build
$(Rust_Build_Std) $(Rust_Target_Flags) $(Rust_Std_Features)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r $(Rust_Target_Path)/std/target/$(Rust_Build_Target)/debug/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) $(Rust_Cargo_Flags)
RUSTC_WRAPPER=$(WRAPPER) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags) $(RustEnclave_Rust_Features)
diff --git a/samplecode/crypto/Makefile b/samplecode/crypto/Makefile
index 2acc7664..0a34426c 100644
--- a/samplecode/crypto/Makefile
+++ b/samplecode/crypto/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/app
@@ -82,30 +92,30 @@ Rust_Build_Target := x86_64-unknown-linux-sgx
Rust_Target_Path := $(ROOT_DIR)/rustlib
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features :=
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
Rust_Sysroot_Flags := RUSTFLAGS="--sysroot $(Rust_Sysroot_Path)"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
ifeq ($(BUILD_STD), cargo)
- RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+ RustEnclave_Out_Path :=
./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
else ifeq ($(BUILD_STD), xargo)
- RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+ RustEnclave_Out_Path :=
./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
else
- RustEnclave_Out_Path := ./enclave/target/release
+ RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Out)
endif
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libcrypto.a
@@ -139,7 +149,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -167,7 +177,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
diff --git a/samplecode/helloworld/Makefile b/samplecode/helloworld/Makefile
index 228ffd2c..e502d12c 100644
--- a/samplecode/helloworld/Makefile
+++ b/samplecode/helloworld/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/app
@@ -82,30 +92,30 @@ Rust_Build_Target := x86_64-unknown-linux-sgx
Rust_Target_Path := $(ROOT_DIR)/rustlib
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features :=
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
Rust_Sysroot_Flags := RUSTFLAGS="--sysroot $(Rust_Sysroot_Path)"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
ifeq ($(BUILD_STD), cargo)
- RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+ RustEnclave_Out_Path :=
./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
else ifeq ($(BUILD_STD), xargo)
- RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+ RustEnclave_Out_Path :=
./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
else
- RustEnclave_Out_Path := ./enclave/target/release
+ RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Out)
endif
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libhelloworld.a
@@ -139,7 +149,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -167,7 +177,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
diff --git a/samplecode/httpreq/Makefile b/samplecode/httpreq/Makefile
index 925b4fdd..35691577 100644
--- a/samplecode/httpreq/Makefile
+++ b/samplecode/httpreq/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/app
@@ -88,7 +98,7 @@ endif
endif
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features := --features net,thread,untrusted_time,untrusted_fs
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
@@ -97,18 +107,18 @@ else
Rust_Unstable_Flags := RUSTFLAGS="-Z force-unstable-if-unmarked"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
-RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libhttpreq.a
RustEnclave_Name := $(CUSTOM_BIN_PATH)/enclave.so
RustEnclave_Signed_Name := $(CUSTOM_BIN_PATH)/enclave.signed.so
@@ -140,7 +150,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -168,7 +178,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
else
diff --git a/samplecode/hyper-rustls-https-server/Makefile
b/samplecode/hyper-rustls-https-server/Makefile
index b5e33684..f9796cd8 100644
--- a/samplecode/hyper-rustls-https-server/Makefile
+++ b/samplecode/hyper-rustls-https-server/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/app
@@ -88,7 +98,7 @@ endif
endif
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features := --features
net,thread,untrusted_time,untrusted_fs,unsupported_process
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
@@ -97,18 +107,18 @@ else
Rust_Unstable_Flags := RUSTFLAGS="-Z force-unstable-if-unmarked"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
-RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libhttps.a
RustEnclave_Name := $(CUSTOM_BIN_PATH)/enclave.so
RustEnclave_Signed_Name := $(CUSTOM_BIN_PATH)/enclave.signed.so
@@ -140,7 +150,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -168,7 +178,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
else
diff --git a/samplecode/hyper-rustls-https-server/enclave/Cargo.toml
b/samplecode/hyper-rustls-https-server/enclave/Cargo.toml
index 065a3232..e91f105b 100644
--- a/samplecode/hyper-rustls-https-server/enclave/Cargo.toml
+++ b/samplecode/hyper-rustls-https-server/enclave/Cargo.toml
@@ -32,7 +32,7 @@ default = []
futures-util = { version = "0.3.1", default-features = false }
hyper = { version = "0.14", features = ["server", "http2", "runtime"] }
rustls = { version = "0.20.1", default-features = false, features = ["tls12"] }
-rustls-pemfile = "0.2.1"
+rustls-pemfile = "1.0"
tokio = { version = "1.0", features = ["macros", "net", "rt-multi-thread"] }
tokio-rustls = { version = "0.23", default-features = false }
sgx_libc = { path = "../../../sgx_libc" }
diff --git a/samplecode/logger/Makefile b/samplecode/logger/Makefile
index 013a44c4..125ca8cf 100644
--- a/samplecode/logger/Makefile
+++ b/samplecode/logger/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/app
@@ -88,7 +98,7 @@ endif
endif
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features := --features env,untrusted_time
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
@@ -97,18 +107,18 @@ else
Rust_Unstable_Flags := RUSTFLAGS="-Z force-unstable-if-unmarked"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
-RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/liblogger.a
RustEnclave_Name := $(CUSTOM_BIN_PATH)/enclave.so
RustEnclave_Signed_Name := $(CUSTOM_BIN_PATH)/enclave.signed.so
@@ -140,7 +150,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -168,7 +178,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
else
diff --git a/samplecode/mutual-ra/Makefile b/samplecode/mutual-ra/Makefile
index a9ca7bfe..aaa59c05 100644
--- a/samplecode/mutual-ra/Makefile
+++ b/samplecode/mutual-ra/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/app
@@ -88,7 +98,7 @@ endif
endif
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features := --features
net,thread,untrusted_time,untrusted_fs,backtrace
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
@@ -97,18 +107,18 @@ else
Rust_Unstable_Flags := RUSTFLAGS="-Z force-unstable-if-unmarked"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
-RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libmutualra.a
RustEnclave_Name := $(CUSTOM_BIN_PATH)/enclave.so
RustEnclave_Signed_Name := $(CUSTOM_BIN_PATH)/enclave.signed.so
@@ -140,7 +150,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -168,7 +178,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
else
diff --git a/samplecode/mutual-ra/Readme.md.gpg
b/samplecode/mutual-ra/Readme.md.gpg
deleted file mode 100644
index d4f440e4..00000000
Binary files a/samplecode/mutual-ra/Readme.md.gpg and /dev/null differ
diff --git a/samplecode/regex/Makefile b/samplecode/regex/Makefile
index 20c767ee..0e0ed263 100644
--- a/samplecode/regex/Makefile
+++ b/samplecode/regex/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/app
@@ -88,7 +98,7 @@ endif
endif
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features :=
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
@@ -97,18 +107,18 @@ else
Rust_Unstable_Flags := RUSTFLAGS="-Z force-unstable-if-unmarked"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
-RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libregex.a
RustEnclave_Name := $(CUSTOM_BIN_PATH)/enclave.so
RustEnclave_Signed_Name := $(CUSTOM_BIN_PATH)/enclave.signed.so
@@ -140,7 +150,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -168,7 +178,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
else
diff --git a/samplecode/rpc/client/Makefile b/samplecode/rpc/client/Makefile
index 58eedfdb..446d07dd 100644
--- a/samplecode/rpc/client/Makefile
+++ b/samplecode/rpc/client/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/client
@@ -88,7 +98,7 @@ endif
endif
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features := --features
net,thread,untrusted_time,untrusted_fs,unsupported_process
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
@@ -97,18 +107,18 @@ else
Rust_Unstable_Flags := RUSTFLAGS="-Z force-unstable-if-unmarked"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
-RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libclient.a
RustEnclave_Name := $(CUSTOM_BIN_PATH)/enclave.so
RustEnclave_Signed_Name := $(CUSTOM_BIN_PATH)/enclave.signed.so
@@ -140,7 +150,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -168,7 +178,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
else
diff --git a/samplecode/rpc/client/enclave/Cargo.toml
b/samplecode/rpc/client/enclave/Cargo.toml
index 527fbf18..2f46ce20 100644
--- a/samplecode/rpc/client/enclave/Cargo.toml
+++ b/samplecode/rpc/client/enclave/Cargo.toml
@@ -29,10 +29,10 @@ crate-type = ["staticlib"]
default = []
[dependencies]
-prost = "0.9"
+prost = "0.11.0"
tokio = { version = "1.0", features = ["rt-multi-thread", "time", "fs",
"macros", "net"] }
-tonic = { version = "0.6.2", features = ["tls", "compression"] }
+tonic = { version = "0.8.1", features = ["tls", "gzip"] }
sgx_libc = { path = "../../../../sgx_libc" }
[build-dependencies]
-tonic-build = { version = "0.6.2", features = ["prost", "compression"] }
+tonic-build = { version = "0.8.0", features = ["prost"] }
diff --git a/samplecode/rpc/server/Makefile b/samplecode/rpc/server/Makefile
index 68df4fdf..578ce6f4 100644
--- a/samplecode/rpc/server/Makefile
+++ b/samplecode/rpc/server/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/server
@@ -88,7 +98,7 @@ endif
endif
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Z build-std=core,alloc
Rust_Std_Features := --features
net,thread,untrusted_time,untrusted_fs,unsupported_process
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
@@ -97,18 +107,18 @@ else
Rust_Unstable_Flags := RUSTFLAGS="-Z force-unstable-if-unmarked"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
-RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libserver.a
RustEnclave_Name := $(CUSTOM_BIN_PATH)/enclave.so
RustEnclave_Signed_Name := $(CUSTOM_BIN_PATH)/enclave.signed.so
@@ -140,7 +150,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -168,7 +178,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
else
diff --git a/samplecode/rpc/server/enclave/Cargo.toml
b/samplecode/rpc/server/enclave/Cargo.toml
index 6634e375..a953605e 100644
--- a/samplecode/rpc/server/enclave/Cargo.toml
+++ b/samplecode/rpc/server/enclave/Cargo.toml
@@ -29,10 +29,10 @@ crate-type = ["staticlib"]
default = []
[dependencies]
-prost = "0.9"
+prost = "0.11.0"
tokio = { version = "1.0", features = ["rt-multi-thread", "time", "fs",
"macros", "net"] }
-tonic = { version = "0.6.2", features = ["tls", "compression"] }
+tonic = { version = "0.8.1", features = ["tls", "gzip"] }
sgx_libc = { path = "../../../../sgx_libc" }
[build-dependencies]
-tonic-build = { version = "0.6.2", features = ["prost", "compression"] }
+tonic-build = { version = "0.8.0", features = ["prost"] }
diff --git a/samplecode/seal/Makefile b/samplecode/seal/Makefile
index 91d34a23..1d820de1 100644
--- a/samplecode/seal/Makefile
+++ b/samplecode/seal/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/app
@@ -82,30 +92,30 @@ Rust_Build_Target := x86_64-unknown-linux-sgx
Rust_Target_Path := $(ROOT_DIR)/rustlib
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features :=
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
Rust_Sysroot_Flags := RUSTFLAGS="--sysroot $(Rust_Sysroot_Path)"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
ifeq ($(BUILD_STD), cargo)
- RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+ RustEnclave_Out_Path :=
./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
else ifeq ($(BUILD_STD), xargo)
- RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+ RustEnclave_Out_Path :=
./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
else
- RustEnclave_Out_Path := ./enclave/target/release
+ RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Out)
endif
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libseal.a
@@ -139,7 +149,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -167,7 +177,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
diff --git a/samplecode/switchless/Makefile b/samplecode/switchless/Makefile
index 03dcde6a..076f9e04 100644
--- a/samplecode/switchless/Makefile
+++ b/samplecode/switchless/Makefile
@@ -44,6 +44,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -66,12 +76,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/app
@@ -86,19 +96,19 @@ Rust_Build_Target := x86_64-unknown-linux-sgx
Rust_Target_Path := $(ROOT_DIR)/rustlib
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features :=
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
Rust_Sysroot_Flags := RUSTFLAGS="--sysroot $(Rust_Sysroot_Path)"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(SGX_LIBRARY_PATH) -L$(CUSTOM_LIBRARY_PATH)
-lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--whole-archive -lsgx_tswitchless -Wl,--no-whole-archive \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
@@ -106,11 +116,11 @@ RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib
-nodefaultlibs -nostartfi
$(ENCLAVE_LDFLAGS)
ifeq ($(BUILD_STD), cargo)
- RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+ RustEnclave_Out_Path :=
./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
else ifeq ($(BUILD_STD), xargo)
- RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+ RustEnclave_Out_Path :=
./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
else
- RustEnclave_Out_Path := ./enclave/target/release
+ RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Out)
endif
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libswitchless.a
@@ -144,7 +154,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -172,7 +182,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
diff --git a/samplecode/template/Makefile b/samplecode/template/Makefile
index 2f1e0ae8..27e050bc 100644
--- a/samplecode/template/Makefile
+++ b/samplecode/template/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/app
@@ -88,7 +98,7 @@ endif
endif
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features := --features ""
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
@@ -97,18 +107,18 @@ else
Rust_Unstable_Flags := RUSTFLAGS="-Z force-unstable-if-unmarked"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
-RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libsample.a
RustEnclave_Name := $(CUSTOM_BIN_PATH)/enclave.so
RustEnclave_Signed_Name := $(CUSTOM_BIN_PATH)/enclave.signed.so
@@ -140,7 +150,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -168,7 +178,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
else
diff --git a/samplecode/zlib-lazy-static-sample/Makefile
b/samplecode/zlib-lazy-static-sample/Makefile
index a5f1d8a4..e1cf9438 100644
--- a/samplecode/zlib-lazy-static-sample/Makefile
+++ b/samplecode/zlib-lazy-static-sample/Makefile
@@ -40,6 +40,16 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+ Rust_Build_Flags :=
+ Rust_Build_Out := debug
+else
+ SGX_COMMON_CFLAGS += -O2
+ Rust_Build_Flags := --release
+ Rust_Build_Out := release
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -62,12 +72,12 @@ Enclave_EDL_Files := enclave/enclave_t.c
enclave/enclave_t.h app/enclave_u.c app
######## APP Settings ########
-App_Rust_Flags := --release
+App_Rust_Flags := $(Rust_Build_Flags)
App_Src_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
-App_Rust_Path := ./app/target/release
+App_Rust_Path := ./app/target/$(Rust_Build_Out)
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
App_Name := $(CUSTOM_BIN_PATH)/app
@@ -88,7 +98,7 @@ endif
endif
ifeq ($(BUILD_STD), cargo)
- Rust_Build_Std := --release -Z build-std=core,alloc
+ Rust_Build_Std := $(Rust_Build_Flags) -Zbuild-std=core,alloc
Rust_Std_Features := --features untrusted_time
Rust_Target_Flags := --target
$(Rust_Target_Path)/$(Rust_Build_Target).json
Rust_Sysroot_Path := $(CURDIR)/sysroot
@@ -97,18 +107,18 @@ else
Rust_Unstable_Flags := RUSTFLAGS="-Z force-unstable-if-unmarked"
endif
-RustEnclave_Build_Flags := --release
+RustEnclave_Build_Flags := $(Rust_Build_Flags)
RustEnclave_Src_Files := $(shell find enclave/ -type f -name '*.rs') $(shell
find enclave/ -type f -name 'Cargo.toml')
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--start-group $(RustEnclave_Link_Libs) -Wl,--end-group \
-Wl,--version-script=enclave/enclave.lds \
$(ENCLAVE_LDFLAGS)
-RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/release
+RustEnclave_Out_Path := ./enclave/target/$(Rust_Build_Target)/$(Rust_Build_Out)
RustEnclave_Lib_Name := $(RustEnclave_Out_Path)/libzlib.a
RustEnclave_Name := $(CUSTOM_BIN_PATH)/enclave.so
RustEnclave_Signed_Name := $(CUSTOM_BIN_PATH)/enclave.signed.so
@@ -140,7 +150,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
@@ -168,7 +178,7 @@ ifeq ($(BUILD_STD), cargo)
@rm -rf $(Rust_Sysroot_Path)
@mkdir -p $(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
- @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/release/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
+ @cp -r
$(Rust_Target_Path)/std/target/$(Rust_Build_Target)/$(Rust_Build_Out)/deps/*
$(Rust_Sysroot_Path)/lib/rustlib/$(Rust_Build_Target)/lib
@cd enclave && $(Rust_Sysroot_Flags) cargo build $(Rust_Target_Flags)
$(RustEnclave_Build_Flags)
else
diff --git a/sgx_backtrace/sgx_backtrace_sys/build.rs
b/sgx_backtrace/sgx_backtrace_sys/build.rs
index 090d98c6..3097d75e 100644
--- a/sgx_backtrace/sgx_backtrace_sys/build.rs
+++ b/sgx_backtrace/sgx_backtrace_sys/build.rs
@@ -55,6 +55,8 @@ fn build_libbacktrace(_target: &str, is_use_read: bool) ->
Result<(), ()> {
.flag("-fno-strict-overflow")
.flag("-fno-delete-null-pointer-checks")
.flag("-fvisibility=hidden")
+ .flag("-ffunction-sections")
+ .flag("-fdata-sections")
.include("./libbacktrace")
.include("../../common/inc")
.include(&native.out_dir)
diff --git a/sgx_crypto/sgx_crypto_sys/tcrypto/Makefile
b/sgx_crypto/sgx_crypto_sys/tcrypto/Makefile
index ae50a38b..35e3f30b 100644
--- a/sgx_crypto/sgx_crypto_sys/tcrypto/Makefile
+++ b/sgx_crypto/sgx_crypto_sys/tcrypto/Makefile
@@ -48,6 +48,7 @@ LD_IPP := -lippcp
BUILD_ARG ?= tcrypto
OUT_DIR ?= ./out
+SGX_COMMON_FLAGS := -O2 -D_FORTIFY_SOURCE=2 -UDEBUG -DNDEBUG
CPPFLAGS := -I$(COMMON_DIR)/inc/internal \
-I$(COMMON_DIR)/inc \
-I$(IPP_INC) \
@@ -62,6 +63,7 @@ else
endif
CXXFLAGS += -fno-exceptions -fno-rtti #-Werror
+CXXFLAGS += $(SGX_COMMON_FLAGS)
OBJ = init_tcrypto_lib.o sgx_aes_ctr.o sgx_rsa_encryption.o sgx_aes_gcm.o
sgx_cmac128.o sgx_hmac_sha256.o \
sgx_ecc256.o sgx_ecc256_ecdsa.o sgx_sha384.o sgx_sha384_msg.o
sgx_sha256.o sgx_sha1.o sgx_sha256_msg.o \
@@ -71,7 +73,7 @@ OBJ = init_tcrypto_lib.o sgx_aes_ctr.o sgx_rsa_encryption.o
sgx_aes_gcm.o sgx_cm
SHARED_OBJ = sgx_common_init_ipp.o
# Build IPP crypto based sgx_tcrypto library
-CFLAGS += $(CPPFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS) -Werror
-fno-exceptions -fPIC
+CFLAGS += $(CPPFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_FLAGS) -Werror
-fno-exceptions -fPIC
OBJ += sgx_tcrypto_common.o sgx_rsa_internal.o
SRCDIR := ipp
diff --git a/sgx_edl/edl/sgx_asyncio.edl b/sgx_edl/edl/sgx_asyncio.edl
index 27c3e6f4..6547adda 100644
--- a/sgx_edl/edl/sgx_asyncio.edl
+++ b/sgx_edl/edl/sgx_asyncio.edl
@@ -23,6 +23,6 @@ enclave {
int u_poll_ocall([out] int *error, [in, out, count=nfds] struct pollfd
*fds, nfds_t nfds, int timeout);
int u_epoll_create1_ocall([out] int *error, int flags);
int u_epoll_ctl_ocall([out] int *error, int epfd, int op, int fd, [in]
struct epoll_event *event);
- int u_epoll_wait_ocall([out] int *error, int epfd, [out,
count=maxevents] struct epoll_event *events, int maxevents, int timeout);
+ int u_epoll_wait_ocall([out] int *error, int epfd, [out,
count=maxevents] struct epoll_event *events, uint32_t maxevents, int timeout);
};
};
diff --git a/sgx_libc/sgx_tlibc_sys/tlibc/Makefile
b/sgx_libc/sgx_tlibc_sys/tlibc/Makefile
index bfbd0350..dc2855e3 100644
--- a/sgx_libc/sgx_tlibc_sys/tlibc/Makefile
+++ b/sgx_libc/sgx_tlibc_sys/tlibc/Makefile
@@ -34,10 +34,11 @@ include ../../../buildenv.mk
USE_OPTLIBS ?= $(USE_OPT_LIBS)
OUT_DIR ?= ./out
-CFLAGS += $(ENCLAVE_CFLAGS) -D_TLIBC_GNU_
+SGX_COMMON_FLAGS := -O2 -D_FORTIFY_SOURCE=2 -UDEBUG -DNDEBUG
+CFLAGS += $(SGX_COMMON_FLAGS) $(ENCLAVE_CFLAGS) -D_TLIBC_GNU_
ASFLAGS := $(CFLAGS)
CFLAGS += -std=c99
-CXXFLAGS += $(ENCLAVE_CXXFLAGS) -fno-exceptions -fno-rtti
+CXXFLAGS += $(SGX_COMMON_FLAGS) $(ENCLAVE_CXXFLAGS) -fno-exceptions -fno-rtti
CPPFLAGS += -I. \
-I$(COMMON_DIR)/inc \
diff --git a/sgx_libc/sgx_tlibc_sys/tsafecrt/Makefile
b/sgx_libc/sgx_tlibc_sys/tsafecrt/Makefile
index d10cea72..d2eecece 100644
--- a/sgx_libc/sgx_tlibc_sys/tsafecrt/Makefile
+++ b/sgx_libc/sgx_tlibc_sys/tsafecrt/Makefile
@@ -32,9 +32,11 @@
include ../../../buildenv.mk
OUT_DIR ?= ./out
-CFLAGS += $(ENCLAVE_CFLAGS) -D _LIBSAFECRT_SGX_CONFIG
+
+SGX_COMMON_FLAGS := -O2 -D_FORTIFY_SOURCE=2 -UDEBUG -DNDEBUG
+CFLAGS += $(SGX_COMMON_FLAGS) $(ENCLAVE_CFLAGS) -D _LIBSAFECRT_SGX_CONFIG
CFLAGS += -std=c99
-CXXFLAGS += $(ENCLAVE_CXXFLAGS)
+CXXFLAGS += $(SGX_COMMON_FLAGS) $(ENCLAVE_CXXFLAGS)
CPPFLAGS += -I. \
-I$(COMMON_DIR)/inc \
diff --git a/sgx_no_tstd/build.rs b/sgx_no_tstd/build.rs
index a4a25738..3ced9e75 100644
--- a/sgx_no_tstd/build.rs
+++ b/sgx_no_tstd/build.rs
@@ -51,7 +51,7 @@ fn build_libunwind(host: &str, target: &str) -> Result<(),
()> {
)
.map(|native| {
let mut cflags =
- " -fstack-protector -ffreestanding -nostdinc -fvisibility=hidden
-fpie -fno-strict-overflow -fno-delete-null-pointer-checks"
+ " -fstack-protector -ffreestanding -nostdinc -fvisibility=hidden
-fpie -fno-strict-overflow -fno-delete-null-pointer-checks -ffunction-sections
-fdata-sections"
.to_string();
cflags += " -O2";
diff --git a/sgx_oc/src/linux/edl/asyncio.rs b/sgx_oc/src/linux/edl/asyncio.rs
index 9e21b30b..3329133d 100644
--- a/sgx_oc/src/linux/edl/asyncio.rs
+++ b/sgx_oc/src/linux/edl/asyncio.rs
@@ -44,7 +44,7 @@ extern "C" {
error: *mut c_int,
epfd: c_int,
events: *mut epoll_event,
- maxevents: c_int,
+ maxevents: c_uint,
timeout: c_int,
) -> sgx_status_t;
}
diff --git a/sgx_oc/src/linux/ocall/asyncio.rs
b/sgx_oc/src/linux/ocall/asyncio.rs
index 2e3be126..6b70aaa8 100644
--- a/sgx_oc/src/linux/ocall/asyncio.rs
+++ b/sgx_oc/src/linux/ocall/asyncio.rs
@@ -103,7 +103,7 @@ pub unsafe fn epoll_wait(
&mut error as *mut c_int,
epfd,
events.as_mut_ptr(),
- maxevents as c_int,
+ maxevents as c_uint,
timeout,
);
diff --git a/sgx_unwind/build.rs b/sgx_unwind/build.rs
index 0454ecaf..ab07c06e 100644
--- a/sgx_unwind/build.rs
+++ b/sgx_unwind/build.rs
@@ -51,7 +51,7 @@ fn build_libunwind(host: &str, target: &str) -> Result<(),
()> {
)
.map(|native| {
let mut cflags =
- " -fstack-protector -ffreestanding -nostdinc -fvisibility=hidden -fpie
-fno-strict-overflow -fno-delete-null-pointer-checks"
+ " -fstack-protector -ffreestanding -nostdinc -fvisibility=hidden -fpie
-fno-strict-overflow -fno-delete-null-pointer-checks -ffunction-sections
-fdata-sections"
.to_string();
cflags += " -O2";
diff --git a/sgx_urts/src/ocall/asyncio.rs b/sgx_urts/src/ocall/asyncio.rs
index 95b96626..979c5011 100644
--- a/sgx_urts/src/ocall/asyncio.rs
+++ b/sgx_urts/src/ocall/asyncio.rs
@@ -16,7 +16,7 @@
// under the License..
use crate::ocall::util::*;
-use libc::{self, c_int, epoll_event, nfds_t, pollfd};
+use libc::{self, c_int, c_uint, epoll_event, nfds_t, pollfd};
use std::io::Error;
#[no_mangle]
@@ -68,11 +68,11 @@ pub unsafe extern "C" fn u_epoll_wait_ocall(
error: *mut c_int,
epfd: c_int,
events: *mut epoll_event,
- maxevents: c_int,
+ maxevents: c_uint,
timeout: c_int,
) -> c_int {
let mut errno = 0;
- let ret = libc::epoll_wait(epfd, events, maxevents, timeout);
+ let ret = libc::epoll_wait(epfd, events, maxevents as c_int, timeout);
if ret < 0 {
errno = Error::last_os_error().raw_os_error().unwrap_or(0);
}
diff --git a/tests/Makefile b/tests/Makefile
index 05fad498..f0c7d5e9 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -40,6 +40,12 @@ else
SGX_BIN_PATH := $(SGX_SDK)/bin/x64
endif
+ifeq ($(SGX_DEBUG), 1)
+ SGX_COMMON_CFLAGS += -O0 -g
+else
+ SGX_COMMON_CFLAGS += -O2
+endif
+
SGX_EDGER8R := $(SGX_BIN_PATH)/sgx_edger8r
ifneq ($(SGX_MODE), HYPER)
SGX_ENCLAVE_SIGNER := $(SGX_BIN_PATH)/sgx_sign
@@ -64,7 +70,7 @@ Enclave_EDL_Files := enclave/enclave_t.c enclave/enclave_t.h
app/enclave_u.c app
App_Rust_Flags := --release
App_SRC_Files := $(shell find app/ -type f -name '*.rs') $(shell find app/
-type f -name 'Cargo.toml')
App_Include_Paths := -I ./app -I$(SGX_SDK)/include -I$(CUSTOM_EDL_PATH)
-App_C_Flags := $(CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
+App_C_Flags := $(CFLAGS) $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes
$(App_Include_Paths)
App_Rust_Path := ./app/target/release
App_Enclave_u_Object := $(CUSTOM_LIBRARY_PATH)/libenclave_u.a
@@ -77,7 +83,7 @@ RustEnclave_SRC_Files := $(shell find enclave/ -type f -name
'*.rs') $(shell fin
RustEnclave_Include_Paths := -I$(CUSTOM_COMMON_PATH)/inc
-I$(CUSTOM_COMMON_PATH)/inc/tlibc -I$(CUSTOM_EDL_PATH)
RustEnclave_Link_Libs := -L$(CUSTOM_LIBRARY_PATH) -lenclave
-RustEnclave_Compile_Flags := $(ENCLAVE_CFLAGS) $(RustEnclave_Include_Paths)
+RustEnclave_C_Flags := $(CFLAGS) $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS)
$(RustEnclave_Include_Paths)
RustEnclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs
-nostartfiles \
-Wl,--whole-archive $(RustEnclave_Link_Libs) -Wl,--no-whole-archive \
-Wl,--version-script=enclave/enclave.lds \
@@ -115,7 +121,7 @@ $(App_Name): $(App_Enclave_u_Object) app
######## Enclave Objects ########
enclave/enclave_t.o: $(Enclave_EDL_Files)
- @$(CC) $(RustEnclave_Compile_Flags) -c enclave/enclave_t.c -o $@
+ @$(CC) $(RustEnclave_C_Flags) -c enclave/enclave_t.c -o $@
$(RustEnclave_Name): enclave/enclave_t.o enclave
@mkdir -p $(CUSTOM_LIBRARY_PATH)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]