Commit 08ede98f authored by Peter Jones's avatar Peter Jones

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_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 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 ?

Signed-off-by: default avatarPeter Jones <>
parent 964f56b3
......@@ -9,7 +9,7 @@ LD = $(CROSS_COMPILE)ld
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment