From 848ca6d8965e491ca4a44487babbaa9c86b16f4f Mon Sep 17 00:00:00 2001 From: Hubert Badocha Date: Wed, 23 Oct 2024 15:27:37 +0200 Subject: [PATCH] Makefile.common: fix ld version parsing Fix ld version parsing not working for version format .. Add explicit error when version cannot be parsed. JIRA: RTOS-959 --- Makefile.common | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.common b/Makefile.common index 29b286e3..38d03e85 100644 --- a/Makefile.common +++ b/Makefile.common @@ -87,8 +87,10 @@ endif # Do not warn about RWX segments. # binutils >= 2.39 required -LD_VERSION_MINOR := $(shell $(LD) $(LDFLAGS_PREFIX)--version 2> /dev/null | grep -Eo "[0-9][0-9]$$") -ifeq ($(shell expr $(LD_VERSION_MINOR) ">=" 39), 1) +LD_VERSION_MINOR := $(shell $(LD) $(LDFLAGS_PREFIX)--version 2> /dev/null | grep -Eo "\b2\.[0-9]*" | cut -d . -f 2) +ifeq ($(LD_VERSION_MINOR),) +$(error Can't parse LD version!) +else ifeq ($(shell expr $(LD_VERSION_MINOR) ">=" 39), 1) LDFLAGS += $(LDFLAGS_PREFIX)--no-warn-rwx-segments endif