Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect against LTO optimizer #20

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading