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