Skip to content

Commit 93a4464

Browse files
committed
build: Add static component pointers for LTO
With GCC's link time optimization, the compiler ends up seeing two declarations of MCA component structures. One in the component itself, which has potentially a component-specific type, and one in static-components.h, which is just declared as a base MCA component struct. The compiler doesn't like this. This patch adds a level of indirection used by the static component lookup code. static-components.h now declares the existance of a mca_component_t * and the list is of pointers to pointers. The MCA base framework has to do an extra dereference, but this is only in the initialization path. We also then have to have the actual pointer exist, so add a macro MCA_BASE_COMPONENT_INIT that we need to add to every component definition to create the pointer (and perhaps do more initialization later). Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent a5485ef commit 93a4464

File tree

123 files changed

+149
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+149
-19
lines changed

config/opal_mca.m4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ extern "C" {
499499
500500
`cat $outfile.extern`
501501
502-
const mca_base_component_t *mca_$2_base_static_components[[]] = {
502+
const mca_base_component_t **mca_$2_base_static_components[[]] = {
503503
`cat $outfile.struct`
504504
NULL
505505
};
@@ -763,8 +763,8 @@ AC_DEFUN([MCA_PROCESS_COMPONENT],[
763763
# $FRAMEWORK_LIB_NAME prefix.
764764
$7="mca/$2/$3/libmca_$2_$3.la $$7"
765765
fi
766-
echo "extern const mca_base_component_t mca_$2_$3_component;" >> $outfile.extern
767-
echo " &mca_$2_$3_component, " >> $outfile.struct
766+
echo "extern const mca_base_component_t *mca_$2_$3_component_ptr;" >> $outfile.extern
767+
echo " &mca_$2_$3_component_ptr," >> $outfile.struct
768768
$5="$$5 $3"
769769
fi
770770

ompi/mca/bml/r2/bml_r2_component.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ mca_bml_base_component_2_0_0_t mca_bml_r2_component = {
5252
},
5353
.bml_init = mca_bml_r2_component_init,
5454
};
55+
MCA_BASE_COMPONENT_INIT(ompi, bml, r2)
5556

5657
static int mca_bml_r2_component_register(void)
5758
{

ompi/mca/coll/accelerator/coll_accelerator_component.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ mca_coll_accelerator_component_t mca_coll_accelerator_component = {
7575
/* Priority: make it above all point to point collectives including self */
7676
.priority = 78,
7777
};
78+
MCA_BASE_COMPONENT_INIT(ompi, coll, accelerator)
7879

7980

8081
static int accelerator_register(void)

ompi/mca/coll/acoll/coll_acoll_component.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const mca_coll_base_component_3_0_0_t mca_coll_acoll_component = {
9090
.collm_init_query = mca_coll_acoll_init_query,
9191
.collm_comm_query = mca_coll_acoll_comm_query,
9292
};
93+
MCA_BASE_COMPONENT_INIT(ompi, coll, acoll)
9394

9495
static int acoll_register(void)
9596
{

ompi/mca/coll/adapt/coll_adapt_component.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ mca_coll_adapt_component_t mca_coll_adapt_component = {
7474
/* default values for non-MCA parameters */
7575
/* Not specifying values here gives us all 0's */
7676
};
77+
MCA_BASE_COMPONENT_INIT(ompi, coll, adapt)
7778

7879
/* Open the component */
7980
static int adapt_open(void)

ompi/mca/coll/basic/coll_basic_component.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const mca_coll_base_component_3_0_0_t mca_coll_basic_component = {
8282
.collm_init_query = mca_coll_basic_init_query,
8383
.collm_comm_query = mca_coll_basic_comm_query,
8484
};
85+
MCA_BASE_COMPONENT_INIT(ompi, coll, basic)
8586

8687

8788
static int

ompi/mca/coll/demo/coll_demo_component.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const mca_coll_base_component_3_0_0_t mca_coll_demo_component = {
8282
.collm_init_query = mca_coll_demo_init_query,
8383
.collm_comm_query = mca_coll_demo_comm_query,
8484
};
85+
MCA_BASE_COMPONENT_INIT(ompi, coll, demo)
8586

8687

8788
static int demo_register(void)

ompi/mca/coll/ftagree/coll_ftagree_component.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ const mca_coll_base_component_3_0_0_t mca_coll_ftagree_component = {
7878
mca_coll_ftagree_init_query,
7979
mca_coll_ftagree_comm_query
8080
};
81+
MCA_BASE_COMPONENT_INIT(ompi, coll, ftagree)
8182

8283
static int
8384
ftagree_close(void)

ompi/mca/coll/han/coll_han_component.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ mca_coll_han_component_t mca_coll_han_component = {
104104
/* workaround for nvcc compiler */
105105
.dynamic_rules_filename = NULL,
106106
};
107+
MCA_BASE_COMPONENT_INIT(ompi, coll, han)
107108

108109
/*
109110
* Init the component

ompi/mca/coll/hcoll/coll_hcoll_component.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ mca_coll_hcoll_component_t mca_coll_hcoll_component = {
6464
0, /* hcoll_enable */
6565
NULL /*hcoll version */
6666
};
67+
MCA_BASE_COMPONENT_INIT(ompi, coll, hcoll)
6768

6869

6970

0 commit comments

Comments
 (0)