summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/framework.order41
-rwxr-xr-xchrome/chrome.gyp27
-rwxr-xr-xchrome/tools/build/mac/verify_order43
3 files changed, 109 insertions, 2 deletions
diff --git a/chrome/app/framework.order b/chrome/app/framework.order
new file mode 100644
index 0000000..2a3bef3
--- /dev/null
+++ b/chrome/app/framework.order
@@ -0,0 +1,41 @@
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This .order file defines the order that symbols should be laid out in the
+# Mac framework. The framework does not contain many global text symbols, and
+# in release mode, does not contain any non-global text symbols after being
+# stripped. In order to avoid symbolization of stripped binaries from showing
+# confusing offsets from the few public symbols that are available, an
+# easily-recognized symbol, _ChromeMain, is placed last among global text
+# symbols.
+#
+# Not all symbols will appear in all build types. Varying optimizations may
+# result in differences between the set of symbols present in debug and
+# release modes. When Breakpad is in use, _catch_exception_raise will be
+# present, but it will not appear in non-Breakpad-enabled builds. It is not
+# an error to list symbols in this file that will not be present in each
+# output variant.
+
+_NP_GetEntryPoints
+_NP_GetMIMEDescription
+_NP_GetValue
+_NP_Initialize
+_NP_Shutdown
+__ZN11webkit_glue31NotifyBrowserOfPluginHideWindowEj6CGRect
+__ZN11webkit_glue31NotifyBrowserOfPluginShowWindowEj6CGRectb
+__ZN11webkit_glue33NotifyBrowserOfPluginSelectWindowEj6CGRectb
+__ZN11webkit_glue34NotifyBrowserOfPluginDisposeWindowEj6CGRect
+__ZN23FakePluginWindowTracker14SharedInstanceEv
+__ZN23FakePluginWindowTracker27RemoveFakeWindowForDelegateEP21WebPluginDelegateImplP15OpaqueWindowPtr
+__ZN23FakePluginWindowTracker29GenerateFakeWindowForDelegateEP21WebPluginDelegateImpl
+__ZN23FakePluginWindowTrackerC1Ev
+__ZN23FakePluginWindowTrackerC2Ev
+__ZN7WebCore22narrowPrecisionToFloatIdEEfT_
+__ZN7WebCore24narrowPrecisionToCGFloatIdEEfT_
+__ZNK23FakePluginWindowTracker24GetDelegateForFakeWindowEP15OpaqueWindowPtr
+__ZnwmPv
+_catch_exception_raise
+
+# _ChromeMain must be listed last. That's the whole point of this file.
+_ChromeMain
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index b9ba723..47ba1d3 100755
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -5726,6 +5726,7 @@
'mac_bundle': 1,
'xcode_settings': {
'CHROMIUM_BUNDLE_ID': '<(mac_bundle_id)',
+
# The dylib versions are of the form a[.b[.c]], where a is a
# 16-bit unsigned integer, and b and c are 8-bit unsigned
# integers. Any missing component is taken to be 0. The
@@ -5733,18 +5734,26 @@
# is to just use the build and patch numbers. There is no
# ambiguity in this scheme because the build number is
# guaranteed unique even across distinct major and minor
- # version numbers.
+ # version numbers. These settings correspond to
+ # -compatibility_version and -current_version.
'DYLIB_COMPATIBILITY_VERSION': '<(version_build_patch)',
'DYLIB_CURRENT_VERSION': '<(version_build_patch)',
+
# The framework is placed within the .app's versioned
- # directory.
+ # directory. DYLIB_INSTALL_NAME_BASE and
+ # LD_DYLIB_INSTALL_NAME affect -install_name.
'DYLIB_INSTALL_NAME_BASE':
'@executable_path/../Versions/<(version_full)',
# See tools/build/mac/copy_framework_unversioned for
# information on LD_DYLIB_INSTALL_NAME.
'LD_DYLIB_INSTALL_NAME':
'$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(WRAPPER_NAME)/$(PRODUCT_NAME)',
+
'INFOPLIST_FILE': 'app/framework-Info.plist',
+
+ # Define the order of symbols within the framework. This
+ # sets -order_file.
+ 'ORDER_FILE': 'app/framework.order',
},
'sources': [
'app/chrome_dll_main.cc',
@@ -5902,6 +5911,20 @@
],
'postbuilds': [
{
+ # This step causes an error to be raised if the .order file
+ # does not account for all global text symbols. It
+ # validates the completeness of the .order file.
+ 'postbuild_name': 'Verify global text symbol order',
+ 'variables': {
+ 'verify_order_path': 'tools/build/mac/verify_order',
+ },
+ 'action': [
+ '<(verify_order_path)',
+ '_ChromeMain',
+ '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}',
+ ],
+ },
+ {
# Modify the Info.plist as needed. The script explains why
# this is needed. This is also done in the chrome target.
# The framework needs the Breakpad and Keystone keys if
diff --git a/chrome/tools/build/mac/verify_order b/chrome/tools/build/mac/verify_order
new file mode 100755
index 0000000..3d5d644
--- /dev/null
+++ b/chrome/tools/build/mac/verify_order
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Verifies that no global text symbols are present in a Mach-O file
+# (MACH_O_FILE) at an address higher than the address of a specific symbol
+# (LAST_SYMBOL). If LAST_SYMBOL is not found in MACH_O_FILE or if symbols
+# are present with addresses higher than LAST_SYMBOL's address, an error
+# message is printed to stderr, and the script will exit nonzero.
+#
+# This script can be used to verify that all of the global text symbols in
+# a Mach-O file are accounted for in an order file.
+
+if [ ${#} -ne 2 ] ; then
+ echo "usage: ${0} LAST_SYMBOL MACH_O_FILE" >& 2
+ exit 1
+fi
+
+LAST_SYMBOL=${1}
+MACH_O_FILE=${2}
+
+SYMBOLS=$(nm -fgjn -s __TEXT __text "${MACH_O_FILE}")
+if [ ${?} -ne 0 ] || [ -z "${SYMBOLS}" ] ; then
+ echo "${0}: no symbols in ${MACH_O_FILE}" >& 2
+ exit 1
+fi
+
+LAST_SYMBOLS=$(grep -A 100 -Fx "${LAST_SYMBOL}" <<< "${SYMBOLS}")
+if [ ${?} -ne 0 ] || [ -z "${LAST_SYMBOLS}" ] ; then
+ echo "${0}: symbol ${LAST_SYMBOL} not found in ${MACH_O_FILE}" >& 2
+ exit 1
+fi
+
+UNORDERED_SYMBOLS=$(grep -Fvx "${LAST_SYMBOL}" <<< "${LAST_SYMBOLS}")
+if [ ${?} -eq 0 ] || [ -n "${UNORDERED_SYMBOLS}" ] ; then
+ echo "${0}: unordered symbols in ${MACH_O_FILE}:" >& 2
+ echo "${UNORDERED_SYMBOLS}" >& 2
+ exit 1
+fi
+
+exit 0