Summary
Five steps to add source files to the enclave in "sgx-ra-sample"
Description
- In sgx-ra-sample, added ecall, public A(), to Enclave.cpp.
- Function A() is dependent on function B().
- Function B() is implemented in another source file, B.c.
- In sgx-ra-sample/Enclave/Makefile.am, added B.c in Enclave_SOURCES list.
- When compiling, received error: undefined reference to B.
Resolution
- Add an entry for the ecall to public A() in the trusted section of the Enclave Definition Language (EDL) file.
- Create a header file, B.h, that contains the declaration to function B().
- Add #include <B.h> to Enclave.cpp.
- Edit sgx-ra-sample/Enclave/Makefile:
- am_Enclave_OBJECTS = B.$(OBJEXT) Enclave_t.$(OBJEXT)...
- Enclave_SOURCES = Enclave_t.c Enclave_t.h B.c Enclave.cpp\
- Execute: make clean && make