build: Add static component pointers for LTO #13193
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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).