Bug 133266 - CSS JIT: Fix build error raised when CSS_SELECTOR_JIT_DEBUGGING is 1
Summary: CSS JIT: Fix build error raised when CSS_SELECTOR_JIT_DEBUGGING is 1
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-25 11:13 PDT by Yusuke Suzuki
Modified: 2014-05-26 17:19 PDT (History)
3 users (show)

See Also:


Attachments
Patch (1.67 KB, patch)
2014-05-25 11:15 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (3.66 KB, patch)
2014-05-25 11:16 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2014-05-25 11:13:39 PDT
Currently, when CSS_SELECTOR_JIT_DEBUGGING is 1, build erros occur on x86_64 environment.
Comment 1 Yusuke Suzuki 2014-05-25 11:15:11 PDT
Created attachment 232040 [details]
Patch
Comment 2 Yusuke Suzuki 2014-05-25 11:15:49 PDT
Comment on attachment 232040 [details]
Patch

Oops. upload miss.
Comment 3 Yusuke Suzuki 2014-05-25 11:16:15 PDT
Created attachment 232041 [details]
Patch
Comment 4 Yusuke Suzuki 2014-05-25 11:18:54 PDT
Comment on attachment 232041 [details]
Patch

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

Added comments

> Source/WebCore/cssjit/SelectorCompiler.cpp:181
> +    static const Assembler::RegisterID callFrameRegister;

These are declaration, not definition (C++). So referencing them with const reference (const T&) causes link error, "undefined reference to XXX".

> Source/WebCore/cssjit/SelectorCompiler.cpp:267
> +const Assembler::RegisterID SelectorCodeGenerator::callFrameRegister = JSC::GPRInfo::callFrameRegister;

Added definitions.

> Source/WebCore/cssjit/SelectorCompiler.cpp:949
> +    prologueRegister.append(callFrameRegister);

Since Vector::append referencing the argument as const T&, just replacing `GPRInfo::callFrameRegister` to `JSC::GPRInfo::callFrameRegister` causes link errors.

http://stackoverflow.com/questions/5391973/undefined-reference-to-static-const-int
http://stackoverflow.com/questions/272900/undefined-reference-to-static-class-member
http://stackoverflow.com/questions/3025997/c-defining-static-const-integer-members-in-class-definition
Comment 5 Darin Adler 2014-05-25 12:49:46 PDT
Comment on attachment 232041 [details]
Patch

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

>> Source/WebCore/cssjit/SelectorCompiler.cpp:181
>> +    static const Assembler::RegisterID callFrameRegister;
> 
> These are declaration, not definition (C++). So referencing them with const reference (const T&) causes link error, "undefined reference to XXX".

I would expect to see that problem only when using an old C++ compiler; the status of these has changed in C++11. What compiler were you seeing this with?
Comment 6 Yusuke Suzuki 2014-05-25 18:17:09 PDT
(In reply to comment #5)
> (From update of attachment 232041 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=232041&action=review
> 
> >> Source/WebCore/cssjit/SelectorCompiler.cpp:181
> >> +    static const Assembler::RegisterID callFrameRegister;
> > 
> > These are declaration, not definition (C++). So referencing them with const reference (const T&) causes link error, "undefined reference to XXX".
> 
> I would expect to see that problem only when using an old C++ compiler; the status of these has changed in C++11. What compiler were you seeing this with?

Oh, I didn't know that! I'm using a default compiler on Ubuntu 14.04, the result of `gcc --version` is the following.

gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment 7 WebKit Commit Bot 2014-05-26 17:19:49 PDT
Comment on attachment 232041 [details]
Patch

Clearing flags on attachment: 232041

Committed r169363: <http://trac.webkit.org/changeset/169363>
Comment 8 WebKit Commit Bot 2014-05-26 17:19:52 PDT
All reviewed patches have been landed.  Closing bug.