Skip to content

build: Add static component pointers for LTO #13193

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bwbarrett
Copy link
Member

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).

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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants