summaryrefslogtreecommitdiffstats
path: root/chrome/tools
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 20:55:49 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 20:55:49 +0000
commit3115bf87e34f5c40c93eb9349cda1a040f38573b (patch)
tree4d0d143e5bde078ea1bf4bb78d37b72077a0fc88 /chrome/tools
parent08f0a19132581e09be48b13933ec2a90813fd052 (diff)
downloadchromium_src-3115bf87e34f5c40c93eb9349cda1a040f38573b.zip
chromium_src-3115bf87e34f5c40c93eb9349cda1a040f38573b.tar.gz
chromium_src-3115bf87e34f5c40c93eb9349cda1a040f38573b.tar.bz2
Add an .order file to ensure that no global text symbol winds up at an address
higher than _ChromeMain, so that CrashReporter stacks and other symbolized stacks aren't so confusing. Add a tool to verify that nothing violates this ordering requirement. BUG=28257 TEST=verify_order, which is part of the build Review URL: http://codereview.chromium.org/414003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32539 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools')
-rwxr-xr-xchrome/tools/build/mac/verify_order43
1 files changed, 43 insertions, 0 deletions
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