Skip to content

Commit c2c7c68

Browse files
rhc54hppritcha
authored andcommitted
Protect against LTO optimizer
We currently do not support the LTO optimizer as it is incompatible with our plugin component architecture. So detect it has been specified in configure and error out with an explanation. Includes suggestions from @jsquyres bot:notacherrypick Signed-off-by: Ralph Castain <rhc@pmix.org> (cherry picked from commit dd7706c)
1 parent c2a94b5 commit c2c7c68

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

config/prte_check_cflags.m4

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ dnl -*- shell-script -*-
22
dnl
33
dnl Copyright (c) 2021 IBM Corporation. All rights reserved.
44
dnl
5-
dnl Copyright (c) 2021 Nanook Consulting. All rights reserved.
5+
dnl Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
66
dnl $COPYRIGHT$
77
dnl
88
dnl Additional copyrights may follow
@@ -40,3 +40,15 @@ AC_MSG_CHECKING(if $CC supports ([$1]))
4040
AC_MSG_RESULT([yes])
4141
fi
4242
])
43+
44+
45+
AC_DEFUN([_PRTE_CHECK_LTO_FLAG], [
46+
chkflg=`echo $1 | grep -- -flto`
47+
if test -n "$chkflg"; then
48+
AC_MSG_WARN([Configure has detected the presence of the -flto])
49+
AC_MSG_WARN([compiler directive in $2. PRRTE does not currently])
50+
AC_MSG_WARN([support this flag as it conflicts with the])
51+
AC_MSG_WARN([plugin architecture of the PRRTE code base.])
52+
AC_MSG_ERROR([Please remove this directive and re-run configure.])
53+
fi
54+
])

configure.ac

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,19 @@ CPPFLAGS="$CPP_INCLUDES $CPPFLAGS $PRTE_FINAL_CPPFLAGS"
931931
LDFLAGS="$LDFLAGS $PRTE_FINAL_LDFLAGS"
932932
LIBS="$LIBS $PRTE_FINAL_LIBS"
933933

934+
935+
# We do not currently support the "lto" optimizer as it
936+
# aggregates all the headers from our plugins, resulting
937+
# in a configuration that generates warnings/errors when
938+
# passed through their optimizer phase. We therefore check
939+
# for the flag, and if found, output a message explaining
940+
# the situation and aborting configure
941+
_PRTE_CHECK_LTO_FLAG($CPPFLAGS, CPPFLAGS)
942+
_PRTE_CHECK_LTO_FLAG($CFLAGS, CFLAGS)
943+
_PRTE_CHECK_LTO_FLAG($LDFLAGS, LDFLAGS)
944+
_PRTE_CHECK_LTO_FLAG($LIBS, LIBS)
945+
946+
934947
# restore any user-provided Werror flags
935948
AS_IF([test ! -z "$PRTE_CFLAGS_cache"], [CFLAGS="$CFLAGS $PRTE_CFLAGS_cache"])
936949

0 commit comments

Comments
 (0)