Re: [PATCH v21 24/28] selftests/x86: Add a selftest for SGX
From: Jarkko Sakkinen
Date: Fri Aug 16 2019 - 11:43:59 EST
On Wed, Jul 17, 2019 at 03:37:03PM -0700, Xing, Cedric wrote:
> > +$(OUTPUT)/encl.bin: $(OUTPUT)/encl.elf $(OUTPUT)/sgxsign
> > + objcopy --remove-section=.got.plt -O binary $< $@
> .got.plt section will never be present for statically linked binaries.
You are right that it should not be there because the enclave does not
use any library calls. And if it did, we would want to assert that and
fail the compilation if it is the case.
Assuming that .got.plt can never exist in a static binary, however, is
simply not true. A common example are library calls such as strncpy().
The default handler selects the fastest implementation and substitutes
that to the GOT.
The right way to fix this is to assert it in the linker script.