GenerationalGC: New failures in cppunittests that link to JS

RESOLVED FIXED in mozilla29

Status

()

Core
JavaScript Engine
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: jonco, Assigned: jonco)

Tracking

unspecified
mozilla29
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

4 years ago
The following cppunittest failures have started appearing in generational GC browser builds:

Assertion failure: initialized(), at ../../../../dist/include/mozilla/ThreadLocal.h:123
cppunittests TEST-UNEXPECTED-FAIL | test_IHistory | test failed with return code -11
Assertion failure: initialized(), at ../../../../dist/include/mozilla/ThreadLocal.h:123
cppunittests TEST-UNEXPECTED-FAIL | sdp_unittests | test failed with return code -11
Assertion failure: initialized(), at ../../../../dist/include/mozilla/ThreadLocal.h:123
cppunittests TEST-UNEXPECTED-FAIL | mediapipeline_unittest | test failed with return code -11
Return code: 1

I suspect this is fallout from bug 951743 as these tests all end up linking to the JS library.
(Assignee)

Comment 1

4 years ago
Created attachment 8361167 [details] [diff] [review]
bug960544-linking-unittests

Right, so this is the problem mentioned in bug 951743 comment 6.

Now that JS_FRIEND_API always exports, we can use that for the relocation functions that these test programs need and stop linking them twice against the JS library.
Assignee: nobody → jcoppeard
Attachment #8361167 - Flags: review?(mh+mozilla)
Comment on attachment 8361167 [details] [diff] [review]
bug960544-linking-unittests

Review of attachment 8361167 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you
Attachment #8361167 - Flags: review?(mh+mozilla) → review+
(Assignee)

Comment 4

4 years ago
It looks like this change breaks GGC builds on windows, which can't find the relocation functions:

test_IHistory.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl JS::HeapCellRelocate(struct js::gc::Cell * *)" (__imp_?HeapCellRelocate@JS@@YAXPAPAUCell@gc@js@@@Z) referenced in function "public: static void __cdecl js::GCMethods<class JSObject *>::relocate(class JSObject * *)" (?relocate@?$GCMethods@PAVJSObject@@@js@@SAXPAPAVJSObject@@@Z)

test_IHistory.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl JS::HeapCellPostBarrier(struct js::gc::Cell * *)" (__imp_?HeapCellPostBarrier@JS@@YAXPAPAUCell@gc@js@@@Z) referenced in function "public: static void __cdecl js::GCMethods<class JSObject *>::postBarrier(class JSObject * *)" (?postBarrier@?$GCMethods@PAVJSObject@@@js@@SAXPAPAVJSObject@@@Z)

test_IHistory.exe : fatal error LNK1120: 2 unresolved externals
Whiteboard: [leave open]
(Assignee)

Updated

4 years ago
Blocks: 764882
(Assignee)

Comment 6

4 years ago
Ok, so I don't really understand what's going on here.  My guess would be that these functions are not being exported on Windows for some reason.

I seem to recall that linking is done differently on Windows though, is that true?  If you've got time to explain to me how all this works that would be much appreciated.
Flags: needinfo?(mh+mozilla)
I can't really tell without looking, and i can't build m-c with generational gc enabled, it fails to build well before your failure.
Flags: needinfo?(mh+mozilla)
My tree might have been too old (less than 2 days old)... it's building now.
Ah I see what's going on. The test is using symbols from the js library, but on windows, it's *not* in libxul. Patch incoming.
Created attachment 8363534 [details] [diff] [review]
Link TestIHistory against mozjs when it is a shared library
Attachment #8363534 - Flags: review?(gps)
Created attachment 8363536 [details] [diff] [review]
Link some cppunittests against mozjs when it is a shared library

With a more appropriate message.
Attachment #8363536 - Flags: review?(gps)
Attachment #8363534 - Attachment is obsolete: true
Attachment #8363534 - Flags: review?(gps)
(Assignee)

Comment 12

4 years ago
(In reply to Mike Hommey [:glandium] from comment #9)
Great, thank you for looking into this!

Updated

4 years ago
Attachment #8363536 - Flags: review?(gps) → review+
Whiteboard: [leave open]
https://hg.mozilla.org/mozilla-central/rev/dd6721572000
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.