[Asterisk-code-review] core/buildsystem: check the actual compiler being version (...asterisk[13])

Friendly Automation asteriskteam at digium.com
Tue Apr 23 15:23:42 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11238 )

Change subject: core/buildsystem: check the actual compiler being version
......................................................................

core/buildsystem: check the actual compiler being version

Make compiler check use the output of the actual compiler being
used as reported by the CC variable, instead of unconditionally
running the "gcc" binary.  Also only run the check if the compiler
is gcc or a cross-compile gcc.

ASTERISK-28374

Change-Id: Icaacf6d93686ad21076878aa1504a23b4fc9d0f4
---
M Makefile.rules
1 file changed, 7 insertions(+), 2 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Christian Savinovich: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/Makefile.rules b/Makefile.rules
index dc23a9e..c45d9d0 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -67,11 +67,16 @@
   endif
 endif
 
-# gcc version 8.2.1 and above must have partial-inlining disabled to avoid documented bug
-GCC_VER_GTE821:=$(shell expr `gcc --version | grep ^gcc | cut -d ' ' -f 3 | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/'` \>= 80201)
+# gcc version 8.2.1 and above must have partial-inlining disabled to avoid documented bug.
+# We must handle cross-compiling and clang so make sure the compiler version string has "gcc"
+# somewhere in it before testing the version.
+CC_VERS_STRING=$(shell $(CC) --version | grep -i gcc)
+ifneq ($(CC_VERS_STRING),)
+GCC_VER_GTE821:=$(shell expr `echo '$(CC_VERS_STRING)' | cut -d ' ' -f 3 | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/'` \>= 80201)
 ifeq ($(GCC_VER_GTE821),1)
     OPTIMIZE+=-fno-partial-inlining
 endif
+endif
 
 ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))$(AST_CODE_COVERAGE),no)
     _ASTCFLAGS+=$(OPTIMIZE)

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11238
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: Icaacf6d93686ad21076878aa1504a23b4fc9d0f4
Gerrit-Change-Number: 11238
Gerrit-PatchSet: 2
Gerrit-Owner: Guido Falsi <madpilot at freebsd.org>
Gerrit-Reviewer: Christian Savinovich <csavinovich at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190423/337c2cca/attachment.html>


More information about the asterisk-code-review mailing list