OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Definitions for android_dlopen_ext(). |
| 6 // |
| 7 // This function was added for Android L-MR1 and made available in android-21 |
| 8 // but we currently build Chromium with android-16. Placing the declarations |
| 9 // we need here allows code that uses android_dlopen_ext() to build with |
| 10 // android-16. At runtime we check the target's SDK_INT to ensure that we |
| 11 // are on a system new enough to offer this function, and also only access |
| 12 // it with dlsym so that the runtime linker on pre-Android L-MR1 targets will |
| 13 // not complain about a missing symbol when loading our library. |
| 14 // |
| 15 // Details below taken from: |
| 16 // third_party/android_tools/ndk/platforms/android-21 |
| 17 // /arch-arm/usr/include/android/dlext.h |
| 18 // |
| 19 // Although taken specifically from arch-arm, there are no architecture- |
| 20 // specific elements in dlext.h. All android-21/arch-* directories contain |
| 21 // identical copies of dlext.h. |
| 22 |
| 23 #ifndef BASE_ANDROID_LINKER_ANDROID_DLEXT_H_ |
| 24 #define BASE_ANDROID_LINKER_ANDROID_DLEXT_H_ |
| 25 |
| 26 #include <stddef.h> |
| 27 #include <stdint.h> |
| 28 |
| 29 /* bitfield definitions for android_dlextinfo.flags */ |
| 30 enum { |
| 31 /* When set, the reserved_addr and reserved_size fields must point to an |
| 32 * already-reserved region of address space which will be used to load the |
| 33 * library if it fits. If the reserved region is not large enough, the load |
| 34 * will fail. |
| 35 */ |
| 36 ANDROID_DLEXT_RESERVED_ADDRESS = 0x1, |
| 37 |
| 38 /* As DLEXT_RESERVED_ADDRESS, but if the reserved region is not large enough, |
| 39 * the linker will choose an available address instead. |
| 40 */ |
| 41 ANDROID_DLEXT_RESERVED_ADDRESS_HINT = 0x2, |
| 42 |
| 43 /* When set, write the GNU RELRO section of the mapped library to relro_fd |
| 44 * after relocation has been performed, to allow it to be reused by another |
| 45 * process loading the same library at the same address. This implies |
| 46 * ANDROID_DLEXT_USE_RELRO. |
| 47 */ |
| 48 ANDROID_DLEXT_WRITE_RELRO = 0x4, |
| 49 |
| 50 /* When set, compare the GNU RELRO section of the mapped library to relro_fd |
| 51 * after relocation has been performed, and replace any relocated pages that |
| 52 * are identical with a version mapped from the file. |
| 53 */ |
| 54 ANDROID_DLEXT_USE_RELRO = 0x8, |
| 55 |
| 56 /* Instruct dlopen to use library_fd instead of opening file by name. |
| 57 * The filename parameter is still used to identify the library. |
| 58 */ |
| 59 ANDROID_DLEXT_USE_LIBRARY_FD = 0x10, |
| 60 |
| 61 /* Mask of valid bits */ |
| 62 ANDROID_DLEXT_VALID_FLAG_BITS = ANDROID_DLEXT_RESERVED_ADDRESS | |
| 63 ANDROID_DLEXT_RESERVED_ADDRESS_HINT | |
| 64 ANDROID_DLEXT_WRITE_RELRO | |
| 65 ANDROID_DLEXT_USE_RELRO | |
| 66 ANDROID_DLEXT_USE_LIBRARY_FD, |
| 67 }; |
| 68 |
| 69 typedef struct { |
| 70 uint64_t flags; |
| 71 void* reserved_addr; |
| 72 size_t reserved_size; |
| 73 int relro_fd; |
| 74 int library_fd; |
| 75 } android_dlextinfo; |
| 76 |
| 77 #endif // BASE_ANDROID_LINKER_ANDROID_DLEXT_H_ |
OLD | NEW |