Skip to content

Commit 5c4185a

Browse files
author
Ralph Castain
committed
Add the __optnone__ attribute to help avoid optimizing out MPIR_Breakpoint
Thanks to @kiranchandramohan for the suggestion Signed-off-by: Ralph Castain <[email protected]>
1 parent 6ec4ab5 commit 5c4185a

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

config/opal_check_attributes.m4

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dnl Copyright (c) 2013 Mellanox Technologies, Inc.
1616
dnl All rights reserved.
1717
dnl Copyright (c) 2015 Research Organization for Information Science
1818
dnl and Technology (RIST). All rights reserved.
19+
dnl Copyright (c) 2017 Intel, Inc. All rights reserved.
1920
dnl $COPYRIGHT$
2021
dnl
2122
dnl Additional copyrights may follow
@@ -221,6 +222,7 @@ AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [
221222
opal_cv___attribute__warn_unused_result=0
222223
opal_cv___attribute__weak_alias=0
223224
opal_cv___attribute__destructor=0
225+
opal_cv___attribute__optnone=0
224226
else
225227
AC_MSG_RESULT([yes])
226228

@@ -556,6 +558,15 @@ AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [
556558
],
557559
[],
558560
[])
561+
562+
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([optnone],
563+
[
564+
void foo(void) __attribute__ ((__optnone__));
565+
void foo(void) { return ; }
566+
],
567+
[],
568+
[])
569+
559570
fi
560571

561572
# Now that all the values are set, define them
@@ -608,4 +619,6 @@ AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [
608619
[Whether your compiler has __attribute__ weak alias or not])
609620
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_DESTRUCTOR, [$opal_cv___attribute__destructor],
610621
[Whether your compiler has __attribute__ destructor or not])
622+
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_OPTNONE, [$opal_cv___attribute__optnone],
623+
[Whether your compiler has __attribute__ optnone or not])
611624
])

opal/include/opal_config_bottom.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* All rights reserved.
1616
* Copyright (c) 2015-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
18-
* Copyright (c) 2015 Intel, Inc. All rights reserved.
18+
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
1919
* $COPYRIGHT$
2020
*
2121
* Additional copyrights may follow
@@ -234,6 +234,12 @@
234234
# define __opal_attribute_destructor__
235235
#endif
236236

237+
#if OPAL_HAVE_ATTRIBUTE_OPTNONE
238+
# define __opal_attribute_optnone__ __attribute__((__optnone__))
239+
#else
240+
# define __opal_attribute_optnone__
241+
#endif
242+
237243
# if OPAL_C_HAVE_VISIBILITY
238244
# define OPAL_DECLSPEC __opal_attribute_visibility__("default")
239245
# define OPAL_MODULE_DECLSPEC __opal_attribute_visibility__("default")
@@ -268,11 +274,11 @@
268274
#include <sys/param.h>
269275
#endif
270276
#if defined(PATH_MAX)
271-
#define OPAL_PATH_MAX (PATH_MAX + 1)
277+
#define OPAL_PATH_MAX (PATH_MAX + 1)
272278
#elif defined(_POSIX_PATH_MAX)
273-
#define OPAL_PATH_MAX (_POSIX_PATH_MAX + 1)
279+
#define OPAL_PATH_MAX (_POSIX_PATH_MAX + 1)
274280
#else
275-
#define OPAL_PATH_MAX 256
281+
#define OPAL_PATH_MAX 256
276282
#endif
277283

278284
/*

orte/orted/orted_submit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ char MPIR_attach_fifo[MPIR_MAX_PATH_LENGTH] = {0};
173173
int MPIR_force_to_main = 0;
174174
static void orte_debugger_init_before_spawn(orte_job_t *jdata);
175175

176-
ORTE_DECLSPEC void* MPIR_Breakpoint(void);
176+
ORTE_DECLSPEC void* MPIR_Breakpoint(void) __opal_attribute_optnone__;
177177

178178
/*
179179
* Breakpoint function for parallel debuggers

0 commit comments

Comments
 (0)