根據 Linux* 版Intel® Software Guard Extensions (Intel® SGX) 開發者參考指南的 Enclave Memory Measurement Tool 部分,導出指定地址空間版本腳本中的符號 g_peak_heap_used 和 g_peak_rsrv_mem_committed,並將指定地址空間映射與版本腳本連結,如下所述。
請參考 Intel SGX SDK 中的 SampleEnclave,以重用其 Makefile 和版本腳本 SampleEnclave/Enclave/Enclave.lds。
enclave.so
{
global:
g_global_data_sim;
g_global_data;
enclave_entry;
g_peak_heap_used;
g_peak_rsrv_mem_committed;
local:
*;
};
$ ld -o enclave.so file1.o file2.o \
-pie -eenclave_entry -nostdlib -nodefaultlibs –nostartfiles --no-undefined \
--whole-archive –lsgx_trts --no-whole-archive \
--start-group –lsgx_tstdc ––lsgx_tservice -lsgx_crypto -
-end-group \
-Bstatic -Bsymbolic --defsym=__ImageBase=0 --exportdynamic \
--version-script=enclave.lds
適用於Linux* 的最新Intel® Software Guard Extensions開發人員參考指南位於適用於Linux* Intel® Software Guard Extensions SDK 最新版本的“文檔”部分。