Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 15 build fails with LTO enabled #35957

Closed
astefanutti opened this issue Nov 4, 2020 · 7 comments
Closed

Node 15 build fails with LTO enabled #35957

astefanutti opened this issue Nov 4, 2020 · 7 comments
Labels
build Issues and PRs related to build files or the CI. linux Issues and PRs related to the Linux platform.

Comments

@astefanutti
Copy link

Node 15.0.1 build fails when LTO is enabled with the following message:

/tmp/ccikGPmp.s: Assembler messages:
/tmp/ccikGPmp.s:26: Error: symbol `PushAllRegistersAndIterateStack' is already defined
make[2]: *** [/tmp/ccdIdoeH.mk:2: /tmp/node.aneJAa.ltrans0.ltrans.o] Error 1
make[2]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.

The build with same configuration used to be successful for Node 14.x and previous versions.

It seems related to the v8 version upgrade from 8.4 to 8.6. It may be the PushAllRegistersAndIterateStack assembly gets inlined multiple times, which leads to duplicated symbols in the LTO compilation unit.

  • Version: 15.0.1
  • Platform: Linux

What steps will reproduce the bug?

$ ./configure --enable-lto && make -j$(getconf _NPROCESSORS_ONLN) V=
@PoojaDurgad PoojaDurgad added the build Issues and PRs related to build files or the CI. label Nov 4, 2020
@tniessen
Copy link
Member

tniessen commented Nov 4, 2020

Which Linux distribution and which kernel are you using? Which C/C++ toolchain (compiler, linker, etc.) are you using?

@tniessen tniessen added the linux Issues and PRs related to the Linux platform. label Nov 4, 2020
@astefanutti
Copy link
Author

Which Linux distribution and which kernel are you using? Which C/C++ toolchain (compiler, linker, etc.) are you using?

Linux 4.19.88
GCC 9.2.0
Musl 1.2.0
GNU gold (GNU Binutils 2.33.1) 1.16

@tniessen
Copy link
Member

tniessen commented Nov 5, 2020

cc @nodejs/build-files

@lyu
Copy link

lyu commented Nov 25, 2020

Same thing here when --enable-lto is added, tested with the latest 15.3.0 release.

Linux 3.10.0 (CentOS 7.8.2003 x86_64)
GCC 10.2.0
glibc 2.17
binutils 2.35.1

14.15.1 compiles fine with --enable-lto.

@sapics
Copy link
Contributor

sapics commented Mar 19, 2021

Same thing here with latest master branch.

--- Environment ---
Ubuntu 20.04 (Linux Kernel: 5.4)
GCC 10.2.0
glibc 2.31
binutils 2.34

gengjiawen pushed a commit that referenced this issue Apr 29, 2021
"PushAllRegistersAndIterateStack" is implemented in assembly and
called from "stack.cc" via 'extern "C"'. [1]

However, LTO does not work well with symbol usage from assembly. [2]

This change workarounds the issue by disabling LTO for the target.

With GCC 10 and "./configure --enable-lto", compilation succeeds
after this change.

[1] v8/v8@c10863153
[2] https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ#Symbol_usage_from_assembly_language

Refs: #35957
Refs: #38335
Signed-off-by: Jesse Chan <[email protected]>

PR-URL: #38346
Refs: #35957
Refs: #38335
Reviewed-By: Khaidi Chu <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
@gengjiawen
Copy link
Member

landed in master.

targos pushed a commit that referenced this issue Apr 29, 2021
"PushAllRegistersAndIterateStack" is implemented in assembly and
called from "stack.cc" via 'extern "C"'. [1]

However, LTO does not work well with symbol usage from assembly. [2]

This change workarounds the issue by disabling LTO for the target.

With GCC 10 and "./configure --enable-lto", compilation succeeds
after this change.

[1] v8/v8@c10863153
[2] https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ#Symbol_usage_from_assembly_language

Refs: #35957
Refs: #38335
Signed-off-by: Jesse Chan <[email protected]>

PR-URL: #38346
Refs: #35957
Refs: #38335
Reviewed-By: Khaidi Chu <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
@sapics
Copy link
Contributor

sapics commented May 6, 2021

Thanks! Build was successful in master branch with --enable-lto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. linux Issues and PRs related to the Linux platform.
Projects
None yet
Development

No branches or pull requests

6 participants