"unsupported relocation type detected" when signing the enclave instance

"unsupported relocation type detected" when signing the enclave instance

Hello,

 

I am writing some assembly code and compile them into a SGX enclave instance. Currently when I try to define a data pointer in the assembly code data section, I got an error saying "unsupported relocation type detected". Could anyone shed some lights on how should I solve this issue?

This is the sample code I wrote:

.section .data
.align 16

var1:
.long var2     <---- this is the problem.
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x00

var2:
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x00

.section .text
.globl encalve_foo
enclave_foo:
    push %rbp
    mov %rsp,%rbp
    mov %edi,-0x14(%rbp) 
    mov var1(%rip),%edx
    ...

 

Note that I defined data pointer "var2" as the value of "var1". 

Here is the compilation output:

☁  0 [master] ⚡ make SGX_MODE=SIM
GEN  =>  App/Enclave_u.c
cc1: warning: command line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C
CC   <=  App/Enclave_u.c
LINK =>  libapp.so
GEN  =>  Enclave/Enclave_t.c
CC   <=  Enclave/Enclave_t.c
CXX  <=  Enclave/Enclave.s
LINK =>  enclave_0.so
<EnclaveConfiguration>
    <ProdID>0</ProdID>
    <ISVSVN>0</ISVSVN>
    <StackMaxSize>0x40000</StackMaxSize>
    <HeapMaxSize>0x100000</HeapMaxSize>
    <TCSNum>10</TCSNum>
    <TCSPolicy>1</TCSPolicy>
    <DisableDebug>0</DisableDebug>
    <MiscSelect>0</MiscSelect>
    <MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>
[do_validate_reltab elfparser.cpp:320] unsupported relocation type detected
The input enclave file is not correct.
Error happened while signing the enclave.
Makefile:208: recipe for target 'enclave_0.signed.so' failed
make: *** [enclave_0.signed.so] Error 255

 

It seems that the compilation process is fine, but when trying to sign the compiled enclave instance, an error jumps out.

Any suggestion would be strongly appreciated, thank you!

 

 

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

I think you need change problem line to ".quad var2".

For x86_64,  R_X86_64_32 relocation is not supported because enclaves must be PIC

Quote:

Haitao Huang (Intel) wrote:

I think you need change problem line to ".quad var2".

For x86_64,  R_X86_64_32 relocation is not supported because enclaves must be PIC

 

This is what I am looking for. Thank you a lot for this prompt reply!

Leave a Comment

Please sign in to add a comment. Not a member? Join today