Fix apple bug around TFO writes
[folly.git] / folly / SingletonStackTrace.cpp
index 3e1f87cc3f98bbf165be8a2083917bbd54991d55..d5b67ee047b22922689c73b0c81e1587ed120274 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -46,8 +46,12 @@ struct SetStackTraceGetter {
   }
 };
 
+#ifdef __APPLE__
+// OS X doesn't support constructor priorities.
 SetStackTraceGetter setStackTraceGetter;
-
+#else
+SetStackTraceGetter __attribute__((__init_priority__(101))) setStackTraceGetter;
+#endif
 }
 
 }