From d9a4c912c0aa72905ca793b555dcb0afb33e3b30 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 18 May 2016 10:32:21 -0400 Subject: [PATCH] Work around binutils version string weirdness. Nick Clifton wrote to me and explained: Subject: SHIM - objcopy version check broken by RHEL 7.3 binutils Hi Peter, We (the tools group) have run across a small problem with the shim package for RHEL 7.3, whilst testing out a new version of the binutils. It complains that it needs a version of objcopy that is >= 2.23, despite the fact that the version is actually 2.25.1. I tracked the problem down to an extraneous space at the end of the version string being produced by objcopy: "GNU objcopy version 2.25.1-8.el7 " The Makefile in the shim package uses this rule to test the version of objcopy: OBJCOPY_GTE224 = $(shell expr `$(OBJCOPY) --version |grep ^"GNU objcopy" | sed 's/^.* //g' | cut -f1-2 -d.` \>= 2.24) But, because of that extra space, the sed expression clips the entire line and so the test fails. The extra space is there because normally the version number would be followed by a date. For example: "GNU objcopy version 2.23.52.0.1-56.el7 20130226" So in this case the sed will extract the date, not the version number, but the test will still pass. I could fix the binutils to remove the space, although it would be a bit messy and it would not fix the problem when a date is appended to the version number. Instead, I would like to propose a small patch to the shim Makefile. If you change the line to: OBJCOPY_GTE224 = $(shell expr `$(OBJCOPY) --version |grep ^"GNU objcopy" | sed 's/^.version //g' | cut -f1-2 -d.` \>= 2.24) then the test will work as intended, with or without an extra space at the end of the version and with or without a date appended. Would it be possible to have this change added to the shim package ? Cheers Signed-off-by: Peter Jones --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9ceae06..640ecf2 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ LD = $(CROSS_COMPILE)ld OBJCOPY = $(CROSS_COMPILE)objcopy ARCH = $(shell $(CC) -dumpmachine | cut -f1 -d- | sed s,i[3456789]86,ia32,) -OBJCOPY_GTE224 = $(shell expr `$(OBJCOPY) --version |grep ^"GNU objcopy" | sed 's/^.* //g' | cut -f1-2 -d.` \>= 2.24) +OBJCOPY_GTE224 = $(shell expr `$(OBJCOPY) --version |grep ^"GNU objcopy" | sed 's/^.version //g' | cut -f1-2 -d.` \>= 2.24) SUBDIRS = Cryptlib lib