RESOLVED FIXED 157364
Enable Dwarf2 debug information in offline assembler for clang compiler
https://bugs.webkit.org/show_bug.cgi?id=157364
Summary Enable Dwarf2 debug information in offline assembler for clang compiler
Michael Saboff
Reported 2016-05-04 15:48:30 PDT
Change set r196541 added the output of Dwarf2 debugging directives to the offline assembler, but disabled the feature until the appropriate support was added to the C++ compiler. That support was added to Clang version 800.0.12 and later. We should detect that we're compiling with the appropriate clang compiler version and enable the output of the Dwarf2 directives.
Attachments
Patch (2.18 KB, patch)
2016-05-04 16:39 PDT, Michael Saboff
no flags
Radar WebKit Bug Importer
Comment 1 2016-05-04 15:50:11 PDT
Michael Saboff
Comment 2 2016-05-04 16:39:30 PDT
Mark Lam
Comment 3 2016-05-04 16:42:11 PDT
Comment on attachment 278143 [details] Patch rs=me
WebKit Commit Bot
Comment 4 2016-05-04 18:06:21 PDT
Comment on attachment 278143 [details] Patch Clearing flags on attachment: 278143 Committed r200447: <http://trac.webkit.org/changeset/200447>
WebKit Commit Bot
Comment 5 2016-05-04 18:06:25 PDT
All reviewed patches have been landed. Closing bug.
mitz
Comment 6 2016-05-04 20:15:08 PDT
Comment on attachment 278143 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=278143&action=review > Source/JavaScriptCore/offlineasm/config.rb:66 > + clangExecutable = ENV['TOOLCHAIN_DIR'] + '/usr/bin/clang' > + if File.executable?(clangExecutable) > + clangVersionOut = %x`#{clangExecutable} --version` The canonical way to find and invoke clang from a script running in Xcode would be simply `xcrun clang --version`
Csaba Osztrogonác
Comment 7 2016-05-05 03:54:27 PDT
(In reply to comment #4) > Comment on attachment 278143 [details] > Patch > > Clearing flags on attachment: 278143 > > Committed r200447: <http://trac.webkit.org/changeset/200447> It broke the Apple Mac Yosemite build: (see build.webkit.org for details) /Volumes/Data/slave/yosemite-release/build/Source/JavaScriptCore/offlineasm/config.rb:64:in `shouldEnableDebugAnnotations': undefined method `+' for nil:NilClass (NoMethodError) from /Volumes/Data/slave/yosemite-release/build/Source/JavaScriptCore/offlineasm/config.rb:83:in `<top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /Volumes/Data/slave/yosemite-release/build/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb:28:in `<main>' Command /bin/sh failed with exit code 1
Csaba Osztrogonác
Comment 8 2016-05-05 04:03:41 PDT
Comment on attachment 278143 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=278143&action=review > Source/JavaScriptCore/offlineasm/config.rb:74 > + # clang version 800.0.12 or higher is required for debug annotations > + versionMatch = /clang-(\d+).(\d+).(\d+)/.match(clangVersionOut) > + if versionMatch.length >= 4 > + totalVersion = versionMatch[1].to_i * 1000000 + versionMatch[2].to_i * 1000 + versionMatch[3].to_i > + if totalVersion >= 800000012 > + return true > + end It is not platform independent at all, it is a Mac only code. There is no GCC_VERSION, no TOOLCHAIN_DIR on non Mac platforms, no similar clang versions like this. Some Linux examples for clang --version. $ clang --version Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4) Target: x86_64-pc-linux-gnu Thread model: posix $ clang --version Ubuntu clang version 3.6.2-1 (tags/RELEASE_362/final) (based on LLVM 3.6.2) Target: x86_64-pc-linux-gnu Thread model: posix
Csaba Osztrogonác
Comment 9 2016-05-05 07:51:18 PDT
(In reply to comment #7) > (In reply to comment #4) > > Comment on attachment 278143 [details] > > Patch > > > > Clearing flags on attachment: 278143 > > > > Committed r200447: <http://trac.webkit.org/changeset/200447> > > It broke the Apple Mac Yosemite build: > (see build.webkit.org for details) > > /Volumes/Data/slave/yosemite-release/build/Source/JavaScriptCore/offlineasm/ > config.rb:64:in `shouldEnableDebugAnnotations': undefined method `+' for > nil:NilClass (NoMethodError) > from > /Volumes/Data/slave/yosemite-release/build/Source/JavaScriptCore/offlineasm/ > config.rb:83:in `<top (required)>' > from > /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/ > rubygems/core_ext/kernel_require.rb:55:in `require' > from > /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/ > rubygems/core_ext/kernel_require.rb:55:in `require' > from > /Volumes/Data/slave/yosemite-release/build/Source/JavaScriptCore/offlineasm/ > generate_offset_extractor.rb:28:in `<main>' > Command /bin/sh failed with exit code 1 After checking the Yosemite build logs, it seems there is no TOOLCHAIN_DIR env, only DT_TOOLCHAIN_DIR.
mitz
Comment 10 2016-05-05 08:21:35 PDT
(In reply to comment #9) > (In reply to comment #7) > > (In reply to comment #4) > > > Comment on attachment 278143 [details] > > > Patch > > > > > > Clearing flags on attachment: 278143 > > > > > > Committed r200447: <http://trac.webkit.org/changeset/200447> > > > > It broke the Apple Mac Yosemite build: > > (see build.webkit.org for details) > > > > /Volumes/Data/slave/yosemite-release/build/Source/JavaScriptCore/offlineasm/ > > config.rb:64:in `shouldEnableDebugAnnotations': undefined method `+' for > > nil:NilClass (NoMethodError) > > from > > /Volumes/Data/slave/yosemite-release/build/Source/JavaScriptCore/offlineasm/ > > config.rb:83:in `<top (required)>' > > from > > /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/ > > rubygems/core_ext/kernel_require.rb:55:in `require' > > from > > /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/ > > rubygems/core_ext/kernel_require.rb:55:in `require' > > from > > /Volumes/Data/slave/yosemite-release/build/Source/JavaScriptCore/offlineasm/ > > generate_offset_extractor.rb:28:in `<main>' > > Command /bin/sh failed with exit code 1 > > After checking the Yosemite build logs, it seems > there is no TOOLCHAIN_DIR env, only DT_TOOLCHAIN_DIR. Relying on either variable, or on the path to clang relative to it, isn’t the right thing to do. As I’ve mentioned above, xcrun is the right way to invoke clang. If this script is shared with non-Xcode build systems, then it’s probably best for the script itself to use the CC environment variable, and for the Xcode script build phase that invokes it to set that variable (if not already set) to the output of "xcrun -find clang".
Michael Saboff
Comment 11 2016-05-05 09:35:59 PDT
Looking at the build breakage now.
Michael Saboff
Comment 12 2016-05-05 10:15:15 PDT
Landed build fix in change set r200458: <http://trac.webkit.org/changeset/200458>
Michael Saboff
Comment 13 2016-05-05 10:16:33 PDT
(In reply to comment #8) > Comment on attachment 278143 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=278143&action=review > > > Source/JavaScriptCore/offlineasm/config.rb:74 > > + # clang version 800.0.12 or higher is required for debug annotations > > + versionMatch = /clang-(\d+).(\d+).(\d+)/.match(clangVersionOut) > > + if versionMatch.length >= 4 > > + totalVersion = versionMatch[1].to_i * 1000000 + versionMatch[2].to_i * 1000 + versionMatch[3].to_i > > + if totalVersion >= 800000012 > > + return true > > + end > > It is not platform independent at all, it is a Mac only code. > There is no GCC_VERSION, no TOOLCHAIN_DIR on non Mac platforms, > no similar clang versions like this. > > Some Linux examples for clang --version. > > $ clang --version > Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4) > Target: x86_64-pc-linux-gnu > Thread model: posix > > $ clang --version > Ubuntu clang version 3.6.2-1 (tags/RELEASE_362/final) (based on LLVM 3.6.2) > Target: x86_64-pc-linux-gnu > Thread model: posix I intended the change to be Mac only. I have no way of determining what Linux clang versions have the multiple .file directives fix.
Michael Saboff
Comment 14 2016-05-05 10:27:07 PDT
(In reply to comment #13) > I intended the change to be Mac only. I have no way of determining what > Linux clang versions have the multiple .file directives fix. Please add Linux clang specific check. You'll need to figure out the first clang version that has the fix given at http://reviews.llvm.org/D16101.
Alexey Proskuryakov
Comment 15 2016-05-08 09:29:05 PDT
Can this be detected by a feature check, instead of a version check? It's not clear from the bug what the failure mode was.
Michael Saboff
Comment 16 2016-05-09 07:56:24 PDT
(In reply to comment #15) > Can this be detected by a feature check, instead of a version check? > > It's not clear from the bug what the failure mode was. Without the clang fix, clang will crash with the directives this change produces. There isn't a feature check in clang for the change.
Note You need to log in before you can comment on or make changes to this bug.