aix: add required changes to build with clang#62656
Open
abmusse wants to merge 5 commits intonodejs:mainfrom
Open
aix: add required changes to build with clang#62656abmusse wants to merge 5 commits intonodejs:mainfrom
abmusse wants to merge 5 commits intonodejs:mainfrom
Conversation
Some gcc flags dont work on clang: -mfprnd -mno-popcntb -fno-extern-tls-init So now we conditionally add them when clang is not enabled Also for clang builds we need to pass some additonal flags: -fno-integrated-as -fno-xl-pragma-pack These flags are discuessed in: https://chromium-review.googlesource.com/c/chromium/src/+/7120638
to header files not shipping declarations. This seems like a bug in AIX header files because the examples show including the headers but upon inspecting these files there are no declarations for sendmmsg and others: https://www.ibm.com/docs/en/aix/7.2.0?topic=s-sendmmsg-subroutine For now we can claim to not have these functions. Alternatively we can declare these ourselves if we are AIX 7.2 or newer. The actual functions look to be available in libc. GCC also has the same implicit function declaration but it happily moves forward. Clang started making this an explict error in clang 16: https://www.redhat.com/en/blog/new-warnings-and-errors-clang-16
Original commit message: aix: add required changes to build with clang Change-Id: Icc78c58831306aa2f227843b0b4ec2321585fa64 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7107287 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/main@{#104364}
visibility for symbols.
Without these changes we are getting back linker errors
AIX with clang builds:
```text
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
recomendation 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
in create_expfile.sh AIX export files support the `weak` keyword to mark weak symbols. ref: https://www.ibm.com/docs/en/aix/7.2.0?topic=l-ld-command#ld__a3119106d This helps preserve C++ weak symbol semantics and preventing potential linker conflicts.
Collaborator
|
Review requested:
|
richardlau
reviewed
Apr 9, 2026
| #if defined(_AIX) && !defined(_AIX72) | ||
| /* AIX >= 7.2 provides sendmmsg() and recvmmsg(). */ | ||
| #if defined(_AIX) | ||
| /* Force fallback to sndmsg and recvmsg */ |
Member
There was a problem hiding this comment.
This needs to be made upstream as otherwise it's going to get reverted every OpenSSL upgrade we take: https://github.com/openssl/openssl/blob/72d5e8dcd2977234e47e840d2173917daa8bb0fa/crypto/bio/bss_dgram.c#L71-L72
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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:
Confirm the changes in this PR doesn't break gcc builds (Node.js 24, 22, 20 still use it), then merge this PR
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-initThese are now conditionally added only when Clang is not enabled.
For Clang builds, we need additional flags:
-fno-integrated-as-fno-xl-pragma-packThese 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
sendmmsgand 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:
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:
Not including hidden symbols in the export files matches the recommendation by XLC documentation:
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
weakkeyword to mark weak symbols. According to IBM documentation:ref: https://www.ibm.com/docs/en/aix/7.2.0?topic=l-ld-command#ld__a3119106d
This helps preserve C++ weak symbol semantics and preventing potential linker conflicts.