svn commit: r365441 - head/sys/conf

Brandon Bergren bdragon at FreeBSD.org
Tue Sep 8 01:27:04 UTC 2020


Author: bdragon
Date: Tue Sep  8 01:27:03 2020
New Revision: 365441
URL: https://svnweb.freebsd.org/changeset/base/365441

Log:
  [PowerPC] Work around -O miscompile on powerpc 32 bit.
  
  Work around llvm 11 miscompile in 32 bit powerpc that appears to cause ifuncs
  to branch to the wrong address by forcing -O2. This worked in previous
  versions because -O was mapped to -O2 previously (but is now -O1.)
  
  While here, remove the old temporary workaround from r224882 that does the
  opposite thing for powerpc non-DEBUG kernels, bringing it in line with other
  platforms that compile at -O2.
  
  This fixes kernel boot on powerpc and powerpcspe after the llvm11 transition.
  
  Sponsored by:	Tag1 Consulting, Inc.

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

Modified: head/sys/conf/kern.pre.mk
==============================================================================
--- head/sys/conf/kern.pre.mk	Tue Sep  8 00:48:18 2020	(r365440)
+++ head/sys/conf/kern.pre.mk	Tue Sep  8 01:27:03 2020	(r365441)
@@ -51,14 +51,15 @@ 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
-.if ${MACHINE_CPUARCH} == "powerpc"
-_MINUS_O=	-O	# gcc miscompiles some code at -O2
-.else
 _MINUS_O=	-O2
-.endif
 .endif
 .if ${MACHINE_CPUARCH} == "amd64"
 .if ${COMPILER_TYPE} == "clang"


More information about the svn-src-all mailing list