From f1fec0933e2400bb093c5ae25eb04225455b659c Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 6 Jun 2016 12:26:55 -0400 Subject: [PATCH] Linux: Add version script to restrict exported symbols (issue #1765) --- cef.gyp | 8 ++++++++ include/capi/cef_request_context_capi.h | 2 +- include/cef_request_context.h | 2 +- libcef_dll/cpptoc/request_context_cpptoc.cc | 2 +- libcef_dll/ctocpp/request_context_ctocpp.cc | 2 +- libcef_dll/libcef.lst | 9 +++++++++ 6 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 libcef_dll/libcef.lst diff --git a/cef.gyp b/cef.gyp index c715bb97a..32cde2a98 100644 --- a/cef.gyp +++ b/cef.gyp @@ -2090,6 +2090,14 @@ }, }, }], + [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + 'link_settings': { + 'ldflags': [ + # Only export necessary symbols from libcef.so. + '-Wl,--version-script= CreateContext( CefRefPtr other, CefRefPtr handler); diff --git a/libcef_dll/cpptoc/request_context_cpptoc.cc b/libcef_dll/cpptoc/request_context_cpptoc.cc index e3e7959e7..aa11104fd 100644 --- a/libcef_dll/cpptoc/request_context_cpptoc.cc +++ b/libcef_dll/cpptoc/request_context_cpptoc.cc @@ -58,7 +58,7 @@ CEF_EXPORT cef_request_context_t* cef_request_context_create_context( return CefRequestContextCppToC::Wrap(_retval); } -CEF_EXPORT cef_request_context_t* create_context_shared( +CEF_EXPORT cef_request_context_t* cef_create_context_shared( cef_request_context_t* other, struct _cef_request_context_handler_t* handler) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING diff --git a/libcef_dll/ctocpp/request_context_ctocpp.cc b/libcef_dll/ctocpp/request_context_ctocpp.cc index 0a44369d3..1dd1e9ec0 100644 --- a/libcef_dll/ctocpp/request_context_ctocpp.cc +++ b/libcef_dll/ctocpp/request_context_ctocpp.cc @@ -61,7 +61,7 @@ CefRefPtr CefRequestContext::CreateContext( // Unverified params: handler // Execute - cef_request_context_t* _retval = create_context_shared( + cef_request_context_t* _retval = cef_create_context_shared( CefRequestContextCToCpp::Unwrap(other), CefRequestContextHandlerCppToC::Wrap(handler)); diff --git a/libcef_dll/libcef.lst b/libcef_dll/libcef.lst new file mode 100644 index 000000000..e236ea99a --- /dev/null +++ b/libcef_dll/libcef.lst @@ -0,0 +1,9 @@ +# Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + /* Only export necessary symbols from libcef.so. */ + global: cef_*; + local: *; +};