Skip to content

Commit

Permalink
Protect against LTO optimizer
Browse files Browse the repository at this point in the history
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

Signed-off-by: Ralph Castain <rhc@pmix.org>
  • Loading branch information
rhc54 committed Jul 19, 2024
1 parent 584845f commit dd7706c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
14 changes: 13 additions & 1 deletion config/prte_check_cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2021 IBM Corporation. All rights reserved.
dnl
dnl Copyright (c) 2021 Nanook Consulting. All rights reserved.
dnl Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
Expand Down Expand Up @@ -40,3 +40,15 @@ AC_MSG_CHECKING(if $CC supports ([$1]))
AC_MSG_RESULT([yes])
fi
])


AC_DEFUN([_PRTE_CHECK_LTO_FLAG], [
chkflg=`echo $1 | grep -- -flto`
if test -n "$chkflg"; then
AC_MSG_WARN([Configure has detected the presence of the -flto])
AC_MSG_WARN([compiler directive in $2. PRRTE does not currently])
AC_MSG_WARN([support this flag as it conflicts with the])
AC_MSG_WARN([plugin architecture of the PRRTE code base.])
AC_MSG_ERROR([Please remove this directive and re-run configure.])
fi
])
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,19 @@ CPPFLAGS="$CPP_INCLUDES $CPPFLAGS $PRTE_FINAL_CPPFLAGS"
LDFLAGS="$LDFLAGS $PRTE_FINAL_LDFLAGS"
LIBS="$LIBS $PRTE_FINAL_LIBS"


# We do not currently support the "lto" optimizer as it
# aggregates all the headers from our plugins, resulting
# in a configuration that generates warnings/errors when
# passed through their optimizer phase. We therefore check
# for the flag, and if found, output a message explaining
# the situation and aborting configure
_PRTE_CHECK_LTO_FLAG($CPPFLAGS, CPPFLAGS)
_PRTE_CHECK_LTO_FLAG($CFLAGS, CFLAGS)
_PRTE_CHECK_LTO_FLAG($LDFLAGS, LDFLAGS)
_PRTE_CHECK_LTO_FLAG($LIBS, LIBS)


# restore any user-provided Werror flags
AS_IF([test ! -z "$PRTE_CFLAGS_cache"], [CFLAGS="$CFLAGS $PRTE_CFLAGS_cache"])

Expand Down

0 comments on commit dd7706c

Please sign in to comment.