Re: [PATCH v4 02/13] selftests/sgx: Produce static-pie executable for test enclave

From: Jo Van Bulck
Date: Thu Aug 31 2023 - 04:49:29 EST


On 29.08.23 12:55, Huang, Kai wrote:> Could you please add the linker error (as you mentioned in the v3) to the
changelog to justify this code change?

Makes sense, done.

And sigh.. I still don't quite understand why linker complains

lea (encl_stack)(%rbx), %rax

because ....

jmp encl_entry_core
encl_dyn_entry:
# Entry point for dynamically created TCS page expected to follow

we have a

lea -1(%rbx), %rax

right here.

Can't the compiler/linker just treat it as an immediate just like -1? :-(

I think the linker complains because with -static-pie -fPIE afaik all local symbols need to have RIP-relative addressing "encl_stack(%rip)".

Best,
Jo