Skip to content

Commit

Permalink
OS-7604 -faggressive-loop-optimizations should be off everywhere
Browse files Browse the repository at this point in the history
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
  • Loading branch information
John Levon authored and citrus-it committed Mar 27, 2019
1 parent eee792c commit 2985bce
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
7 changes: 7 additions & 0 deletions Makefile.joyent
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# THE SOFTWARE.
#

include $(PWD)/../../../build.env

PROTO_AREA = $(PWD)/../../../proto
KERNEL_SOURCE = $(PWD)/../../illumos
MDB_SOURCE = $(KERNEL_SOURCE)/usr/src/cmd/mdb
Expand Down Expand Up @@ -52,6 +54,11 @@ ALWAYS_CFLAGS = \
-Werror \
-fno-inline-functions

# Skip dubious optimizations in later GCCs
ifneq ($(PRIMARY_COMPILER_VER),4)
ALWAYS_CFLAGS += -fno-aggressive-loop-optimizations
endif

USER_CFLAGS = \
-finline \
-gdwarf-2 \
Expand Down
43 changes: 26 additions & 17 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2018, Joyent, Inc.
# Copyright (c) 2019, Joyent, Inc.
#

for dir in seabios vgabios kvm/test; do
Expand All @@ -13,31 +13,40 @@ PNGINC="${PNGDIR}/proto/usr/local/include"
PNGLIB="${PNGDIR}/proto/usr/local/lib"
PREFIX="${PREFIX:-/smartdc}"

. $(pwd)/../../../build.env

#
# Skip dangerous GCC options (not that any specific problems are known of here).
#
if [[ "$PRIMARY_COMPILER_VER" -gt 4 ]]; then
XCFLAGS=-fno-aggressive-loop-optimizations
fi

if [[ ! -d ${PNGDIR} ]]; then
(curl -k https://download.joyent.com/pub/kvm-cmd/libpng-1.5.4.tar.gz | \
gtar -zxf -)
if [[ $? != "0" || ! -d ${PNGDIR} ]]; then
echo "Failed to get libpng."
rm -rf ${PNGDIR}
exit 1
fi
(curl -k https://download.joyent.com/pub/kvm-cmd/libpng-1.5.4.tar.gz | \
gtar -zxf -)
if [[ $? != "0" || ! -d ${PNGDIR} ]]; then
echo "Failed to get libpng."
rm -rf ${PNGDIR}
exit 1
fi
fi

if [[ ! -e ${PNGLIB}/libpng.a ]]; then
(cd ${PNGDIR} && \
CC="${CC:-${DESTDIR}/usr/bin/gcc}" \
LDFLAGS="-m64 -L${DESTDIR}/usr/lib/amd64 -L${DESTDIR}/lib/amd64" \
CPPFLAGS="-isystem ${DESTDIR}/usr/include" \
CFLAGS="-m64" ./configure --disable-shared && \
make && \
mkdir -p ${PNGDIR}/proto && \
make DESTDIR=${PNGDIR}/proto install)
(cd ${PNGDIR} && \
CC="${CC:-${DESTDIR}/usr/bin/gcc}" \
LDFLAGS="-m64 -L${DESTDIR}/usr/lib/amd64 -L${DESTDIR}/lib/amd64" \
CPPFLAGS="-isystem ${DESTDIR}/usr/include" \
CFLAGS="-m64 $XCFLAGS" ./configure --disable-shared && \
make && \
mkdir -p ${PNGDIR}/proto && \
make DESTDIR=${PNGDIR}/proto install)
fi

echo "==> Running configure"
KVM_DIR="${KVM_DIR:-$(cd `pwd`/../kvm; pwd)}"
CC="${CC:-${DESTDIR}/usr/bin/gcc}"
XCFLAGS="-fno-builtin -I${PNGINC} -isystem ${DESTDIR}/usr/include -msave-args"
XCFLAGS+=" -fno-builtin -I${PNGINC} -isystem ${DESTDIR}/usr/include -msave-args"
XLDFLAGS="-nodefaultlibs -L${PNGLIB} -L${DESTDIR}/usr/lib/amd64 -L${DESTDIR}/lib/amd64"
XLDFLAGS="${XLDFLAGS} -Wl,-zfatal-warnings -Wl,-zassert-deflib"
XLDFLAGS="${XLDFLAGS} -lz -lm -lc"
Expand Down

0 comments on commit 2985bce

Please sign in to comment.