Bug 1306329 - Stop exporting XPCOM and XUL symbols. r=glandium
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 02 Dec 2016 12:55:34 -0500
changeset 375118 5abe47a8bfe0fd31d5cedc5bf01bdfdbae9ed7bf
parent 375117 2dc53f232f8b7243485b32f141fa8590c68bec28
child 375119 b3338b6713e03abd0fd7a5ae00d2d0d3b0a58a6b
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1306329
milestone53.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 1306329 - Stop exporting XPCOM and XUL symbols. r=glandium MozReview-Commit-ID: AMNFLRCJ98h
toolkit/xre/nsAppRunner.cpp
tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp
xpcom/base/nscore.h
xpcom/build/xrecore.h
xpcom/reflect/xptcall/xptcall.h
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -267,17 +267,17 @@ extern "C" MFBT_API bool IsSignalHandlin
 
 #ifdef LIBFUZZER
 #include "LibFuzzerRunner.h"
 
 namespace mozilla {
 LibFuzzerRunner* libFuzzerRunner = 0;
 } // namespace mozilla
 
-extern "C" MOZ_EXPORT void XRE_LibFuzzerSetMain(int argc, char** argv, LibFuzzerMain main) {
+void XRE_LibFuzzerSetMain(int argc, char** argv, LibFuzzerMain main) {
   mozilla::libFuzzerRunner->setParams(argc, argv, main);
 }
 #endif
 
 namespace mozilla {
 int (*RunGTest)(int*, char**) = 0;
 } // namespace mozilla
 
--- a/tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp
+++ b/tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp
@@ -1,22 +1,20 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * * This Source Code Form is subject to the terms of the Mozilla Public
  * * License, v. 2.0. If a copy of the MPL was not distributed with this
  * * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "LibFuzzerRegistry.h"
 
-extern "C" {
-    void MOZ_EXPORT XRE_LibFuzzerGetFuncs(const char* moduleName, LibFuzzerInitFunc* initFunc, LibFuzzerTestingFunc* testingFunc) {
-        std::string moduleNameStr(moduleName);
-        mozilla::LibFuzzerFunctions funcs = mozilla::LibFuzzerRegistry::getInstance().getModuleFunctions(moduleNameStr);
-        *initFunc = funcs.first;
-        *testingFunc = funcs.second;
-    }
+void XRE_LibFuzzerGetFuncs(const char* moduleName, LibFuzzerInitFunc* initFunc, LibFuzzerTestingFunc* testingFunc) {
+    std::string moduleNameStr(moduleName);
+    mozilla::LibFuzzerFunctions funcs = mozilla::LibFuzzerRegistry::getInstance().getModuleFunctions(moduleNameStr);
+    *initFunc = funcs.first;
+    *testingFunc = funcs.second;
 }
 
 namespace mozilla {
 
 LibFuzzerRegistry& LibFuzzerRegistry::getInstance() {
     static LibFuzzerRegistry instance;
     return instance;
 }
--- a/xpcom/base/nscore.h
+++ b/xpcom/base/nscore.h
@@ -170,33 +170,27 @@
 #else
 # define MOZ_DEPRECATED
 #endif
 
 /**
  * Import/Export macros for XPCOM APIs
  */
 
+#define EXPORT_XPCOM_API(type) type
+#define IMPORT_XPCOM_API(type) type
+#define GLUE_XPCOM_API(type) type
+
 #ifdef __cplusplus
 #define NS_EXTERN_C extern "C"
 #else
 #define NS_EXTERN_C
 #endif
 
-#define EXPORT_XPCOM_API(type) NS_EXTERN_C NS_EXPORT type NS_FROZENCALL
-#define IMPORT_XPCOM_API(type) NS_EXTERN_C NS_IMPORT type NS_FROZENCALL
-#define GLUE_XPCOM_API(type) NS_EXTERN_C NS_HIDDEN_(type) NS_FROZENCALL
-
-#ifdef IMPL_LIBXUL
-#define XPCOM_API(type) EXPORT_XPCOM_API(type)
-#elif defined(XPCOM_GLUE)
-#define XPCOM_API(type) GLUE_XPCOM_API(type)
-#else
-#define XPCOM_API(type) IMPORT_XPCOM_API(type)
-#endif
+#define XPCOM_API(type) NS_EXTERN_C type
 
 #ifdef MOZILLA_INTERNAL_API
    /*
      The frozen string API has different definitions of nsAC?String
      classes than the internal API. On systems that explicitly declare
      dllexport symbols this is not a problem, but on ELF systems
      internal symbols can accidentally "shine through"; we rename the
      internal classes to avoid symbol conflicts.
--- a/xpcom/build/xrecore.h
+++ b/xpcom/build/xrecore.h
@@ -7,19 +7,11 @@
 #ifndef xrecore_h__
 #define xrecore_h__
 
 #include "nscore.h"
 
 /**
  * Import/export macros for libXUL APIs.
  */
-#ifdef XPCOM_GLUE
-#define XRE_API(type, name, params) \
-  typedef type (NS_FROZENCALL * name##Type) params; \
-  extern name##Type name NS_HIDDEN;
-#elif defined(IMPL_LIBXUL)
-#define XRE_API(type, name, params) EXPORT_XPCOM_API(type) name params;
-#else
-#define XRE_API(type, name, params) IMPORT_XPCOM_API(type) name params;
-#endif
+#define XRE_API(type, name, params) type name params;
 
 #endif // xrecore_h__
--- a/xpcom/reflect/xptcall/xptcall.h
+++ b/xpcom/reflect/xptcall/xptcall.h
@@ -181,13 +181,14 @@ XPCOM_API(void)
 NS_DestroyXPTCallStub(nsISomeInterface* aStub);
 
 /**
  * Measures the size of an XPTCall stub previously created with NS_GetXPTCallStub.
  */
 XPCOM_API(size_t)
 NS_SizeOfIncludingThisXPTCallStub(const nsISomeInterface* aStub, mozilla::MallocSizeOf aMallocSizeOf);
 
-XPCOM_API(nsresult)
+// this is extern "C" because on some platforms it is implemented in assembly
+extern "C" nsresult
 NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                  uint32_t paramCount, nsXPTCVariant* params);
 
 #endif /* xptcall_h___ */