Skip to content

config: fix issues in weak symbol support - #7919

Merged
hzhou merged 1 commit into
pmodels:mainfrom
hzhou:2608_weak
Aug 3, 2026
Merged

config: fix issues in weak symbol support#7919
hzhou merged 1 commit into
pmodels:mainfrom
hzhou:2608_weak

Conversation

@hzhou

@hzhou hzhou commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Pull Request Description

There was an issue with icx support of weak symbols using #pragma weak. While the compile works, it will not properly honor the visibility attribute on the weak symbols. It does support weak symbols via attributes thoush. Potentially this is due to #pragma weak is separate from attributes in icx.

Coincidentally, icx will raise error if the weak function is used within the compilation unit. Assumably, it treats the pragma weak declaration as an unresolved duplicate at compile time so it won't compile the function call within the unit.

Anyway, that's how our previous releas worked with icx, by accidentally prefer weak attribute against pragma weak.

This commit restors the previous behavior as a work around for icx's bad support of #pragma weak.

Credit to @colleeneb for bisecting releases and identifying key differences.

Fixes #7913

Author Checklist

  • Provide Description
    Particularly focus on why, not what. Reference background, issues, test failures, xfail entries, etc.
  • Commits Follow Good Practice
    Commits are self-contained and do not do two things at once.
    Commit message is of the form: module: short description
    Commit message explains what's in the commit.
  • Passes All Tests
    Whitespace checker. Warnings test. Additional tests via comments.
  • Contribution Agreement
    For non-Argonne authors, check contribution agreement.
    If necessary, request an explicit comment from your companies PR approval manager.

There was an issue with icx support of weak symbols using #pragma weak.
While the compile works, it will not properly honor the visibility
attribute on the weak symbols. It does support weak symbols via
attributes thoush. Potentially this is due to #pragma weak is separate
from attributes in icx.

Coincidentally, icx will raise error if the weak function is used within
the compilation unit. Assumably, it treats the pragma weak declaration as an
unresolved duplicate at compile time so it won't compile the function
call within the unit.

Anyway, that's how our previous release worked with icx, by accidentally
prefer weak attribute against pragma weak.

This commit restores the previous behavior as a work around for icx's bad
support of #pragma weak.

@colleeneb colleeneb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I built and tested on Sunspot and it built fine with intel. I confirmed the MPI symbols produced are global weak symbols. The macros defined in mpichconf.h match the older commit indeed: #define HAVE_ATTR_WEAK_ALIAS 1, /* #undef HAVE_MULTIPLE_PRAGMA_WEAK */, and /* #undef HAVE_PRAGMA_WEAK_ALIAS */.

For the record that I think the root cause of #pragma weak MPI_Foo = PMPI_Foo not working as expected is an Intel or clang bug and we reported it to Intel (argonne-lcf/AuroraBugTracking#153). So this could be reverted in the future once that is fixed.

@hzhou
hzhou merged commit 249144b into pmodels:main Aug 3, 2026
8 checks passed
@hzhou
hzhou deleted the 2608_weak branch August 3, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intel icx + -fvisibility=hidden hides weak MPI_* aliases from libmpi.so

2 participants