Bug 1560064 - Barrier: Set MovableCellHasher<JSObject*> visibility before being used r=sfink
☠☠ backed out by ea5d71035f64 ☠ ☠
authorMarco Trevisan <mail@3v1n0.net>
Wed, 19 Jun 2019 08:00:46 +0000
changeset 479204 75d71e4211bbf927435b0c843ba9fec15085774b
parent 479203 239ad0c20bda6a9f317dbcb076312a703b236775
child 479205 ca7d45d235a61397589e68d0dc62a2bc82f9ea8c
push id88141
push usersfink@mozilla.com
push dateWed, 19 Jun 2019 08:02:21 +0000
treeherderautoland@ca7d45d235a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1560064, 39159
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1560064 - Barrier: Set MovableCellHasher<JSObject*> visibility before being used r=sfink Under GCC, the type attributes can't be set more than once, and when this happens only the firt definition they are ignored. Since MovableCellHasher<JSObject*> is used in various headers g++ implicitly set the symbol visibility to default (and thus hidden), making this symbol not to be exported as it should be. Move the template specialization with type attributes to Barrier.h, so that this might happen before any other definition, muting the warning and making the symbol to be really exported Fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39159 Differential Revision: https://phabricator.services.mozilla.com/D35292
js/src/gc/Barrier.cpp
js/src/gc/Barrier.h
--- a/js/src/gc/Barrier.cpp
+++ b/js/src/gc/Barrier.cpp
@@ -170,17 +170,16 @@ template <typename T>
   return keyId == zone->getUniqueIdInfallible(l);
 }
 
 #ifdef JS_BROKEN_GCC_ATTRIBUTE_WARNING
 #  pragma GCC diagnostic push
 #  pragma GCC diagnostic ignored "-Wattributes"
 #endif  // JS_BROKEN_GCC_ATTRIBUTE_WARNING
 
-template struct JS_PUBLIC_API MovableCellHasher<JSObject*>;
 template struct JS_PUBLIC_API MovableCellHasher<GlobalObject*>;
 template struct JS_PUBLIC_API MovableCellHasher<SavedFrame*>;
 template struct JS_PUBLIC_API MovableCellHasher<EnvironmentObject*>;
 template struct JS_PUBLIC_API MovableCellHasher<WasmInstanceObject*>;
 template struct JS_PUBLIC_API MovableCellHasher<JSScript*>;
 template struct JS_PUBLIC_API MovableCellHasher<LazyScript*>;
 
 #ifdef JS_BROKEN_GCC_ATTRIBUTE_WARNING
--- a/js/src/gc/Barrier.h
+++ b/js/src/gc/Barrier.h
@@ -858,16 +858,18 @@ class ImmutableTenuredPtr {
     AssertTargetIsNotGray(ptr);
     value = ptr;
   }
 
   T get() const { return value; }
   const T* address() { return &value; }
 };
 
+template struct JS_PUBLIC_API MovableCellHasher<JSObject*>;
+
 template <typename T>
 struct MovableCellHasher<PreBarriered<T>> {
   using Key = PreBarriered<T>;
   using Lookup = T;
 
   static bool hasHash(const Lookup& l) {
     return MovableCellHasher<T>::hasHash(l);
   }