Skip to content

Commit

Permalink
Makefile.common: fix ld version parsing
Browse files Browse the repository at this point in the history
Fix ld version parsing not working for version format <Major>.<Minor>.<Patch>
Add explicit error when version cannot be parsed.

JIRA: RTOS-959
  • Loading branch information
badochov committed Oct 23, 2024
1 parent e268324 commit 848ca6d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 848ca6d

Please sign in to comment.