Re: [PATCH 2/5] selftests/sgx: Fix function pointer relocation in test enclave.

From: Jo Van Bulck
Date: Mon Aug 21 2023 - 09:24:23 EST


On 21.08.23 13:04, Huang, Kai wrote:
Thanks. You mentioned this was generated by "-static -fPIC -Os" but I think
using "-static-pie -fPIE -Os" would probably generate the same.

Thanks, yes, I can confirm that the same code is generated with -static-pie -FPIE.

Right. Even for "-static-pie" it's still possible to generate "rela.dyn" for
those have to use absolute addressing.

Indeed.

Thus, my earlier comment says that we can safely ignore these
apparent/false TCS "relocations".

Yeah. I guess that's why the test_encl.elf must be built starting from address
0.

True (for the ELF in the linker script, but we still need the runtime relocations for the function-pointer table when loading the enclave at a non-zero base address).

Yeah I guess we should just use "-fPIE".

Agreed.

Best,
Jo