From a48643614cba7703f1ebbf92ecb5be5d73389f8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benedikt-Alexander=20Mokro=C3=9F?= <bam@icognize.de>
Date: Tue, 3 Dec 2019 09:52:34 +0100
Subject: [PATCH] Add -pthread to HOSTLOADLIBES_mkimage

On some unix distributions, pthread is not automatically linked.
This results in unresolved symbols when e.g. building u-boot via OpenWRT (using LibreSSL) in dumpimage and other host tools when i.E. CONFIG_FIT_SIGNATURE is set.
Using -pthread to link pthread should be portable across all distributions and OS X.

CHANGELOG:
* Added -pthread to HOSTLOADLIBES_mkimage
---
 tools/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/Makefile b/tools/Makefile
index 24581adccd..2f122bed8e 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -150,7 +150,8 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CON
 HOSTCFLAGS_kwbimage.o += \
 	$(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
 HOSTLOADLIBES_mkimage += \
-	$(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
+	$(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") \
+	-pthread
 
 # OS X deprecate openssl in favour of CommonCrypto, supress deprecation
 # warnings on those systems
-- 
2.20.1

