Bug 230061 - Unbreak GCC_OFFLINEASM_SOURCE_MAP when LTO is in use
Summary: Unbreak GCC_OFFLINEASM_SOURCE_MAP when LTO is in use
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Angelos Oikonomopoulos
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-08 13:45 PDT by Michael Catanzaro
Modified: 2021-09-17 13:04 PDT (History)
17 users (show)

See Also:


Attachments
Patch (3.24 KB, patch)
2021-09-17 10:20 PDT, Angelos Oikonomopoulos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2021-09-08 13:45:16 PDT
With:

-DCMAKE_C_FLAGS="-flto=auto" -DCMAKE_CXX_FLAGS="-flto=auto" -DGCC_OFFLINEASM_SOURCE_MAP=ON

gcc-11.2.1-1.fc34, and cmake-3.20.5-1.fc34, JavaScriptCore fails to link successfully. 

The full error message is:

/tmp/cchYjCtn.s: Assembler messages:
/tmp/cchYjCtn.s:23: Error: file table slot 1 is already occupied by a different file (../../Source/JavaScriptCore/llint/LowLevelInterpreter.cpp vs /home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/llint/LowLevelInterpreter.asm)
/tmp/cchYjCtn.s:103670: Error: file table slot 2 is already occupied by a different file (/home/mcatanzaro/Projects/WebKit/WebKitBuild/GNOME/JavaScriptCore/DerivedSources/InitBytecodes.asm vs ../../Source/JavaScriptCore/heap/SlotVisitorInlines.h)
/tmp/cchYjCtn.s:103689: Error: file table slot 3 is already occupied by a different file (/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm vs WTF/Headers/wtf/Atomics.h)
/tmp/cchYjCtn.s:103697: Error: file table slot 4 is already occupied by a different file (/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm vs ../../Source/JavaScriptCore/heap/HeapCellInlines.h)
/tmp/cchYjCtn.s:103702: Error: file table slot 5 is already occupied by a different file (/home/mcatanzaro/Projects/WebKit/WebKitBuild/GNOME/JavaScriptCore/DerivedSources/InitWasm.asm vs ../../Source/JavaScriptCore/heap/PreciseAllocation.h)
/tmp/cchYjCtn.s:103728: Error: file table slot 6 is already occupied by a different file (/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/llint/WebAssembly.asm vs ../../Source/JavaScriptCore/heap/MarkedBlock.h)
make: *** [/tmp/ccrXP4o0.mk:2: /tmp/cctehSRQ.ltrans0.ltrans.o] Error 1
make: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/bin/ld.gold: fatal error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Notice this occurs when called by lto-wrapper. The build works fine when LTO is disabled.

In case it matters (unlikely), my full CMake command line is:

jhbulid run cmake -DCMAKE_C_FLAGS="-flto=auto" -DCMAKE_CXX_FLAGS="-flto=auto" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPORT=GTK -DDEVELOPER_MODE=ON -DGCC_OFFLINEASM_SOURCE_MAP=ON -DCMAKE_INSTALL_PREFIX=$HOME/Projects/GNOME/install/ -DCMAKE_INSTALL_LIBDIR=lib -GNinja

When this bug is fixed, please also reenable the GCC_OFFLINEASM_SOURCE_MAP feature by reverting the patch in bug #229893!
Comment 1 Radar WebKit Bug Importer 2021-09-15 13:46:15 PDT
<rdar://problem/83166173>
Comment 2 Angelos Oikonomopoulos 2021-09-17 10:20:51 PDT
Created attachment 438488 [details]
Patch
Comment 3 Angelos Oikonomopoulos 2021-09-17 10:22:23 PDT
Thanks for the clear instructions on how to reproduce Michael! Uploaded a simple workaround, would be great if you could verify it fixes things for you.
Comment 4 Michael Catanzaro 2021-09-17 12:55:44 PDT
Comment on attachment 438488 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=438488&action=review

Tested this. It works. Thanks Angelos!

> Source/JavaScriptCore/CMakeLists.txt:1472
> +        COMPILE_OPTIONS "-fno-lto")

OK, I was going to whine that you need to check if the option is supported, but this is within a CMAKE_COMPILER_IS_GNUCXX guard so no need.
Comment 5 EWS 2021-09-17 13:03:57 PDT
Committed r282685 (241824@main): <https://commits.webkit.org/241824@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 438488 [details].