[tip: x86/sgx] selftests/sgx: Discard unsupported ELF sections

From: tip-bot2 for Jo Van Bulck
Date: Fri Dec 08 2023 - 13:13:03 EST


The following commit has been merged into the x86/sgx branch of tip:

Commit-ID: ec44ca1e34bc3a9864a8c1bf8636066ec6d5d2e5
Gitweb: https://git.kernel.org/tip/ec44ca1e34bc3a9864a8c1bf8636066ec6d5d2e5
Author: Jo Van Bulck <jo.vanbulck@xxxxxxxxxxxxxx>
AuthorDate: Thu, 05 Oct 2023 17:38:53 +02:00
Committer: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
CommitterDate: Fri, 08 Dec 2023 10:05:28 -08:00

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@xxxxxxxxxxxxxx>
Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Reviewed-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
Link: https://lore.kernel.org/all/20231005153854.25566-13-jo.vanbulck%40cs.kuleuven.be
---
tools/testing/selftests/sgx/test_encl.lds | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/sgx/test_encl.lds b/tools/testing/selftests/sgx/test_encl.lds
index 333a3e7..ffe851a 100644
--- a/tools/testing/selftests/sgx/test_encl.lds
+++ b/tools/testing/selftests/sgx/test_encl.lds
@@ -33,6 +33,8 @@ SECTIONS
*(.note*)
*(.debug*)
*(.eh_frame*)
+ *(.dyn*)
+ *(.gnu.hash)
}
}