Bug 31477

Summary: [V8] Fix V8Bindings link error in Linux+GCC 4.4
Product: WebKit Reporter: Jens Alfke <jens>
Component: WebCore Misc.Assignee: Jens Alfke <jens>
Status: RESOLVED FIXED    
Severity: Minor CC: eric
Priority: P3    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
patch dglazkov: review+

Description Jens Alfke 2009-11-13 09:59:00 PST
Craig Schlenter alerted me that my patch in r50846 (bug 31383) caused a link error building Chromium on Linux with GCC 4.4:

undefined reference to `WebCore::AtomicString WebCore::v8StringToWebCoreString<WebCore::AtomicString>(v8::Handle<v8::String>, WebCore::ExternalMode)'

He tracked it down to an issue with the compiler not knowing which instantiations of the template to create, since the template body is in a .cpp file, as described here:
    http://stackoverflow.com/questions/1639797/template-issue-causes-linker-error-c
The fix is to explicitly instantiate both the String and AtomicString versions in the .cpp file.

This isn't a serious issue because we haven't moved up to GCC 4.4 for Chromium's Linux build yet, but it's a good idea to fix this now. I'm preparing a patch.
Comment 1 Jens Alfke 2009-11-13 10:33:24 PST
Created attachment 43168 [details]
patch

Here's the patch. Waiting to set 'review?' flag till after I make sure it builds on Win/Linux.
Comment 2 Jens Alfke 2009-11-13 12:50:53 PST
Comment on attachment 43168 [details]
patch

OK, this has passed the trybots, so requesting a review.
Comment 3 Eric Seidel (no email) 2009-11-13 13:13:15 PST
Comment on attachment 43168 [details]
patch

Wrong mime type on the attachment. :)  Tools like "bugzilla-tool post-diff" will take care of all the silly check-boxes and mime types for you if you like.
Comment 4 Eric Seidel (no email) 2009-11-13 13:14:00 PST
This looks sane to me, but I'm really not enough of a c++ expert to comment here.
Comment 5 Dimitri Glazkov (Google) 2009-11-13 13:18:28 PST
Comment on attachment 43168 [details]
patch

I am not teh expert, but I believe jens! :)
Comment 6 Jens Alfke 2009-11-13 13:27:50 PST
Committed revision 50967.