Skip to content

Commit

Permalink
tools: disable LTO for "v8_cppgc_shared" target
Browse files Browse the repository at this point in the history
"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 <jc@linux.com>

PR-URL: #38346
Refs: #35957
Refs: #38335
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
  • Loading branch information
jesec authored and targos committed Apr 29, 2021
1 parent 3cbfde1 commit bec959e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,9 @@
'<(V8_ROOT)/src/heap/base/worklist.h',
],
'conditions': [
['enable_lto=="true"', {
'cflags_cc': [ '-fno-lto' ],
}],
['clang or OS!="win"', {
'conditions': [
['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
Expand Down

1 comment on commit bec959e

@atoomic
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with this fix I'm still viewing the issue on Ubuntu 22 using gcc 11 #44195
I'm not sure what's the best way to fix it for gcc11

Please sign in to comment.