mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-28 19:21:08 +00:00
Only link with libdl on Linux
Requiring an extra library for dlopen is a Linux non-POSIX-compliance. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
ca144597e8
commit
5dbee582a3
@ -17,6 +17,12 @@ LOCAL_LDFLAGS = ${MBEDTLS_TEST_OBJS} \
|
|||||||
-lmbedx509$(SHARED_SUFFIX) \
|
-lmbedx509$(SHARED_SUFFIX) \
|
||||||
-lmbedcrypto$(SHARED_SUFFIX)
|
-lmbedcrypto$(SHARED_SUFFIX)
|
||||||
|
|
||||||
|
ifeq ($(shell uname -s),Linux)
|
||||||
|
DLOPEN_LDFLAGS ?= -ldl
|
||||||
|
else
|
||||||
|
DLOPEN_LDFLAGS ?=
|
||||||
|
endif
|
||||||
|
|
||||||
include ../3rdparty/Makefile.inc
|
include ../3rdparty/Makefile.inc
|
||||||
LOCAL_CFLAGS+=$(THIRDPARTY_INCLUDES)
|
LOCAL_CFLAGS+=$(THIRDPARTY_INCLUDES)
|
||||||
|
|
||||||
@ -354,7 +360,7 @@ test/dlopen$(EXEXT): test/dlopen.c $(DEP)
|
|||||||
# Do not link any test objects (that would bring in a static dependency on
|
# Do not link any test objects (that would bring in a static dependency on
|
||||||
# libmbedcrypto at least). Do not link with libmbed* (that would defeat the
|
# libmbedcrypto at least). Do not link with libmbed* (that would defeat the
|
||||||
# purpose of testing dynamic loading).
|
# purpose of testing dynamic loading).
|
||||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/dlopen.c $(LDFLAGS) -ldl -o $@
|
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/dlopen.c $(LDFLAGS) $(DLOPEN_LDFLAGS) -o $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
test/query_config.o: test/query_config.c test/query_config.h $(DEP)
|
test/query_config.o: test/query_config.c test/query_config.h $(DEP)
|
||||||
|
@ -30,7 +30,9 @@ endif()
|
|||||||
if(USE_SHARED_MBEDTLS_LIBRARY)
|
if(USE_SHARED_MBEDTLS_LIBRARY)
|
||||||
add_executable(dlopen "dlopen.c")
|
add_executable(dlopen "dlopen.c")
|
||||||
target_include_directories(dlopen PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
|
target_include_directories(dlopen PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
|
||||||
target_link_libraries(dlopen "-ldl")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
target_link_libraries(dlopen "-ldl")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(GEN_FILES)
|
if(GEN_FILES)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user