Title: [281758] trunk/Source/_javascript_Core
Revision
281758
Author
[email protected]
Date
2021-08-30 08:55:33 -0700 (Mon, 30 Aug 2021)

Log Message

resolve-asm-file-conflicts.rb build failure after upgrade to CMake 3.21.0; DWARF 5 incompatibility
https://bugs.webkit.org/show_bug.cgi?id=228267

Reviewed by Adrian Perez de Castro.

Implement the fix suggested by Adrian Vovk: any .file 0 directive
should pass through unchanged.

While here
- if the file path is an absolute path, don't concat it with the working directory
- also accept 'md5 0xhash' in the .file directive.

* Scripts/resolve-asm-file-conflicts.rb:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (281757 => 281758)


--- trunk/Source/_javascript_Core/ChangeLog	2021-08-30 15:11:39 UTC (rev 281757)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-08-30 15:55:33 UTC (rev 281758)
@@ -1,3 +1,19 @@
+2021-08-30  Angelos Oikonomopoulos  <[email protected]>
+
+        resolve-asm-file-conflicts.rb build failure after upgrade to CMake 3.21.0; DWARF 5 incompatibility
+        https://bugs.webkit.org/show_bug.cgi?id=228267
+
+        Reviewed by Adrian Perez de Castro.
+
+        Implement the fix suggested by Adrian Vovk: any .file 0 directive
+        should pass through unchanged.
+
+        While here
+        - if the file path is an absolute path, don't concat it with the working directory
+        - also accept 'md5 0xhash' in the .file directive.
+
+        * Scripts/resolve-asm-file-conflicts.rb:
+
 2021-08-30  Zan Dobersek  <[email protected]>
 
         RISCV64 support in LLInt

Modified: trunk/Source/_javascript_Core/Scripts/resolve-asm-file-conflicts.rb (281757 => 281758)


--- trunk/Source/_javascript_Core/Scripts/resolve-asm-file-conflicts.rb	2021-08-30 15:11:39 UTC (rev 281757)
+++ trunk/Source/_javascript_Core/Scripts/resolve-asm-file-conflicts.rb	2021-08-30 15:55:33 UTC (rev 281758)
@@ -60,7 +60,7 @@
 ParseResultSuccess = Struct.new(:str)
 ParseResultError = Struct.new(:error)
 
-# Parses the single string literal following a .file assembler directive
+# Parses whatever follows a .file assembler directive
 class FileDirectiveArgScanner
   def initialize(s)
     @s = StringScanner.new(s)
@@ -83,10 +83,22 @@
     if ret2.respond_to?(:error)
       return ret2
     end
+    @s.skip(/\s*/)
     if not @s.eos?
-      return ParseResultError.new("Expected end of line after #{ret2.str}")
+      md5 = parse_md5
+      if md5.respond_to?(:error)
+        return ParseResultError.new("Expected end of line or md5, not `#{@s.rest}`")
+      end
     end
-    return ParseResultSuccess.new((Pathname.new(ret1.str) / ret2.str).cleanpath.to_s)
+    @s.skip(/\s*/)
+    if not @s.eos?
+       return ParseResultError.new("Expected end of line, not `#{@s.rest}`")
+    end
+    filepath = Pathname.new(ret2.str)
+    if not filepath.absolute?
+      filepath = Pathname.new(ret1.str) / ret2.str
+    end
+    return ParseResultSuccess.new(filepath.cleanpath.to_s)
   end
   def parse_string_literal
     if @s.scan(/"/).nil?
@@ -123,6 +135,14 @@
       raise "Internal error (#{@s.inspect})"
     end
   end
+  def parse_md5
+      md5 = @s.scan(/md5\s+(0x)?\h+/)
+      if md5.nil?
+          ParseResultError.new("Could not parse md5 at pos #{@s.pos} in #{@s.string}")
+      else
+          ParseResultSuccess.new(md5)
+      end
+  end
 end
 
 def test(outf, str, res)
@@ -190,6 +210,9 @@
     # Can parse two string literals
     ['"working_directory" "path"', ['working_directory/path']],
 
+    # Will not concatenate the working directory to an absolute path
+    ['"working_directory" "/path"', ['/path']],
+
     # Will only accept up to 2 string literals
     ['"first" "second" "third"', "Expected end of line"],
 
@@ -200,8 +223,14 @@
     ['"foo" "bar"baz', "Expected end of line"],
 
     # Can detect unterminated 3rd string literal
-    ['"foo" "bar" "baz', "Expected end of line"]
+    ['"foo" "bar" "baz', "Expected end of line"],
 
+    # Can parse md5
+    ['"foo" "bar" md5 0xabcde0123456789', ['foo/bar']],
+
+    # Can parse md5 without 0x prefix
+    ['"foo" "bar" md5 abcde0123456789', ['foo/bar']]
+
   ]
   outf = StringIO.new("")
   tests.each { |str, res|
@@ -376,6 +405,7 @@
     @outf.puts("#{md[:white1]}.loc#{md[:white2]}#{slot}#{md[:rest]}")
   end
   def file_directive(md)
+    slot = md[:slot].to_i
     tracker = @trackers.last
 
     pr = FileDirectiveArgScanner.new(md[:rest]).parse
@@ -385,9 +415,11 @@
     end
 
     path = pr.str
-    tracker.register_path(path, md[:slot].to_i)
 
-    slot = tracker.slot_for_path(path)
+    if slot != 0
+      tracker.register_path(path, slot)
+      slot = tracker.slot_for_path(path)
+    end
     @outf.puts("\t.file\t#{slot} #{md[:rest]}")
   end
 end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to