How to build a DLL which can run in an Enclave?

Hi experts,

I’m developing a program using Enclave on Windows x64 platform. There is a DLL which runs in an Enclave.

At first, I used MSVC to build the DLL. MSVC has a link flag “/enclave” to make the DLL work in Enclave. The DLL runs well in the Enclave.

But when I tried to use Clang to build the DLL, problems occurred. Clang doesn’t support “/enclave” link flag. Then when loading the DLL built by Clang, LoadEnclaveImageW() returns false. I need to find a way to build a DLL supporting Enclave.

Is there a method to use Clang / LLVM to build a DLL supporting Enclave?

I think that Clang should have supported Enclave because I see OpenEnclave supports Clang. But I can’t find the detailed build configuration from it.