svn commit: r366251 - head/sys/conf

Edward Tomasz Napierala trasz at FreeBSD.org
Tue Sep 29 11:48:22 UTC 2020


Author: trasz
Date: Tue Sep 29 11:48:22 2020
New Revision: 366251
URL: https://svnweb.freebsd.org/changeset/base/366251

Log:
  Build debug kernels with -O2.
  
  LLVM 11 changed the meaning of '-O' from '-O2' to '-O1', which resulted
  in debug kernels (with 'makeoptions DEBUG=-g') being built with inlining
  disabled, causing severe performance hit.
  
  The -O2 was already being used for building amd64, powerpc, and powerpcspe.
  
  Discussed with:	jrtc27, arichardson, bdragon, jhibbits
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D26471

Modified:
  head/sys/conf/kern.pre.mk

Modified: head/sys/conf/kern.pre.mk
==============================================================================
--- head/sys/conf/kern.pre.mk	Tue Sep 29 11:18:48 2020	(r366250)
+++ head/sys/conf/kern.pre.mk	Tue Sep 29 11:48:22 2020	(r366251)
@@ -51,25 +51,14 @@ OBJCOPY?=	objcopy
 SIZE?=		size
 
 .if defined(DEBUG)
-.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe"
-# Work around clang 11 miscompile on 32 bit powerpc.
-_MINUS_O=	-O2
-.else
-_MINUS_O=	-O
-.endif
 CTFFLAGS+=	-g
-.else
-_MINUS_O=	-O2
 .endif
-.if ${MACHINE_CPUARCH} == "amd64"
-.if ${COMPILER_TYPE} == "clang"
-COPTFLAGS?=-O2 -pipe
+.if ${MACHINE_CPUARCH} == "amd64" && ${COMPILER_TYPE} != "clang"
+_COPTFLAGS_EXTRA=-frename-registers
 .else
-COPTFLAGS?=-O2 -frename-registers -pipe
+_COPTFLAGS_EXTRA=
 .endif
-.else
-COPTFLAGS?=${_MINUS_O} -pipe
-.endif
+COPTFLAGS?=-O2 -pipe ${_COPTFLAGS_EXTRA}
 .if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
 COPTFLAGS+= -fno-strict-aliasing
 .endif


More information about the svn-src-head mailing list