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