aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2017-10-25 10:04:25 +0200
committerLukas Larsson <[email protected]>2017-10-25 10:04:25 +0200
commit8c8467e3ad26932aaacfb01efb2118d986e5200f (patch)
treee489e9513f0c584b4ce030731552c876bd9ae789
parenta9812e6307fe335d077f96d3a6342cbd4894ed0b (diff)
downloadotp-8c8467e3ad26932aaacfb01efb2118d986e5200f.tar.gz
otp-8c8467e3ad26932aaacfb01efb2118d986e5200f.tar.bz2
otp-8c8467e3ad26932aaacfb01efb2118d986e5200f.zip
erts: Only do PGO if gcc supports -fprofile-correction
-rw-r--r--erts/configure.in18
-rw-r--r--erts/emulator/Makefile.in10
2 files changed, 8 insertions, 20 deletions
diff --git a/erts/configure.in b/erts/configure.in
index 9948e71b2d..b47d94b285 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -603,6 +603,8 @@ AS_HELP_STRING([--enable-pgo],
esac
],enable_pgo=default)
+LM_CHECK_ENABLE_CFLAG([-fprofile-use -fprofile-correction -Werror],[PROFILE_CORRECTION])
+
USE_PGO=false
AC_MSG_CHECKING([whether to do PGO of erts])
if test $enable_pgo = no; then
@@ -615,22 +617,16 @@ elif test $CROSS_COMPILING = yes; then
fi
elif test "X$host" = "Xwin32"; then
AC_MSG_RESULT([no, not supported in windows])
-elif test "X$PROFILE_GENERATE" = "Xtrue" -a "X$PROFILE_USE" = "Xtrue"; then
+elif test "X$PROFILE_GENERATE" = "Xtrue" -a "X$PROFILE_USE" = "Xtrue" -a "X$PROFILE_CORRECTION" = "Xtrue"; then
+ ## We need -fprofile-generate and -fprofile-correction support to use PGO with
+ ## gcc as multiple threads run within the executed object files
USE_PGO=true
- AC_MSG_RESULT([yes, using -fprofile-generate])
PROFILE_COMPILER=gcc
-# check if $CC accepts -fprofile-correction, if so we can use PGO on multi-threaded files.
- LM_CHECK_ENABLE_CFLAG([-fprofile-use -fprofile-correction -Werror],[PROFILE_CORRECTION])
- if test "X$PROFILE_CORRECTION" = "Xtrue"; then
- PROFILE_CORRECTION="-fprofile-correction"
- else
- PROFILE_CORRECTION=""
- fi
- AC_SUBST(PROFILE_CORRECTION)
+ AC_MSG_RESULT([yes, using -fprofile-generate -fprofile-correction])
elif test "X$PROFILE_INSTR_GENERATE" = "Xtrue" -a "X$PROFILE_INSTR_USE" = "Xtrue"; then
USE_PGO=true
- AC_MSG_RESULT([yes, using -fprofile-instr-generate])
PROFILE_COMPILER=clang
+ AC_MSG_RESULT([yes, using -fprofile-instr-generate])
else
if $enable_pgo = yes; then
AC_MSG_ERROR(cannot use PGO with this compiler)
diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in
index 2b203c9ee6..47d8ee8811 100644
--- a/erts/emulator/Makefile.in
+++ b/erts/emulator/Makefile.in
@@ -74,9 +74,8 @@ endif
endif
ifeq ($(PROFILE_COMPILER), gcc)
-PROFILE_CORRECTION=@PROFILE_CORRECTION@
PROFILE_GENERATE=-fprofile-generate
-PROFILE_USE=-fprofile-use $(PROFILE_CORRECTION)
+PROFILE_USE=-fprofile-use -fprofile-correction
PROFILE_USE_DEPS=$(OBJDIR)/%_pu.gcda
endif
ifeq ($(PROFILE_COMPILER), clang)
@@ -808,14 +807,7 @@ $(ERL_TOP)/lib/%.beam:
INIT_OBJS = $(OBJDIR)/erl_main.o $(PRELOAD_OBJ)
-# -fprofile-correction is needed in order to use PGO on erl_process
-# as multiple threads execute in that file.
-ifeq ($(PROFILE_CORRECTION),)
-PROFILE_OBJS = $(OBJDIR)/beam_emu.o
-RUN_OBJS = $(OBJDIR)/erl_process.o
-else
PROFILE_OBJS = $(OBJDIR)/beam_emu.o $(OBJDIR)/erl_process.o
-endif
EMU_OBJS = \
$(OBJDIR)/beam_opcodes.o \