1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/trunk/build/mac/verify_no_objc.sh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +#!/bin/bash 1.5 + 1.6 +# Copyright (c) 2011 The Chromium Authors. All rights reserved. 1.7 +# Use of this source code is governed by a BSD-style license that can be 1.8 +# found in the LICENSE file. 1.9 + 1.10 +# This script makes sure that no __OBJC,__image_info section appears in the 1.11 +# executable file built by the Xcode target that runs the script. If such a 1.12 +# section appears, the script prints an error message and exits nonzero. 1.13 +# 1.14 +# Why is this important? 1.15 +# 1.16 +# On 10.5, there's a bug in CFBundlePreflightExecutable that causes it to 1.17 +# crash when operating in an executable that has not loaded at its default 1.18 +# address (that is, when it's a position-independent executable with the 1.19 +# MH_PIE bit set in its mach_header) and the executable has an 1.20 +# __OBJC,__image_info section. See http://crbug.com/88697. 1.21 +# 1.22 +# Chrome's main executables don't use any Objective-C at all, and don't need 1.23 +# to carry this section around. Not linking them as Objective-C when they 1.24 +# don't need it anyway saves about 4kB in the linked executable, although most 1.25 +# of that 4kB is just filled with zeroes. 1.26 +# 1.27 +# This script makes sure that nobody goofs and accidentally introduces these 1.28 +# sections into the main executables. 1.29 + 1.30 +set -eu 1.31 + 1.32 +otool="${DEVELOPER_BIN_DIR:-/usr/bin}/otool" 1.33 +executable="${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" 1.34 + 1.35 +if "${otool}" -arch i386 -o "${executable}" | grep -q '^Contents.*section$'; \ 1.36 +then 1.37 + echo "${0}: ${executable} has an __OBJC,__image_info section" 2>&1 1.38 + exit 1 1.39 +fi 1.40 + 1.41 +if [[ ${PIPESTATUS[0]} -ne 0 ]]; then 1.42 + echo "${0}: otool failed" 2>&1 1.43 + exit 1 1.44 +fi 1.45 + 1.46 +exit 0