Visitar URL original
aix: add required changes to build with clang by abmusse · Pull Request #62656 · nodejs/node · GitHub
Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
aix: fix export script to filter hidden ...
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
  • Loading branch information
abmusse committed Apr 9, 2026
commit 6285b67e35cde4e18c905aeeb31fd6e6fc4a9ebb
31 changes: 24 additions & 7 deletions tools/create_expfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,35 @@
# Symbols for the gtest libraries are excluded as
# they are not linked into the node executable.
#
set -x
echo "Searching $1 to write out expfile to $2"

# This special sequence must be at the start of the exp file.
echo "#!." > "$2.tmp"

# Pull the symbols from the .a files.
find "$1" -name "*.a" | grep -v gtest \
| xargs nm -Xany -BCpg \
| awk '{
if ((($2 == "T") || ($2 == "D") || ($2 == "B")) &&
(substr($3,1,1) != ".")) { print $3 }
}' \
| sort -u >> "$2.tmp"
# Use dump -tov to get visibility information and exclude HIDDEN symbols
# This prevents AIX linker error 0711-407 when addons try to import symbols
# with visibility attributes.
find "$1" -name "*.a" | grep -v gtest | while read f; do
dump -tov -X 32_64 "$f" 2>/dev/null | \
awk '
BEGIN {
V["EXPORTED"]=" export"
V["PROTECTED"]=" protected"
V["HIDDEN"]=" hidden"
}
/^\[[0-9]+\]\tm +[^ ]+ +\.(text|data|tdata|bss) +[^ ]+ +(extern|weak) +(EXPORTED|PROTECTED|HIDDEN| ) / {
# Exclude symbols starting with dot, __sinit, __sterm, __[0-9]+__
# Also exclude HIDDEN symbols to avoid visibility attribute issues
if (!match($NF,/^(\.|__sinit|__sterm|__[0-9]+__)/)) {
visibility = $(NF-1)
if (visibility != "HIDDEN") {
print $NF
}
}
}
'
done | sort -u >> "$2.tmp"

mv -f "$2.tmp" "$2"