[WPE] Use linker script to control exported symbols
authormcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Nov 2017 20:56:03 +0000 (20:56 +0000)
committermcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Nov 2017 20:56:03 +0000 (20:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179358

Reviewed by Carlos Alberto Lopez Perez.

The C API is being inadvertently exported because it's marked as WEBKIT_EXPORT in the header
files. But of course it should only be exported in DEVELOPER_MODE, where it's needed for
WebKitTestRunner. Use (almost) the same linker version script as GTK to fix this. It's
slightly different because WPE does not have WebKitPluginProcess.

This also reduces binary size of libWPEWebKit.so in debug mode from 615 MB down to 497 MB.
(Haven't checked release mode.)

* Source/cmake/OptionsWPE.cmake:
* Source/cmake/wpesymbols.filter: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224642 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/cmake/OptionsWPE.cmake
Source/cmake/wpesymbols.filter [new file with mode: 0644]

index 8a18ec6..94ef166 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2017-11-09  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        [WPE] Use linker script to control exported symbols
+        https://bugs.webkit.org/show_bug.cgi?id=179358
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        The C API is being inadvertently exported because it's marked as WEBKIT_EXPORT in the header
+        files. But of course it should only be exported in DEVELOPER_MODE, where it's needed for
+        WebKitTestRunner. Use (almost) the same linker version script as GTK to fix this. It's
+        slightly different because WPE does not have WebKitPluginProcess.
+
+        This also reduces binary size of libWPEWebKit.so in debug mode from 615 MB down to 497 MB.
+        (Haven't checked release mode.)
+
+        * Source/cmake/OptionsWPE.cmake:
+        * Source/cmake/wpesymbols.filter: Added.
+
 2017-11-08  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         [WPE] Turn on ENABLE_INDEXED_DATABASE_IN_WORKERS
index 7341e60..8884f78 100644 (file)
@@ -108,11 +108,8 @@ set(FORWARDING_HEADERS_WPE_DIR ${FORWARDING_HEADERS_DIR}/wpe)
 set(FORWARDING_HEADERS_WPE_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/wpe-webextension)
 set(DERIVED_SOURCES_WPE_API_DIR ${DERIVED_SOURCES_WEBKIT_DIR}/wpe)
 
-# Build with -fvisibility=hidden to reduce the size of the shared library.
-# Not to be used when building the WebKitTestRunner library.
 if (NOT DEVELOPER_MODE)
-    set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fvisibility=hidden")
-    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=hidden -fvisibility-inlines-hidden")
+    set(WebKit_VERSION_SCRIPT "-Wl,--version-script,${CMAKE_MODULE_PATH}/wpesymbols.filter")
 endif ()
 
 include(GStreamerChecks)
diff --git a/Source/cmake/wpesymbols.filter b/Source/cmake/wpesymbols.filter
new file mode 100644 (file)
index 0000000..b800fe5
--- /dev/null
@@ -0,0 +1,12 @@
+{
+global:
+  webkit_*;
+  WebProcessMainUnix;
+  NetworkProcessMainUnix;
+  StorageProcessMainUnix;
+  _ZN6WebKit22WebKitExtensionManager10initializeEPNS_14InjectedBundleEPN3API6ObjectE;
+  _ZN6WebKit22WebKitExtensionManager9singletonEv;
+local:
+  webkit_media_player_debug;
+  *;
+};