根据 Linux* 版英特尔® Software Guard Extensions (英特尔® SGX) 开发人员参考指南的“ 隔区内存测量工具 ”部分,导出安全区版本脚本中g_peak_heap_used和g_peak_rsrv_mem_committed符号,并按如下所述将安全区映像与版本脚本链接。
请参阅 英特尔 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
最新的 英特尔® Software Guard Extensions Linux* 版开发人员参考指南位于 英特尔® Software Guard Extensions SDK for Linux* 最新版本的文档部分。