Bug 268363 - www/node16+: needs wxneeded
Summary: www/node16+: needs wxneeded
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Juraj Lutter
URL: https://github.com/nodejs/node/issues...
Keywords:
Depends on:
Blocks: 261952
  Show dependency treegraph
 
Reported: 2022-12-14 00:20 UTC by Mina Galić
Modified: 2024-03-08 12:19 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (otis)


Attachments
Patch for www/node*/Makefile adding USES+=elfctl and ELF_FEATURES=+wxneeded:out/Release/node (2.94 KB, patch)
2024-03-06 07:34 UTC, Trond Endrestøl
no flags Details | Diff
Revised patch adding new functionality to Mk/Uses/elfctl.mk for tagging files post-stage relative to ${STAGEDIR} (4.26 KB, patch)
2024-03-08 12:19 UTC, Trond Endrestøl
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mina Galić freebsd_triage 2022-12-14 00:20:47 UTC
Starting 16.11.1: https://github.com/nodejs/node/issues/40467 node upgraded v8, which now makes some interesting JIT optimisations which require wxneeded flag to be set.

ELF_FEATURES= +wxneeded:bin/node

should *probably* do it.
Comment 1 Trond Endrestøl 2024-03-06 07:34:54 UTC
Created attachment 248962 [details]
Patch for www/node*/Makefile adding USES+=elfctl and ELF_FEATURES=+wxneeded:out/Release/node

I stumbled upon this bug report yesterday and thought I should contribute a patch. PORTREVISION should probably be bumped, it's not done by this patch given it's unknown if and when this patch will be committed.
Comment 2 Trond Endrestøl 2024-03-08 11:11:25 UTC
(In reply to Trond Endrestøl from comment #1)

There's one snag, while elfctl(1) is indeed run at the of the build phase:

if [ ! -r node ] || [ ! -L node ]; then \
  ln -fs out/Release/node node; fi
elfctl -i -e +wxneeded /construction/xports/www/node18/work/node-v18.19.1/out/Release/node

This act is overwritten during the stage phase when the main executable is relinked:

--------------------------------------------------------------------------------
--  Phase: stage
--------------------------------------------------------------------------------
===>  Staging for node18-18.19.1
===>   Generating temporary packing list
gmake -C out BUILDTYPE=Release V=0
[...]
  c++ -o /construction/xports/www/node18/work/node-v18.19.1/out/Release/node -pthread -rdynamic -Wl,--export-dynamic /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/node_text_start/src/large_pages/node_text_start.o -Wl,--whole-archive /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/libnode.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/v8_gypfiles/libv8_base_without_compiler.a -Wl,--no-whole-archive -Wl,-z,noexecstack -Wl,--whole-archive /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a -Wl,--no-whole-archive -Wl,-z,relro -Wl,-z,now -m64   -fstack-protector-strong  -Wl,--start-group /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/node/src/node_main.o /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/node/gen/node_snapshot.o /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/deps/histogram/libhistogram.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/deps/uvwasi/libuvwasi.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/libnode.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/libnode_text_start.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/v8_gypfiles/libv8_libplatform.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/icu/libicui18n.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/deps/llhttp/libllhttp.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/deps/base64/libbase64.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/deps/base64/libbase64_ssse3.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/deps/base64/libbase64_sse41.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/deps/base64/libbase64_sse42.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/deps/base64/libbase64_avx.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/deps/base64/libbase64_avx2.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/deps/simdutf/libsimdutf.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/deps/ada/libada.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/icu/libicuucx.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/icu/libicudata.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/v8_gypfiles/libv8_base_without_compiler.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/v8_gypfiles/libv8_libbase.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/v8_gypfiles/libv8_zlib.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/v8_gypfiles/libv8_compiler.a /construction/xports/www/node18/work/node-v18.19.1/out/Release/obj.target/tools/v8_gypfiles/libv8_initializers.a -L/lib -lz -L/usr/local/lib -luv -lbrotlidec -lbrotlienc -lcares -lnghttp2 -lcrypto -lssl -lutil -lkvm -L/usr/local/lib -lexecinfo -Wl,--end-group

In other words, some ports needs to apply elfctl(1) post-stage instead of post-build.
Comment 3 Trond Endrestøl 2024-03-08 12:19:43 UTC
Created attachment 249024 [details]
Revised patch adding new functionality to Mk/Uses/elfctl.mk for tagging files post-stage relative to ${STAGEDIR}