Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/mac/closure_blocks_leopard_compat.h

Issue 7598037: Re-enable stripping to produce an MH_DYLIB_STUB for closure_blocks_leopard_compat_stub (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/mac/closure_blocks_leopard_compat.S » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_ 5 #ifndef CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_
6 #define CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_ 6 #define CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_
7 #pragma once 7 #pragma once
8 8
9 // libclosure (blocks) compatibilty for Mac OS X 10.5 (Leopard) 9 // libclosure (blocks) compatibilty for Mac OS X 10.5 (Leopard)
10 // 10 //
11 // Background material: 11 // Background material:
12 // http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Blocks 12 // http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Blocks
13 // http://opensource.apple.com/source/libclosure/libclosure-38/ 13 // http://opensource.apple.com/source/libclosure/libclosure-38/
14 // 14 //
15 // Leopard doesn't support blocks. Chrome supports Leopard. Chrome needs to use 15 // Leopard doesn't support blocks. Chrome supports Leopard. Chrome needs to use
16 // blocks. 16 // blocks.
17 // 17 //
18 // In any file where you use blocks (any time you type ^{...}), you must 18 // In any file where you use blocks (any time you type ^{...}), you must
19 // #include this file to ensure that the runtime symbols referenced by code 19 // #include this file to ensure that the runtime symbols referenced by code
20 // emitted by the compiler are marked for weak-import. This means that if 20 // emitted by the compiler are marked for weak-import. This means that if
21 // these symbols are not present at runtime, the program will still load, but 21 // these symbols are not present at runtime, the program will still load, but
22 // their values will be NULL. 22 // their values will be NULL.
23 // 23 //
24 // In any target (in the GYP sense) where you use blocks, you must also depend 24 // In any target (in the GYP sense) where you use blocks, you must also depend
25 // on the closure_blocks_leopard_compat target to ensure that these symbols 25 // on the closure_blocks_leopard_compat target to ensure that these symbols
26 // will be available at link time, even when the 10.5 SDK is in use. This 26 // will be available at link time, even when the 10.5 SDK is in use. This
27 // This allows the continued use of the 10.5 SDK, which does not contain these 27 // allows the continued use of the 10.5 SDK, which does not contain these
28 // symbols. 28 // symbols.
29 // 29 //
30 // This does not relieve you of the responsibility to not use blocks on 30 // This does not relieve you of the responsibility to not use blocks on
31 // Leopard. Because runtime support for Blocks still isn't present on that 31 // Leopard. Because runtime support for Blocks still isn't present on that
32 // operating system, the weak-imported symbols will have value 0 and attempts 32 // operating system, the weak-imported symbols will have value 0 and attempts
33 // to do anything meaningful with them will fail or crash. You must take care 33 // to do anything meaningful with them will fail or crash. You must take care
34 // not to enter any codepath that uses blocks on Leopard. The base::mac::IsOS* 34 // not to enter any codepath that uses blocks on Leopard. The base::mac::IsOS*
35 // family may be helpful. 35 // family may be helpful.
36 // 36 //
37 // Although this scheme allows the use of the 10.5 SDK and 10.5 runtime in an 37 // Although this scheme allows the use of the 10.5 SDK and 10.5 runtime in an
38 // application that uses blocks, it is still necessary to use a compiler that 38 // application that uses blocks, it is still necessary to use a compiler that
39 // supports blocks. GCC 4.2 as shipped with Xcode 3.2 for Mac OS X 10.6 39 // supports blocks. GCC 4.2 as shipped with Xcode 3.2 for Mac OS X 10.6
40 // qualifies, as do sufficiently recent versions of clang. GCC 4.2 as shipped 40 // qualifies, as do sufficiently recent versions of clang. GCC 4.2 as shipped
41 // with Xcode 3.1 for Mac OS X 10.5 does not qualify. 41 // with Xcode 3.1 for Mac OS X 10.5 does not qualify.
42 42
43 // _NSConcreteGlobalBlock and _NSConcreteStackBlock are a private 43 // _NSConcreteGlobalBlock and _NSConcreteStackBlock are private implementation
44 // implementation details of libclosure defined in 44 // details of libclosure defined in libclosure/libclosure-38/Block_private.h,
45 // libclosure/libclosure-38/Block_private.h, but they're exposed from 45 // but they're exposed from libSystem as public symbols, and the block-enabled
46 // libSystem as public symbols, and the block-enabled compiler will emit code 46 // compiler will emit code that references these symbols. Because the symbols
47 // that references these symbols. Because the symbols aren't present in 10.5's 47 // aren't present in 10.5's libSystem, they must be declared as weak imports
48 // libSystem, they must be declared as weak imports in any file that uses 48 // in any file that uses blocks. Any block-using file must #include this
49 // blocks. Any block-using file must #include this header to guarantee that 49 // header to guarantee that the symbols will show up in linked output as weak
50 // the symbols will show up in linked output as weak imports when compiling 50 // imports when compiling for a 10.5 deployment target. Because the symbols
51 // for a 10.5 deployment target. Because the symbols are always present in 51 // are always present in 10.6 and higher, they do not need to be a weak
52 // 10.6 and higher, they do not need to be a weak imports when the deployment 52 // imports when the deployment target is at least 10.6.
53 // target is at least 10.6.
54 // 53 //
55 // Both GCC and clang emit references to these symbols, providing implicit 54 // Both GCC and clang emit references to these symbols, providing implicit
56 // declarations as needed, but respecting any user declaration when present. 55 // declarations as needed, but respecting any user declaration when present.
57 // See gcc-5666.3/gcc/c-parser.c build_block_struct_initlist, 56 // See gcc-5666.3/gcc/c-parser.c build_block_struct_initlist,
58 // gcc-5666.3/gcc/cp/parser.c build_block_struct_initlist, and 57 // gcc-5666.3/gcc/cp/parser.c build_block_struct_initlist, and
59 // clang-2.9/lib/CodeGen/CodeGenModule.cpp 58 // clang-2.9/lib/CodeGen/CodeGenModule.cpp
60 // CodeGenModule::getNSConcreteGlobalBlock() and 59 // CodeGenModule::getNSConcreteGlobalBlock() and
61 // CodeGenModule::getNSConcreteStackBlock(). 60 // CodeGenModule::getNSConcreteStackBlock().
62 61
63 #include <AvailabilityMacros.h> 62 #include <AvailabilityMacros.h>
64 63
65 extern "C" { 64 extern "C" {
66 65
67 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5 // DT <= 10.5 66 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5 // DT <= 10.5
68 #define MAYBE_WEAK_IMPORT __attribute__((weak_import)) 67 #define MAYBE_WEAK_IMPORT __attribute__((weak_import))
69 #else // DT > 10.5 68 #else // DT > 10.5
70 #define MAYBE_WEAK_IMPORT 69 #define MAYBE_WEAK_IMPORT
71 #endif // DT <= 10.5 70 #endif // DT <= 10.5
72 71
73 MAYBE_WEAK_IMPORT extern void* _NSConcreteGlobalBlock[32]; 72 MAYBE_WEAK_IMPORT extern void* _NSConcreteGlobalBlock[32];
74 MAYBE_WEAK_IMPORT extern void* _NSConcreteStackBlock[32]; 73 MAYBE_WEAK_IMPORT extern void* _NSConcreteStackBlock[32];
75 74
76 #undef MAYBE_WEAK_IMPORT 75 #undef MAYBE_WEAK_IMPORT
77 76
78 } // extern "C" 77 } // extern "C"
79 78
80 #endif // CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_ 79 #endif // CHROME_BROWSER_MAC_CLOSURE_BLOCKS_LEOPARD_COMPAT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/mac/closure_blocks_leopard_compat.S » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698