| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 1 | // | 
|  | 2 | // libdl | 
|  | 3 | // | 
| dimitry | c5ea3eb | 2017-10-05 17:23:10 +0200 | [diff] [blame] | 4 | cc_library_static { | 
|  | 5 | name: "libdl_static", | 
| Dan Willemsen | 17b3559 | 2018-10-11 23:32:26 -0700 | [diff] [blame] | 6 | defaults: ["linux_bionic_supported"], | 
| Jiyong Park | 5603c6e | 2018-04-27 21:53:11 +0900 | [diff] [blame] | 7 | recovery_available: true, | 
| dimitry | 7f04880 | 2019-05-03 15:57:34 +0200 | [diff] [blame] | 8 | native_bridge_supported: true, | 
| dimitry | c5ea3eb | 2017-10-05 17:23:10 +0200 | [diff] [blame] | 9 |  | 
| Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 10 | srcs: [ | 
|  | 11 | "libdl.cpp", | 
|  | 12 | "libdl_cfi.cpp", | 
|  | 13 | ], | 
| dimitry | c5ea3eb | 2017-10-05 17:23:10 +0200 | [diff] [blame] | 14 |  | 
|  | 15 | cflags: [ | 
|  | 16 | "-Wall", | 
|  | 17 | "-Wextra", | 
|  | 18 | "-Wunused", | 
|  | 19 | "-Werror", | 
|  | 20 | ], | 
|  | 21 |  | 
|  | 22 | // For private/CFIShadow.h. | 
|  | 23 | include_dirs: ["bionic/libc"], | 
|  | 24 |  | 
|  | 25 | stl: "none", | 
| Dan Willemsen | 6b3be17 | 2018-12-03 13:57:20 -0800 | [diff] [blame] | 26 | system_shared_libs: [], | 
| dimitry | c5ea3eb | 2017-10-05 17:23:10 +0200 | [diff] [blame] | 27 |  | 
|  | 28 | sanitize: { | 
|  | 29 | never: true, | 
|  | 30 | }, | 
|  | 31 | } | 
|  | 32 |  | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 33 | cc_library { | 
| Dan Willemsen | 7ec52b1 | 2016-11-28 17:02:25 -0800 | [diff] [blame] | 34 | name: "libdl", | 
| Jiyong Park | 5603c6e | 2018-04-27 21:53:11 +0900 | [diff] [blame] | 35 | recovery_available: true, | 
| dimitry | 7f04880 | 2019-05-03 15:57:34 +0200 | [diff] [blame] | 36 | native_bridge_supported: true, | 
| Dan Albert | 40f15ec | 2017-10-27 11:21:20 -0700 | [diff] [blame] | 37 | static_ndk_lib: true, | 
| Dan Willemsen | 7ec52b1 | 2016-11-28 17:02:25 -0800 | [diff] [blame] | 38 |  | 
|  | 39 | defaults: ["linux_bionic_supported"], | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 40 |  | 
|  | 41 | // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from | 
|  | 42 | // libgcc.a are made static to libdl.so.  This in turn ensures that libraries that | 
|  | 43 | // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so | 
|  | 44 | // to provide those symbols, but will instead pull them from libgcc.a.  Specifically, | 
|  | 45 | // we use this property to make sure libc.so has its own copy of the code from | 
|  | 46 | // libgcc.a it uses. | 
|  | 47 | // | 
|  | 48 | // DO NOT REMOVE --exclude-libs! | 
|  | 49 |  | 
| Yi Kong | 7786a34 | 2018-08-31 19:01:56 -0700 | [diff] [blame] | 50 | ldflags: [ | 
|  | 51 | "-Wl,--exclude-libs=libgcc.a", | 
| Yi Kong | 7ac2afb | 2019-05-06 16:23:10 -0700 | [diff] [blame] | 52 | "-Wl,--exclude-libs=libgcc_stripped.a", | 
| Yi Kong | 7786a34 | 2018-08-31 19:01:56 -0700 | [diff] [blame] | 53 | "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a", | 
|  | 54 | "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a", | 
|  | 55 | "-Wl,--exclude-libs=libclang_rt.builtins-x86-android.a", | 
|  | 56 | "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a", | 
|  | 57 | ], | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 58 |  | 
|  | 59 | // for x86, exclude libgcc_eh.a for the same reasons as above | 
|  | 60 | arch: { | 
| Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 61 | arm: { | 
| Elliott Hughes | d19b3c5 | 2018-09-06 16:04:08 -0700 | [diff] [blame] | 62 | version_script: ":libdl.arm.map", | 
| Chih-Hung Hsieh | ecbff83 | 2018-05-23 18:45:53 -0700 | [diff] [blame] | 63 | pack_relocations: false, | 
| Ian Pedowitz | b6310c2 | 2018-01-18 16:26:19 -0800 | [diff] [blame] | 64 | ldflags: ["-Wl,--hash-style=both"], | 
| Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 65 | }, | 
|  | 66 | arm64: { | 
| Elliott Hughes | d19b3c5 | 2018-09-06 16:04:08 -0700 | [diff] [blame] | 67 | version_script: ":libdl.arm64.map", | 
| Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 68 | }, | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 69 | x86: { | 
| Chih-Hung Hsieh | ecbff83 | 2018-05-23 18:45:53 -0700 | [diff] [blame] | 70 | pack_relocations: false, | 
| Dimitry Ivanov | ac4bd2f | 2016-11-21 12:50:38 -0800 | [diff] [blame] | 71 | ldflags: [ | 
|  | 72 | "-Wl,--exclude-libs=libgcc_eh.a", | 
| Ian Pedowitz | b6310c2 | 2018-01-18 16:26:19 -0800 | [diff] [blame] | 73 | "-Wl,--hash-style=both", | 
| Dimitry Ivanov | ac4bd2f | 2016-11-21 12:50:38 -0800 | [diff] [blame] | 74 | ], | 
| Elliott Hughes | d19b3c5 | 2018-09-06 16:04:08 -0700 | [diff] [blame] | 75 | version_script: ":libdl.x86.map", | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 76 | }, | 
|  | 77 | x86_64: { | 
|  | 78 | ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], | 
| Elliott Hughes | d19b3c5 | 2018-09-06 16:04:08 -0700 | [diff] [blame] | 79 | version_script: ":libdl.x86_64.map", | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 80 | }, | 
|  | 81 | }, | 
| dimitry | dc7cc62 | 2017-08-30 10:52:19 +0200 | [diff] [blame] | 82 | shared: { | 
| dimitry | c5ea3eb | 2017-10-05 17:23:10 +0200 | [diff] [blame] | 83 | whole_static_libs: ["libdl_static"], | 
| dimitry | dc7cc62 | 2017-08-30 10:52:19 +0200 | [diff] [blame] | 84 | }, | 
|  | 85 | static: { | 
| Elliott Hughes | 46a943c | 2018-04-03 15:56:35 -0700 | [diff] [blame] | 86 | srcs: ["libdl_static.cpp"], | 
| dimitry | dc7cc62 | 2017-08-30 10:52:19 +0200 | [diff] [blame] | 87 | }, | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 88 | cflags: [ | 
|  | 89 | "-Wall", | 
|  | 90 | "-Wextra", | 
|  | 91 | "-Wunused", | 
|  | 92 | "-Werror", | 
|  | 93 | ], | 
|  | 94 | stl: "none", | 
|  | 95 |  | 
| Ryan Prichard | 470b666 | 2018-03-27 22:10:55 -0700 | [diff] [blame] | 96 | nocrt: true, | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 97 | system_shared_libs: [], | 
| Pirama Arumuga Nainar | eeb2ee6 | 2019-02-15 11:40:40 -0800 | [diff] [blame] | 98 |  | 
|  | 99 | // Opt out of native_coverage when opting out of system_shared_libs | 
| Pirama Arumuga Nainar | 852d523 | 2018-12-20 13:52:19 -0800 | [diff] [blame] | 100 | native_coverage: false, | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 101 |  | 
| Dimitry Ivanov | d9e427c | 2016-11-22 16:55:25 -0800 | [diff] [blame] | 102 | // This is placeholder library the actual implementation is (currently) | 
|  | 103 | // provided by the linker. | 
| Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 104 | shared_libs: ["ld-android"], | 
| Dimitry Ivanov | d9e427c | 2016-11-22 16:55:25 -0800 | [diff] [blame] | 105 |  | 
|  | 106 | sanitize: { | 
|  | 107 | never: true, | 
|  | 108 | }, | 
| Jiyong Park | c45fe9f | 2018-12-13 18:26:48 +0900 | [diff] [blame] | 109 |  | 
|  | 110 | stubs: { | 
|  | 111 | symbol_file: "libdl.map.txt", | 
|  | 112 | versions: ["10000"], | 
|  | 113 | }, | 
| Jiyong Park | e87e0dc | 2019-10-02 17:09:33 +0900 | [diff] [blame] | 114 |  | 
|  | 115 | apex_available: [ | 
|  | 116 | "//apex_available:platform", | 
|  | 117 | "com.android.runtime", | 
|  | 118 | ], | 
| Dimitry Ivanov | d9e427c | 2016-11-22 16:55:25 -0800 | [diff] [blame] | 119 | } | 
|  | 120 |  | 
| dimitry | 8868d9e | 2019-03-19 13:01:42 +0100 | [diff] [blame] | 121 | cc_library { | 
|  | 122 | name: "libdl_android", | 
|  | 123 |  | 
|  | 124 | defaults: ["linux_bionic_supported"], | 
| Jiyong Park | 3ff116a | 2019-04-02 23:04:52 +0900 | [diff] [blame] | 125 | recovery_available: true, | 
| dimitry | 7f04880 | 2019-05-03 15:57:34 +0200 | [diff] [blame] | 126 | native_bridge_supported: true, | 
| dimitry | 8868d9e | 2019-03-19 13:01:42 +0100 | [diff] [blame] | 127 |  | 
|  | 128 | // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from | 
|  | 129 | // libgcc.a are made static to libdl.so.  This in turn ensures that libraries that | 
|  | 130 | // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so | 
|  | 131 | // to provide those symbols, but will instead pull them from libgcc.a.  Specifically, | 
|  | 132 | // we use this property to make sure libc.so has its own copy of the code from | 
|  | 133 | // libgcc.a it uses. | 
|  | 134 | // | 
|  | 135 | // DO NOT REMOVE --exclude-libs! | 
|  | 136 |  | 
|  | 137 | ldflags: [ | 
|  | 138 | "-Wl,--exclude-libs=libgcc.a", | 
| Yi Kong | 7ac2afb | 2019-05-06 16:23:10 -0700 | [diff] [blame] | 139 | "-Wl,--exclude-libs=libgcc_stripped.a", | 
| dimitry | 8868d9e | 2019-03-19 13:01:42 +0100 | [diff] [blame] | 140 | "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a", | 
|  | 141 | "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a", | 
|  | 142 | "-Wl,--exclude-libs=libclang_rt.builtins-x86-android.a", | 
|  | 143 | "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a", | 
|  | 144 | ], | 
|  | 145 |  | 
|  | 146 | // for x86, exclude libgcc_eh.a for the same reasons as above | 
|  | 147 | arch: { | 
|  | 148 | x86: { | 
|  | 149 | ldflags: [ | 
|  | 150 | "-Wl,--exclude-libs=libgcc_eh.a", | 
|  | 151 | ], | 
|  | 152 | }, | 
|  | 153 | x86_64: { | 
|  | 154 | ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], | 
|  | 155 | }, | 
|  | 156 | }, | 
|  | 157 |  | 
|  | 158 | srcs: [ "libdl_android.cpp" ], | 
|  | 159 | version_script: "libdl_android.map.txt", | 
|  | 160 |  | 
|  | 161 | cflags: [ | 
|  | 162 | "-Wall", | 
|  | 163 | "-Wextra", | 
|  | 164 | "-Wunused", | 
|  | 165 | "-Werror", | 
|  | 166 | ], | 
|  | 167 |  | 
|  | 168 | stl: "none", | 
|  | 169 |  | 
|  | 170 | nocrt: true, | 
|  | 171 | system_shared_libs: [], | 
|  | 172 |  | 
|  | 173 | // Opt out of native_coverage when opting out of system_shared_libs | 
|  | 174 | native_coverage: false, | 
|  | 175 |  | 
|  | 176 | // This is placeholder library the actual implementation is (currently) | 
|  | 177 | // provided by the linker. | 
|  | 178 | shared_libs: ["ld-android"], | 
|  | 179 |  | 
|  | 180 | sanitize: { | 
|  | 181 | never: true, | 
|  | 182 | }, | 
|  | 183 |  | 
|  | 184 | stubs: { | 
|  | 185 | symbol_file: "libdl_android.map.txt", | 
|  | 186 | versions: ["10000"], | 
|  | 187 | }, | 
|  | 188 | } | 
|  | 189 |  | 
| Dan Albert | e8a9108 | 2016-08-04 13:45:44 -0700 | [diff] [blame] | 190 | ndk_library { | 
| Dan Willemsen | 993b083 | 2017-04-07 14:09:18 -0700 | [diff] [blame] | 191 | name: "libdl", | 
| dimitry | 7f04880 | 2019-05-03 15:57:34 +0200 | [diff] [blame] | 192 | native_bridge_supported: true, | 
| Dan Albert | e8a9108 | 2016-08-04 13:45:44 -0700 | [diff] [blame] | 193 | symbol_file: "libdl.map.txt", | 
|  | 194 | first_version: "9", | 
|  | 195 | } | 
| Dan Willemsen | b93d3c2 | 2017-03-20 14:07:47 -0700 | [diff] [blame] | 196 |  | 
|  | 197 | llndk_library { | 
| Dan Willemsen | 993b083 | 2017-04-07 14:09:18 -0700 | [diff] [blame] | 198 | name: "libdl", | 
| dimitry | 7f04880 | 2019-05-03 15:57:34 +0200 | [diff] [blame] | 199 | native_bridge_supported: true, | 
| Dan Willemsen | b93d3c2 | 2017-03-20 14:07:47 -0700 | [diff] [blame] | 200 | symbol_file: "libdl.map.txt", | 
|  | 201 | } | 
| Elliott Hughes | d19b3c5 | 2018-09-06 16:04:08 -0700 | [diff] [blame] | 202 |  | 
|  | 203 | genrule { | 
|  | 204 | name: "libdl.arm.map", | 
|  | 205 | out: ["libdl.arm.map"], | 
|  | 206 | srcs: ["libdl.map.txt"], | 
|  | 207 | tool_files: [":bionic-generate-version-script"], | 
|  | 208 | cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)", | 
|  | 209 | } | 
|  | 210 |  | 
|  | 211 | genrule { | 
|  | 212 | name: "libdl.arm64.map", | 
|  | 213 | out: ["libdl.arm64.map"], | 
|  | 214 | srcs: ["libdl.map.txt"], | 
|  | 215 | tool_files: [":bionic-generate-version-script"], | 
|  | 216 | cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)", | 
|  | 217 | } | 
|  | 218 |  | 
|  | 219 | genrule { | 
|  | 220 | name: "libdl.x86.map", | 
|  | 221 | out: ["libdl.x86.map"], | 
|  | 222 | srcs: ["libdl.map.txt"], | 
|  | 223 | tool_files: [":bionic-generate-version-script"], | 
|  | 224 | cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)", | 
|  | 225 | } | 
|  | 226 |  | 
|  | 227 | genrule { | 
|  | 228 | name: "libdl.x86_64.map", | 
|  | 229 | out: ["libdl.x86_64.map"], | 
|  | 230 | srcs: ["libdl.map.txt"], | 
|  | 231 | tool_files: [":bionic-generate-version-script"], | 
|  | 232 | cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)", | 
|  | 233 | } |