[sr-dev] git:master:1f99806f: Makefile.defs: cleanup the CPUTYPE/mtune definitions for i386 and x86_64

Henning Westerholt hw at kamailio.org
Sat Oct 6 18:08:31 CEST 2018


Module: kamailio
Branch: master
Commit: 1f99806fa2db09b9ac6da7fbeb388a93c7638f13
URL: https://github.com/kamailio/kamailio/commit/1f99806fa2db09b9ac6da7fbeb388a93c7638f13

Author: Henning Westerholt <hw at kamailio.org>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2018-10-06T18:04:00+02:00

Makefile.defs: cleanup the CPUTYPE/mtune definitions for i386 and x86_64

- Makefile.defs: cleanup the CPUTYPE/mtune definitions for i386 and x86_64
- revert change c925278b8ee3492f71a from 2011 for gcc SUSE 4.5.x, now not needed
- use for current gcc (>= gcc 4.2) the generic mtune, which is now available
- From the gcc manual:
  "Produce code optimized for the most common IA32/AMD64/EM64T processors.
  If you know the CPU on which your code will run, then you should use the
  corresponding -mtune or -march option instead of -mtune=generic. But, if
  you do not know exactly what CPU users of your application will have, then
  you should use this option.
  As new processors are deployed in the marketplace, the behavior of this
  option will change. Therefore, if you upgrade to a newer version of GCC,
  code generation controlled by this option will change to reflect the
  processors that are most common at the time that version of GCC is released.
- unify opteron usage, use equivalent athlon64 mtune for old compilers instead
- simplify x86_64 gcc logic, remove now redundant 4.2.x if case
- there should be no performance implications, as we compile without debugging
- we prefer right now to have proper debugging, this would break with agressive
  optimization

---

Modified: src/Makefile.defs

---

Diff:  https://github.com/kamailio/kamailio/commit/1f99806fa2db09b9ac6da7fbeb388a93c7638f13.diff
Patch: https://github.com/kamailio/kamailio/commit/1f99806fa2db09b9ac6da7fbeb388a93c7638f13.patch

---

diff --git a/src/Makefile.defs b/src/Makefile.defs
index ee5fffa209..fe4dc4ce2f 100644
--- a/src/Makefile.defs
+++ b/src/Makefile.defs
@@ -888,7 +888,7 @@ ifeq		($(CC_NAME), gcc)
 				CFLAGS=-g $(CC_OPT) -funroll-loops  -Wcast-align $(PROFILE)
 			#if gcc 8.0+, 7.0+, 6.0+, 5.0+, 4.5+ or 4.2+
 ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+ 7.0+ 8.0+,$(CC_SHORTVER))))
-$(call				set_if_empty,CPUTYPE,athlon64)
+$(call				set_if_empty,CPUTYPE,generic)
 					CFLAGS+=-m32 -minline-all-stringops \
 							-falign-loops \
 							-ftree-vectorize \
@@ -969,18 +969,8 @@ ifeq		($(CC_NAME), gcc)
 				#common stuff
 				CFLAGS=-g $(CC_OPT) -funroll-loops  -Wcast-align $(PROFILE)
 			#if gcc 4.5+
-			# don't add '-mtune=$(CPUTYPE)' - gcc failure
-ifeq			($(CC_SHORTVER),$(filter $(CC_SHORTVER),4.5+ 5.0+ 6.0+ 7.0+ 8.0+))
-$(call				set_if_empty,CPUTYPE,opteron)
-					CFLAGS+=-m64 -minline-all-stringops \
-							-falign-loops \
-							-ftree-vectorize \
-							-fno-strict-overflow
-					LDFLAGS+=-m64
-else
-			#if gcc 4.2+
-ifeq			($(CC_SHORTVER), 4.2+)
-$(call				set_if_empty,CPUTYPE,opteron)
+ifeq			($(CC_SHORTVER),$(filter $(CC_SHORTVER),4.2+ 4.5+ 5.0+ 6.0+ 7.0+ 8.0+))
+$(call				set_if_empty,CPUTYPE,generic)
 					CFLAGS+=-m64 -minline-all-stringops \
 							-falign-loops \
 							-ftree-vectorize \
@@ -990,7 +980,7 @@ $(call				set_if_empty,CPUTYPE,opteron)
 else
 			#if gcc 4.0+
 ifeq			($(CC_SHORTVER), 4.x)
-$(call				set_if_empty,CPUTYPE,opteron)
+$(call				set_if_empty,CPUTYPE,athlon64)
 					CFLAGS+=-m64 -minline-all-stringops \
 							-falign-loops \
 							-ftree-vectorize \
@@ -1028,7 +1018,6 @@ endif			# CC_SHORTVER, 2.9x
 endif			# CC_SHORTVER, 3.0
 endif			# CC_SHORTVER, 3.4
 endif			# CC_SHORTVER, 4.x
-endif			# CC_SHORTVER, 4.2+
 endif			# CC_SHORTVER, 8.0+, 7.0+, 6.0+, 5.0+, 4.5+
 
 else		# CC_NAME, gcc




More information about the sr-dev mailing list