diff options
| author | Pieter Agten <pieter.agten@fortanix.com> | 2019-12-04 14:20:09 +0100 |
|---|---|---|
| committer | Pieter Agten <pieter.agten@fortanix.com> | 2019-12-04 14:20:09 +0100 |
| commit | 3ee0f48429e6571a87320f2f2e56a48e6717cff1 (patch) | |
| tree | 3da97cbb4e855a0141dce4444a94f5f52fe769e4 /src/libstd | |
| parent | 5f1d6c44034ac143f7a3e56ae7ea8858dcbb61ca (diff) | |
| download | rust-3ee0f48429e6571a87320f2f2e56a48e6717cff1.tar.gz rust-3ee0f48429e6571a87320f2f2e56a48e6717cff1.zip | |
Create a separate entry point for the ELF file, instead of using the SGX entry point
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sys/sgx/abi/entry.S | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libstd/sys/sgx/abi/entry.S b/src/libstd/sys/sgx/abi/entry.S index cd26c7ca200..a11eb18b0f7 100644 --- a/src/libstd/sys/sgx/abi/entry.S +++ b/src/libstd/sys/sgx/abi/entry.S @@ -104,6 +104,26 @@ IMAGE_BASE: and %gs:tcsls_flags,%\reg .endm +/* We place the ELF entry point in a separate section so it can be removed by + elf2sgxs */ +.section .text_no_sgx, "ax" +.Lelf_entry_error_msg: + .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" +.global elf_entry +.type elf_entry,function +elf_entry: +/* print error message */ + movq $1, %rax /* write() syscall */ + movq $2, %rdi /* write to stderr */ + lea .Lelf_entry_error_msg(%rip), %rsi + movq $288, %rdx /* num chars to write */ + syscall + + movq $60, %rax /* exit() syscall */ + movq $0, %rdi /* error code */ + syscall +/* end elf_entry */ + .text .global sgx_entry .type sgx_entry,function |
