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
This commit is contained in:
John Baldwin 2020-11-10 19:07:30 +00:00
parent ecad1d050c
commit f9fd7337f6

View File

@ -141,9 +141,9 @@ dso_handle_check(void)
{ {
void *dso = __dso_handle; void *dso = __dso_handle;
#ifdef DSO_LIB #if defined(DSO_LIB) || defined(__PIE__)
ATF_REQUIRE_MSG(dso != NULL, ATF_REQUIRE_MSG(dso != NULL,
"Null __dso_handle in DSO"); "Null __dso_handle in DSO/PIE");
#else #else
ATF_REQUIRE_MSG(dso == NULL, ATF_REQUIRE_MSG(dso == NULL,
"Invalid __dso_handle in non-DSO"); "Invalid __dso_handle in non-DSO");