Open Bug 1039964 Opened 10 years ago Updated 2 years ago

undefined reference to `JS::WeakMapPtr<JSObject*, JSObject*>::trace(JSTracer*) when building with --enable-shared-js

Categories

(Core :: JavaScript Engine, defect)

All
Linux
defect

Tracking

()

People

(Reporter: glandium, Unassigned)

References

Details

Attachments

(1 file)

../../../dom/bindings/Unified_cpp_dom_bindings0.o: In function `TraceSelf': /home/glandium/mozilla-central/js/xpconnect/src/xpcprivate.h:1071: undefined reference to `JS::WeakMapPtr<JSObject*, JSObject*>::trace(JSTracer*)' ../../../js/xpconnect/src/Unified_cpp_js_xpconnect_src1.o: In function `~XPCWrappedNativeScope': /home/glandium/mozilla-central/js/xpconnect/src/XPCWrappedNativeScope.cpp:404: undefined reference to `JS::WeakMapPtr<JSObject*, JSObject*>::destroy()' ../../../js/xpconnect/src/Unified_cpp_js_xpconnect_src1.o: In function `initialized': /home/glandium/build/obj-x86_64-unknown-linux-gnu/js/xpconnect/src/../../../dist/include/js/WeakMapPtr.h:(.text._ZN21XPCWrappedNativeScope15GetExpandoChainEN2JS6HandleIP8JSObjectEE+0xc): undefined reference to `JS::WeakMapPtr<JSObject*, JSObject*>::lookup(JSObject* const&)' ../../../js/xpconnect/src/Unified_cpp_js_xpconnect_src1.o: In function `SetExpandoChain': /home/glandium/mozilla-central/js/xpconnect/src/XPCWrappedNativeScope.cpp:703: undefined reference to `JS::WeakMapPtr<JSObject*, JSObject*>::init(JSContext*)' /home/glandium/mozilla-central/js/xpconnect/src/XPCWrappedNativeScope.cpp:705: undefined reference to `JS::WeakMapPtr<JSObject*, JSObject*>::put(JSContext*, JSObject* const&, JSObject* const&)' /usr/bin/ld: libxul.so: hidden symbol `_ZN2JS10WeakMapPtrIP8JSObjectS2_E4initEP9JSContext' isn't defined WeakMapPtr is declared visible, but as I understand it, the fact that JSObject is not visible makes the symbols hidden. A minimal testcase is as follows: #pragma GCC visibility push(hidden) class A; template <class T> class __attribute__((visibility("default"))) B { public: void init(T *t) { } }; void foo(A *a) { B<A> b; b.init(a); } This results in the _ZN1BI1AE4initEPS0_ symbol being hidden. While --enable-shared-js is not really a supported option for Linux or Mac, it is useful to make incremental builds faster, and is also helpful to test a kind-of-like Windows setup on Linux when working on the build system.
And it works on Windows because dllexport on the template doesn't have the same restriction.
--enable-shared-js is also very useful for profiling.
Attached patch Possible patchSplinter Review
This worked for me, but this has the unpleasant side effect of making JSObject functions public when they weren't before.
Please note I won't be actively working on this bug despite having attached a working hackish patch.
Also note that it's hackish *and* dangerous. I'm sure there are possible problems with JSObject not being declared visible in jsobj.h (that is, some files would think it's hidden and others it's visible).
Blocks: 1054738
Blocks: 1081031
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: