Skip to content

Fix windows gcc visibility - #224

Open
LinuxJedi wants to merge 2 commits into
wolfSSL:masterfrom
LinuxJedi:fix-windows-gcc-visibility
Open

LinuxJedi wants to merge 2 commits into
wolfSSL:masterfrom
LinuxJedi:fix-windows-gcc-visibility

Conversation

@LinuxJedi

@LinuxJedi LinuxJedi commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

The gnulib visibility probe in configure passes for Windows GCC
targets (Cygwin, MSYS2 and MinGW-w64) because it never defines a
symbol with an explicit hidden attribute. visibility.h then used
attribute((visibility("hidden"))) for WP11_LOCAL, which PE/COFF
does not support, so every WP11_LOCAL function definition warned
"visibility attribute not supported in this configuration; ignored"
and builds from git, which use -Werror, failed.

Check the Windows targets before HAVE_VISIBILITY, as wolfSSL and
wolfTPM already do, and include CYGWIN in that check.

The newlib ctype.h used by Cygwin and MSYS2 also warns when isdigit()
is given a plain char, which broke the pkcs11mtt build. Cast the
argument to unsigned char there and in the two tests that cast it to
int, which only hid the warning.

Also adds a new CI test so we don't hit this again in future.

Fixes #223

The gnulib visibility probe in configure passes for Windows GCC
targets (Cygwin, MSYS2 and MinGW-w64) because it never defines a
symbol with an explicit hidden attribute. visibility.h then used
__attribute__((visibility("hidden"))) for WP11_LOCAL, which PE/COFF
does not support, so every WP11_LOCAL function definition warned
"visibility attribute not supported in this configuration; ignored"
and builds from git, which use -Werror, failed.

Check the Windows targets before HAVE_VISIBILITY, as wolfSSL and
wolfTPM already do, and include __CYGWIN__ in that check.

The newlib ctype.h used by Cygwin and MSYS2 also warns when isdigit()
is given a plain char, which broke the pkcs11mtt build. Cast the
argument to unsigned char there and in the two tests that cast it to
int, which only hid the warning.

Fixes wolfSSL#223
Build wolfPKCS11 on Windows with MSYS2 so Windows GCC regressions such
as wolfSSL#223 are caught in CI:

- msys-shared: MSYS2's POSIX (Cygwin-based) gcc, full build
- msys-static: same toolchain, static build with make check
- ucrt64-shared: native MinGW-w64 gcc, library only as the tests and
  examples do not yet build with MinGW
Copilot AI balanced review requested due to automatic review settings October 6, 2026 10:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The visibility fix is targeted, portability corrections are valid, and the new workflow covers the affected toolchains.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes GCC visibility handling for Windows targets and adds MSYS2 build coverage.

Changes:

  • Prioritizes Windows import/export handling over visibility attributes.
  • Corrects isdigit() arguments to avoid undefined behavior.
  • Adds MSYS2, static, and MinGW CI builds.
File Description
wolfpkcs11/​visibility.h Handles MinGW and Cygwin visibility correctly.
tests/​pkcs11v3test.c Safely casts input for isdigit().
tests/​pkcs11test.c Safely casts input for isdigit().
tests/​pkcs11mtt.c Safely casts input for isdigit().
.github/​workflows/​msys2.yml Adds MSYS2 and MinGW build coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error: visibility attribute not supported in this configuration; ignored [-Werror=attributes]

3 participants