Skip to content

aix: add required changes to build with clang - #62656

Closed
abmusse wants to merge 6 commits into
nodejs:mainfrom
abmusse:clang-aix-2
Closed

abmusse wants to merge 6 commits into
nodejs:mainfrom
abmusse:clang-aix-2

Conversation

@abmusse

@abmusse abmusse commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

This PR enables building Node.js on AIX with Clang by addressing several issues.

The game plan I have in mind to get AIX building with clang:

  1. Confirm the changes in this PR doesn't break gcc builds (Node.js 24, 22, 20 still use it), then merge this PR

  2. After this PR gets merged, update select compiler to use clang for Node.js 26+ builds
    (I have a draft PR for that here: aix: select clang for Node.26+ builds build#4286)

Changes

1. Add conditional flags for Clang builds

Some GCC flags don't work on Clang:

  • -mfprnd
  • -mno-popcntb
  • -fno-extern-tls-init

These are now conditionally added only when Clang is not enabled.

For Clang builds, we need additional flags:

  • -fno-integrated-as
  • -fno-xl-pragma-pack

These flags are discussed in: https://chromium-review.googlesource.com/c/chromium/src/+/7120638

2. Fix OpenSSL implicit declaration errors

AIX header files don't ship declarations for sendmmsg and related functions, despite documentation showing they should be included. This appears to be a bug in AIX header files.

GCC tolerates implicit function declarations, but Clang 16+ treats them as errors:
https://www.redhat.com/en/blog/new-warnings-and-errors-clang-16

example:

16:55:13 ../deps/openssl/openssl/crypto/bio/bss_dgram.c: In function 'dgram_sendmmsg':
16:55:13 ../deps/openssl/openssl/crypto/bio/bss_dgram.c:1416:11: warning: implicit declaration of function 'sendmmsg'; did you mean 'sendmsg'? [-Wimplicit-function-declaration]
16:55:14  1416 |     ret = sendmmsg(b->num, mh, num_msg, sysflags);
16:55:14       |           ^~~~~~~~
16:55:14       |           sendmsg
16:55:14 ../deps/openssl/openssl/crypto/bio/bss_dgram.c: In function 'dgram_recvmmsg':
16:55:14 ../deps/openssl/openssl/crypto/bio/bss_dgram.c:1609:11: warning: implicit declaration of function 'recvmmsg'; did you mean 'recvmsg'? [-Wimplicit-function-declaration]
16:55:14  1609 |     ret = recvmmsg(b->num, mh, num_msg, sysflags, NULL);
16:55:14       |           ^~~~~~~~
16:55:14       |           recvmsg

ref: https://ci.nodejs.org/job/node-test-commit-aix/nodes=aix72-power9/62022/consoleFull
For now, we claim to not have these functions. The actual functions are available in libc, so an alternative would be to declare them ourselves for AIX 7.2+.

Ref: https://www.ibm.com/docs/en/aix/7.2.0?topic=s-sendmmsg-subroutine

3. Cherry-pick V8 commit for AIX Clang support

Cherry-picked V8 commit 7107287 which adds required changes to build V8 with Clang on AIX.

Original commit: https://chromium-review.googlesource.com/c/v8/v8/+/7107287

4. Filter hidden visibility symbols from export script

Without filtering HIDDEN symbols, AIX Clang builds fail with linker errors:

ld: 0711-407 ERROR: Symbol [SYMBOL_NAME]
        Visibility is not allowed on a reference to an imported symbol.

Not including hidden symbols in the export files matches the recommendation by XLC documentation:

When using export lists, it is not recommended to put symbols with hidden visibility in the lists.

Ref: https://www.ibm.com/docs/en/openxl-c-and-cpp-aix/17.1.4?topic=libraries-symbol-exports-visibilities

5. Add weak symbol detection in create_expfile.sh

AIX export files support the