From f9fd7337f63698f33239c58c07bf430198235a22 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 10 Nov 2020 19:07:30 +0000 Subject: [PATCH] Fix dso_handle_check for PIE executables. PIE executables use crtbeginS.o and have a non-NULL dso_handle as a result. Reviewed by: andrew, emaste MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27126 --- lib/csu/tests/fini_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/csu/tests/fini_test.c b/lib/csu/tests/fini_test.c index ea825e51acf..c06e62e093f 100644 --- a/lib/csu/tests/fini_test.c +++ b/lib/csu/tests/fini_test.c @@ -141,9 +141,9 @@ dso_handle_check(void) { void *dso = __dso_handle; -#ifdef DSO_LIB +#if defined(DSO_LIB) || defined(__PIE__) ATF_REQUIRE_MSG(dso != NULL, - "Null __dso_handle in DSO"); + "Null __dso_handle in DSO/PIE"); #else ATF_REQUIRE_MSG(dso == NULL, "Invalid __dso_handle in non-DSO");