You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #67084 - Pagten:feature/print-msg-from-elf-entrypoint, r=Amanieu
SGX: Change ELF entrypoint
This fixes [rust-sgx issue #148](fortanix/rust-sgx#148).
A new entry point is created for the ELF file generated by `rustc`, separate from the enclave entry point. When the ELF file is executed as a Linux binary, the error message below is written to stderr.
> Error: This file is an SGX enclave which cannot be executed as a standard Linux binary.
> See the installation guide at https://edp.fortanix.com/docs/installation/guide/ on how to use 'cargo run' or follow the steps at https://edp.fortanix.com/docs/tasks/deployment/ for manual deployment.
When the ELF file is converted to an SGXS using `elf2sgxs`, the old entry point is still set as the enclave entry point. In a future pull request in the rust-sgx repository, `elf2sgxs` will be modified to remove the code in the ELF entry point, since this code is not needed in the enclave.
Copy file name to clipboardexpand all lines: src/libstd/sys/sgx/abi/entry.S
+30
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,36 @@ IMAGE_BASE:
104
104
and%gs:tcsls_flags,%\reg
105
105
.endm
106
106
107
+
/* We place the ELF entry point in a separate section so it can be removed by
108
+
elf2sgxs */
109
+
.section .text_no_sgx, "ax"
110
+
.Lelf_entry_error_msg:
111
+
.ascii"Error: This file is an SGX enclave which cannot be executed as a standard Linux binary.\nSee the installation guide at https://edp.fortanix.com/docs/installation/guide/ on how to use 'cargo run' or follow the steps at https://edp.fortanix.com/docs/tasks/deployment/ for manual deployment.\n"
0 commit comments