| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Commit 938212f added -msign-return-address=all to _all_ cflags but that is wrong when cross-compiling, it should only be added to the target's cflags. The flag being deprecated, it is also changed to `-mbranch-protection=standard`. Fixes: nodejs#42888 Co-Authored-By: Michaël Zasso <targos@protonmail.com>
|
Review requested:
|
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Commit 938212f added -msign-return-address=all to _all_ cflags but that is wrong when cross-compiling, it should only be added to the target's cflags. The flag being deprecated, it is also changed to `-mbranch-protection=standard`. Fixes: #42888 Co-Authored-By: Michaël Zasso <targos@protonmail.com> PR-URL: #51256 Fixes: nodejs/build#3319 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
|
I've tried cross compiling node 21.7.2, which has this patch, on x86_64 targetting aarch64. The build fails: g++ -MMD -MF obj.host/tools/node_js2c.js2c.o.d -D_GLIBCXX_USE_CXX11_ABI=1 -DNODE_OPENSSL_CONF_NAME=nodejs_conf -DNODE_OPENSSL_HAS_QUIC -DICU_NO_USER_DATA_OVERRIDE -D__STDC_FORMAT_MACROS -DOPENSSL_NO_PINSHARED -DOPENSSL_THREADS -DNODE_JS2C_USE_STRING_LITERALS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_POSIX_C_SOURCE=200112 -I../../tools -I../../src -I../../deps/simdutf -I../../deps/uv/include -Wall -Wextra -Wno-unused-parameter -mbranch-protection=standard -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++17 -c ../../tools/js2c.cc -o obj.host/tools/node_js2c.js2c.o g++: error: unrecognized command-line option ‘-mbranch-protection=standard’ If I remove the node.gyp changes it succeeds, presumably without any branch protection. |
Sorry, something went wrong.
This means you are using a compiler earlier than gcc 9 -- -mbranch-protection was added to gcc 9 and later. |
Sorry, something went wrong.
|
Hi @richardlau, thanks for looking at this.
I thought this too, but I double-checked and I'd built GCC13. It seems like the build is trying to use the host gcc (it's passing -m64 rather than e.g. armv8-a) which why I'm surprised it's also trying to pass the aarch64 options too. |
Sorry, something went wrong.
|
Do you have CXX (pointing to the cross compiler) and CXX.host (host compiler) environment variables set? |
Sorry, something went wrong.
|
Hi @richardlau, I was using: CC=aarch64-linux-gcc CXX=aarch64-linux-g++ CC_host="gcc" CXX_host="g++" ./configure --dest-os linux --dest-cpu arm64 make -j16 |
Sorry, something went wrong.
Sorry, something went wrong.
|
I was able to cross-compile for ARM64 on my x64 machine with #52559. Here are the commands I used: # Setting up the env
export CC_host="gcc"
export CXX_host="g++"
export CC="aarch64-linux-gnu-gcc"
export CXX="aarch64-linux-gnu-g++"
export AS="aarch64-linux-gnu-as"
export LD="aarch64-linux-gnu-ld"
export RANLIB="aarch64-linux-gnu-ranlib"
# Building as a shared library also works with --shared
./configure --dest-cpu arm64 --dest-os linux
# Build it
make -j12 |
Sorry, something went wrong.
|
Thanks a lot @richardlau and @devraymondsh, I got a successful cross-compilation with those patches too. |
Sorry, something went wrong.
Commit 938212f added -msign-return-address=all to _all_ cflags but that is wrong when cross-compiling, it should only be added to the target's cflags. The flag being deprecated, it is also changed to `-mbranch-protection=standard`. Fixes: #42888 Co-Authored-By: Michaël Zasso <targos@protonmail.com> PR-URL: #51256 Fixes: nodejs/build#3319 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
| Back | FazBrowse Home | New Git URL |
Alternative to #45756 (@bnoordhuis)
Commit 938212f added -msign-return-address=all to all cflags but that
is wrong when cross-compiling, it should only be added to the target's
cflags.
The flag being deprecated, it is also changed to
-mbranch-protection=standard.
Fixes: #42888
Fixes: nodejs/build#3319