From 0749fe58aba14f98bc6d77d164694e6c6071d3e1 Mon Sep 17 00:00:00 2001
From: midipix <writeonce@midipix.org>
Date: Thu, 10 Jun 2021 21:50:25 +0000
Subject: build system: ccenv_set_primary_tools(): be resilient to
 -print-file-name bugs.

---
 sofort/ccenv/ccenv.sh | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'sofort')

diff --git a/sofort/ccenv/ccenv.sh b/sofort/ccenv/ccenv.sh
index a0f69f2..e52f640 100644
--- a/sofort/ccenv/ccenv.sh
+++ b/sofort/ccenv/ccenv.sh
@@ -239,9 +239,16 @@ ccenv_set_primary_tools()
 
 	# archive format preamble
 	if [ -n "$ccenv_dumpmachine_switch" ]; then
-		ccenv_libgcc_a_header=$(od -b -N8             \
-			$($ccenv_cc -print-file-name=libgcc.a) \
-			| head -n1)
+		ccenv_libgcc_path=$($ccenv_cc -print-file-name=libgcc.a \
+			2>/dev/null)
+
+		if [ -n "$ccenv_libgcc_path" ]; then
+			ccenv_libgcc_a_header=$(od -b -N8             \
+				$($ccenv_cc -print-file-name=libgcc.a) \
+				| head -n1)
+		else
+			ccenv_libgcc_a_header=
+		fi
 	else
 		ccenv_libgcc_a_header=
 	fi
-- 
cgit v1.2.3