Bug 223136

Summary: postprocess-asm/resolve-asm-file-conflicts.rb build failure after upgrading to F34
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: JavaScriptCoreAssignee: Angelos Oikonomopoulos <angelos>
Status: RESOLVED FIXED    
Severity: Normal CC: angelos, ews-watchlist, keith_miller, mark.lam, mcatanzaro, msaboff, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
See Also: https://bugs.webkit.org/show_bug.cgi?id=229491
Attachments:
Description Flags
LowLevelInterpreter.cpp.pre.s
none
Patch none

Description Michael Catanzaro 2021-03-12 12:51:45 PST
After upgrading to Fedora 34, I can no longer build successfully unless I configure with -DGCC_OFFLINEASM_SOURCE_MAP=OFF. I modified postprocess-asm a bit to print the command it is running when it fails:

diff --git a/Source/JavaScriptCore/Scripts/postprocess-asm b/Source/JavaScriptCore/Scripts/postprocess-asm
index c2612a426600..d6ac45f0b784 100755
--- a/Source/JavaScriptCore/Scripts/postprocess-asm
+++ b/Source/JavaScriptCore/Scripts/postprocess-asm
@@ -110,7 +110,7 @@ def run_cmd(cmd)
   Process.waitpid(pid)
   ret = $?
   if not ret.success?
-    $stderr.puts("Error running cmd: #{ret}")
+    $stderr.puts("Error running cmd #{cmd}: #{ret}")
     exit(ret.exitstatus)
   end
 end

With that modification, the failure is:

[1089/5397] Building CXX object Source/JavaScriptCore/CMa...owLevelInterpreterLib.dir/llint/LowLevelInterpreter.cpp.o
FAILED: Source/JavaScriptCore/CMakeFiles/LowLevelInterpreterLib.dir/llint/LowLevelInterpreter.cpp.o 
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/Scripts/postprocess-asm /usr/lib64/ccache/c++ -DBUILDING_GTK__=1 -DBUILDING_WITH_CMAKE=1 -DBWRAP_EXECUTABLE=\"/usr/bin/bwrap\" -DDBUS_PROXY_EXECUTABLE=\"/usr/bin/xdg-dbus-proxy\" -DGETTEXT_PACKAGE=\"WebKit2GTK-4.0\" -DHAVE_CONFIG_H=1 -DJSC_COMPILATION -DJSC_GLIB_API_ENABLED -DSVN_REVISION=\"r274366\" -DWEBKITGTK_API_VERSION_STRING=\"4.0\" -DPOSTPROCESS_ASM=llint/LowLevelInterpreter.cpp -IDerivedSources/ForwardingHeaders -I/home/mcatanzaro/Projects/GNOME/install/include/glib-2.0 -I/home/mcatanzaro/Projects/GNOME/install/lib/glib-2.0/include -I. -I../../Source/JavaScriptCore -I../../Source/JavaScriptCore/API -I../../Source/JavaScriptCore/assembler -I../../Source/JavaScriptCore/b3 -I../../Source/JavaScriptCore/b3/air -I../../Source/JavaScriptCore/bindings -I../../Source/JavaScriptCore/builtins -I../../Source/JavaScriptCore/bytecode -I../../Source/JavaScriptCore/bytecompiler -I../../Source/JavaScriptCore/dfg -I../../Source/JavaScriptCore/disassembler -I../../Source/JavaScriptCore/disassembler/ARM64 -I../../Source/JavaScriptCore/disassembler/udis86 -I../../Source/JavaScriptCore/domjit -I../../Source/JavaScriptCore/ftl -I../../Source/JavaScriptCore/heap -I../../Source/JavaScriptCore/debugger -I../../Source/JavaScriptCore/inspector -I../../Source/JavaScriptCore/inspector/agents -I../../Source/JavaScriptCore/inspector/augmentable -I../../Source/JavaScriptCore/inspector/remote -I../../Source/JavaScriptCore/interpreter -I../../Source/JavaScriptCore/jit -I../../Source/JavaScriptCore/llint -I../../Source/JavaScriptCore/parser -I../../Source/JavaScriptCore/profiler -I../../Source/JavaScriptCore/runtime -I../../Source/JavaScriptCore/tools -I../../Source/JavaScriptCore/wasm -I../../Source/JavaScriptCore/wasm/js -I../../Source/JavaScriptCore/yarr -IDerivedSources/JavaScriptCore -IDerivedSources/JavaScriptCore/inspector -IDerivedSources/JavaScriptCore/runtime -IDerivedSources/JavaScriptCore/yarr -IDerivedSources/ForwardingHeaders/JavaScriptCore/glib -IDerivedSources/JavaScriptCore/javascriptcoregtk/jsc -I../../Source/JavaScriptCore/API/glib -I../../Source/JavaScriptCore/inspector/remote/glib -fdiagnostics-color=always -Wextra -Wall -Wno-expansion-to-defined -Wno-noexcept-type -Wno-psabi -Wno-misleading-indentation -Wno-maybe-uninitialized -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wno-tautological-compare -g -O0 -fno-strict-aliasing -fno-exceptions -fno-rtti -O2 -g -DNDEBUG -fPIC -fvisibility=hidden -std=c++17 -MD -MT Source/JavaScriptCore/CMakeFiles/LowLevelInterpreterLib.dir/llint/LowLevelInterpreter.cpp.o -MF Source/JavaScriptCore/CMakeFiles/LowLevelInterpreterLib.dir/llint/LowLevelInterpreter.cpp.o.d -o Source/JavaScriptCore/CMakeFiles/LowLevelInterpreterLib.dir/llint/LowLevelInterpreter.cpp.o -c ../../Source/JavaScriptCore/llint/LowLevelInterpreter.cpp
Error parsing path argument to .file directive: Expected end of line after /home/mcatanzaro/Projects/WebKit/WebKitBuild/GNOME
Error running cmd ["/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/Scripts/resolve-asm-file-conflicts.rb", "Source/JavaScriptCore/CMakeFiles/LowLevelInterpreterLib.dir/llint/LowLevelInterpreter.cpp.pre.s", "Source/JavaScriptCore/CMakeFiles/LowLevelInterpreterLib.dir/llint/LowLevelInterpreter.cpp.s"]: pid 99216 exit 2
ninja: build stopped: subcommand failed.

The most interesting part of that being:

Error parsing path argument to .file directive: Expected end of line after /home/mcatanzaro/Projects/WebKit/WebKitBuild/GNOME

Not sure what's going wrong. These scripts are pretty complex. :)
Comment 1 Angelos Oikonomopoulos 2021-03-15 03:49:10 PDT
Thanks for looking into this! Judging by the error message, I guess the version of gcc on fedora-34 changed the way it's generating the .file assembler directives to .file "path/to/dir" "filename" (which I've seen clang use).

I'll try to reproduce this in a container so I can test a fix.
Comment 2 Angelos Oikonomopoulos 2021-03-15 04:19:38 PDT
(In reply to Angelos Oikonomopoulos from comment #1)
[...]
> I'll try to reproduce this in a container so I can test a fix.

Strange, I can't reproduce this in a F34 container.

Using

gcc-11.0.0-0.20.fc34.x86_64
gcc-c++-11.0.0-0.20.fc34.x86_64

and

 ./Tools/Scripts/build-jsc --jsc-only --debug
Comment 3 Michael Catanzaro 2021-03-15 05:55:28 PDT
I have the same version of GCC. Is there some generated output I should give to help debug?

For what it's worth: builds are succeeding on koji, so there must be some sort of difference between my system vs. the container....
Comment 4 Angelos Oikonomopoulos 2021-03-15 06:19:44 PDT
(In reply to Michael Catanzaro from comment #3)
> I have the same version of GCC. Is there some generated output I should give
> to help debug?
> 
> For what it's worth: builds are succeeding on koji, so there must be some
> sort of difference between my system vs. the container....

Odd. Would love to hear more if you find out what the difference is.

Having LowLevelInterpreter.cpp.pre.s (alternatively, all .file directives from it) should be enough to be able to test a fix.
Comment 5 Angelos Oikonomopoulos 2021-03-15 06:21:54 PDT
(In reply to Angelos Oikonomopoulos from comment #4)
> Having LowLevelInterpreter.cpp.pre.s (alternatively, all .file directives
> from it) should be enough to be able to test a fix.

You probably need to temporarily comment out the call to File.delete(p) towards the end of postprocess-asm to preserve that file.
Comment 6 Michael Catanzaro 2021-03-15 06:41:00 PDT
Created attachment 423173 [details]
LowLevelInterpreter.cpp.pre.s
Comment 7 Michael Catanzaro 2021-03-15 06:42:41 PDT
Looks like the problem is here:

.Ldebug_line0:
	.file 0 "/home/mcatanzaro/Projects/WebKit/WebKitBuild/GNOME" "../../Source/JavaScriptCore/llint/LowLevelInterpreter.cpp"
	.section	.debug_str,"MS",@progbits,1

Two strings on the same line. That seems to be the only place in the file where this happens.
Comment 8 Angelos Oikonomopoulos 2021-03-15 07:41:01 PDT
Created attachment 423180 [details]
Patch
Comment 9 Angelos Oikonomopoulos 2021-03-15 07:49:39 PDT
Does this patch fix it?
Comment 10 Michael Catanzaro 2021-03-15 08:45:41 PDT
Comment on attachment 423180 [details]
Patch

That works, thanks!
Comment 11 EWS 2021-03-15 10:38:48 PDT
Committed r274428: <https://commits.webkit.org/r274428>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 423180 [details].
Comment 12 Radar WebKit Bug Importer 2021-03-15 10:39:16 PDT
<rdar://problem/75435823>