OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #ifndef CRASHPAD_COMPAT_MAC_MACH_O_GETSECT_H_ |
| 16 #define CRASHPAD_COMPAT_MAC_MACH_O_GETSECT_H_ |
| 17 |
| 18 #include_next <mach-o/getsect.h> |
| 19 |
| 20 #include <AvailabilityMacros.h> |
| 21 |
| 22 // This file checks the SDK instead of the deployment target. The SDK is correct |
| 23 // because this file is concerned with providing compile-time declarations, |
| 24 // which are either present in a specific SDK version or not. |
| 25 |
| 26 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
| 27 |
| 28 #include <mach-o/loader.h> |
| 29 #include <stdint.h> |
| 30 |
| 31 #ifdef __cplusplus |
| 32 extern "C" { |
| 33 #endif |
| 34 |
| 35 // Don’t use a typedef to account for the mach_header/mach_header_64 difference |
| 36 // between the 32-bit and 64-bit versions of getsectiondata() and |
| 37 // getsegmentdata(). This file should be faithfully equivalent to the native |
| 38 // SDK, and adding typedefs here would pollute the namespace in a way that the |
| 39 // native SDK does not. |
| 40 |
| 41 #if !defined(__LP64__) |
| 42 |
| 43 uint8_t* getsectiondata(const struct mach_header* mhp, |
| 44 const char* segname, |
| 45 const char* sectname, |
| 46 unsigned long* size); |
| 47 |
| 48 uint8_t* getsegmentdata( |
| 49 const struct mach_header* mhp, const char* segname, unsigned long* size); |
| 50 |
| 51 #else |
| 52 |
| 53 uint8_t* getsectiondata(const struct mach_header_64* mhp, |
| 54 const char* segname, |
| 55 const char* sectname, |
| 56 unsigned long* size); |
| 57 |
| 58 uint8_t* getsegmentdata( |
| 59 const struct mach_header_64* mhp, const char* segname, unsigned long* size); |
| 60 |
| 61 #endif |
| 62 |
| 63 #ifdef __cplusplus |
| 64 } // extern "C" |
| 65 #endif |
| 66 |
| 67 #endif // MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
| 68 |
| 69 #endif // CRASHPAD_COMPAT_MAC_MACH_O_GETSECT_H_ |
OLD | NEW |