linux/tools/testing/selftests/sgx/test_encl.lds
Jo Van Bulck ec44ca1e34 selftests/sgx: Discard unsupported ELF sections
Building the test enclave with -static-pie may produce a dynamic symbol
table, but this is not supported for enclaves and any relocations need to
happen manually (e.g., as for "encl_op_array"). Thus, opportunistically
discard ".dyn*" and ".gnu.hash" which the enclave loader cannot handle.

Signed-off-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/all/20231005153854.25566-13-jo.vanbulck%40cs.kuleuven.be
2023-12-08 10:05:28 -08:00

42 lines
518 B
Plaintext

OUTPUT_FORMAT(elf64-x86-64)
PHDRS
{
tcs PT_LOAD;
text PT_LOAD;
data PT_LOAD;
}
SECTIONS
{
. = 0;
__encl_base = .;
.tcs : {
*(.tcs*)
} : tcs
. = ALIGN(4096);
.text : {
*(.text*)
*(.rodata*)
FILL(0xDEADBEEF);
. = ALIGN(4096);
} : text
.data : {
*(.data.encl_buffer)
*(.data*)
} : data
/DISCARD/ : {
*(.comment*)
*(.note*)
*(.debug*)
*(.eh_frame*)
*(.dyn*)
*(.gnu.hash)
}
}
ASSERT(!DEFINED(_GLOBAL_OFFSET_TABLE_), "Libcalls through GOT are not supported in enclaves")