[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.
This commit is contained in:
bdragon 2020-09-08 01:27:03 +00:00
parent 0f78ab2e7d
commit 6f47da0d99

View File

@ -51,15 +51,16 @@ 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"
COPTFLAGS?=-O2 -pipe