blob: 300467199c4171859b463c13b291eb5b2ce89be2 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001//
2// libdl
3//
Bob Badouraa7d8352021-02-19 13:06:22 -08004package {
5 default_applicable_licenses: ["bionic_libdl_license"],
6}
7
8license {
9 name: "bionic_libdl_license",
10 visibility: [":__subpackages__"],
11 license_kinds: [
12 "SPDX-license-identifier-Apache-2.0",
13 ],
14 license_text: [
15 "NOTICE",
16 ],
17}
18
dimitryc5ea3eb2017-10-05 17:23:10 +020019cc_library_static {
20 name: "libdl_static",
Dan Willemsen17b35592018-10-11 23:32:26 -070021 defaults: ["linux_bionic_supported"],
Yifan Hong5a39cee2020-01-21 16:43:56 -080022 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -070023 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090024 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020025 native_bridge_supported: true,
dimitryc5ea3eb2017-10-05 17:23:10 +020026
Elliott Hughesd50a1de2018-02-05 17:30:57 -080027 srcs: [
28 "libdl.cpp",
29 "libdl_cfi.cpp",
30 ],
dimitryc5ea3eb2017-10-05 17:23:10 +020031
32 cflags: [
33 "-Wall",
34 "-Wextra",
35 "-Wunused",
36 "-Werror",
37 ],
38
39 // For private/CFIShadow.h.
40 include_dirs: ["bionic/libc"],
41
42 stl: "none",
Dan Willemsen6b3be172018-12-03 13:57:20 -080043 system_shared_libs: [],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010044 header_libs: ["libc_headers"],
Martin Stjernholm3ddcc1e2020-05-06 23:44:08 +010045 export_header_lib_headers: ["libc_headers"],
dimitryc5ea3eb2017-10-05 17:23:10 +020046
47 sanitize: {
48 never: true,
49 },
50}
51
Dan Willemsen208ae172015-09-16 16:33:27 -070052cc_library {
Dan Willemsen7ec52b12016-11-28 17:02:25 -080053 name: "libdl",
Yifan Hong5a39cee2020-01-21 16:43:56 -080054 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -070055 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090056 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020057 native_bridge_supported: true,
Dan Albert40f15ec2017-10-27 11:21:20 -070058 static_ndk_lib: true,
Colin Cross8393a8b2020-10-19 13:37:49 -070059 llndk_stubs: "libdl.llndk",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080060
61 defaults: ["linux_bionic_supported"],
Dan Willemsen208ae172015-09-16 16:33:27 -070062
63 // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
64 // libgcc.a are made static to libdl.so. This in turn ensures that libraries that
65 // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so
66 // to provide those symbols, but will instead pull them from libgcc.a. Specifically,
67 // we use this property to make sure libc.so has its own copy of the code from
68 // libgcc.a it uses.
69 //
70 // DO NOT REMOVE --exclude-libs!
71
Yi Kong7786a342018-08-31 19:01:56 -070072 ldflags: [
73 "-Wl,--exclude-libs=libgcc.a",
Yi Kong7ac2afb2019-05-06 16:23:10 -070074 "-Wl,--exclude-libs=libgcc_stripped.a",
Yi Kong7786a342018-08-31 19:01:56 -070075 "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
76 "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
Ryan Prichardef147872021-01-28 14:06:52 -080077 "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
Yi Kong7786a342018-08-31 19:01:56 -070078 "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
79 ],
Dan Willemsen208ae172015-09-16 16:33:27 -070080
81 // for x86, exclude libgcc_eh.a for the same reasons as above
82 arch: {
Dan Willemsen9e6f98f2015-11-03 14:30:57 -080083 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -070084 version_script: ":libdl.arm.map",
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -070085 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -080086 ldflags: ["-Wl,--hash-style=both"],
Dan Willemsen9e6f98f2015-11-03 14:30:57 -080087 },
88 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -070089 version_script: ":libdl.arm64.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -080090 },
Dan Willemsen208ae172015-09-16 16:33:27 -070091 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -070092 pack_relocations: false,
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -080093 ldflags: [
94 "-Wl,--exclude-libs=libgcc_eh.a",
Ian Pedowitzb6310c22018-01-18 16:26:19 -080095 "-Wl,--hash-style=both",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -080096 ],
Elliott Hughesd19b3c52018-09-06 16:04:08 -070097 version_script: ":libdl.x86.map",
Dan Willemsen208ae172015-09-16 16:33:27 -070098 },
99 x86_64: {
100 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700101 version_script: ":libdl.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -0700102 },
103 },
dimitrydc7cc622017-08-30 10:52:19 +0200104 shared: {
dimitryc5ea3eb2017-10-05 17:23:10 +0200105 whole_static_libs: ["libdl_static"],
dimitrydc7cc622017-08-30 10:52:19 +0200106 },
107 static: {
Elliott Hughes46a943c2018-04-03 15:56:35 -0700108 srcs: ["libdl_static.cpp"],
dimitrydc7cc622017-08-30 10:52:19 +0200109 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700110 cflags: [
111 "-Wall",
112 "-Wextra",
113 "-Wunused",
114 "-Werror",
115 ],
116 stl: "none",
117
Ryan Prichard470b6662018-03-27 22:10:55 -0700118 nocrt: true,
Dan Willemsen208ae172015-09-16 16:33:27 -0700119 system_shared_libs: [],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +0100120 header_libs: ["libc_headers"],
Pirama Arumuga Nainareeb2ee62019-02-15 11:40:40 -0800121
122 // Opt out of native_coverage when opting out of system_shared_libs
Pirama Arumuga Nainar852d5232018-12-20 13:52:19 -0800123 native_coverage: false,
Dan Willemsen208ae172015-09-16 16:33:27 -0700124
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800125 // This is placeholder library the actual implementation is (currently)
126 // provided by the linker.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800127 shared_libs: ["ld-android"],
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800128
129 sanitize: {
130 never: true,
131 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +0900132
133 stubs: {
134 symbol_file: "libdl.map.txt",
Jooyung Han26ddc4d2020-02-27 18:33:25 +0900135 versions: [
136 "29",
Dan Albert48943b22020-07-27 13:28:56 -0700137 "current",
Jooyung Han26ddc4d2020-02-27 18:33:25 +0900138 ],
Jiyong Parkc45fe9f2018-12-13 18:26:48 +0900139 },
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900140
141 apex_available: [
142 "//apex_available:platform",
143 "com.android.runtime",
144 ],
Yi Kong15a05a72020-09-22 00:56:13 +0800145
146 lto: {
147 never: true,
148 },
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800149}
150
dimitry8868d9e2019-03-19 13:01:42 +0100151cc_library {
152 name: "libdl_android",
153
154 defaults: ["linux_bionic_supported"],
Yifan Hong5a39cee2020-01-21 16:43:56 -0800155 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700156 vendor_ramdisk_available: true,
Jiyong Park3ff116a2019-04-02 23:04:52 +0900157 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +0200158 native_bridge_supported: true,
dimitry8868d9e2019-03-19 13:01:42 +0100159
160 // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
161 // libgcc.a are made static to libdl.so. This in turn ensures that libraries that
162 // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so
163 // to provide those symbols, but will instead pull them from libgcc.a. Specifically,
164 // we use this property to make sure libc.so has its own copy of the code from
165 // libgcc.a it uses.
166 //
167 // DO NOT REMOVE --exclude-libs!
168
169 ldflags: [
170 "-Wl,--exclude-libs=libgcc.a",
Yi Kong7ac2afb2019-05-06 16:23:10 -0700171 "-Wl,--exclude-libs=libgcc_stripped.a",
dimitry8868d9e2019-03-19 13:01:42 +0100172 "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
173 "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
Ryan Prichardef147872021-01-28 14:06:52 -0800174 "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
dimitry8868d9e2019-03-19 13:01:42 +0100175 "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
176 ],
177
178 // for x86, exclude libgcc_eh.a for the same reasons as above
179 arch: {
180 x86: {
181 ldflags: [
182 "-Wl,--exclude-libs=libgcc_eh.a",
183 ],
184 },
185 x86_64: {
186 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
187 },
188 },
189
190 srcs: [ "libdl_android.cpp" ],
191 version_script: "libdl_android.map.txt",
192
193 cflags: [
194 "-Wall",
195 "-Wextra",
196 "-Wunused",
197 "-Werror",
198 ],
199
200 stl: "none",
201
202 nocrt: true,
203 system_shared_libs: [],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +0100204 header_libs: ["libc_headers"],
dimitry8868d9e2019-03-19 13:01:42 +0100205
206 // Opt out of native_coverage when opting out of system_shared_libs
207 native_coverage: false,
208
209 // This is placeholder library the actual implementation is (currently)
210 // provided by the linker.
211 shared_libs: ["ld-android"],
212
213 sanitize: {
214 never: true,
215 },
216
217 stubs: {
218 symbol_file: "libdl_android.map.txt",
Dan Albert48943b22020-07-27 13:28:56 -0700219 versions: ["current"],
dimitry8868d9e2019-03-19 13:01:42 +0100220 },
Martin Stjernholm3274cc42019-11-11 15:33:22 +0000221
222 apex_available: [
223 "//apex_available:platform",
224 "com.android.runtime",
225 ],
Yi Kong15a05a72020-09-22 00:56:13 +0800226
227 lto: {
228 never: true,
229 },
dimitry8868d9e2019-03-19 13:01:42 +0100230}
231
Dan Alberte8a91082016-08-04 13:45:44 -0700232ndk_library {
Dan Willemsen993b0832017-04-07 14:09:18 -0700233 name: "libdl",
Dan Alberte8a91082016-08-04 13:45:44 -0700234 symbol_file: "libdl.map.txt",
235 first_version: "9",
236}
Dan Willemsenb93d3c22017-03-20 14:07:47 -0700237
238llndk_library {
Colin Cross8393a8b2020-10-19 13:37:49 -0700239 name: "libdl.llndk",
dimitry7f048802019-05-03 15:57:34 +0200240 native_bridge_supported: true,
Dan Willemsenb93d3c22017-03-20 14:07:47 -0700241 symbol_file: "libdl.map.txt",
242}
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700243
244genrule {
245 name: "libdl.arm.map",
246 out: ["libdl.arm.map"],
247 srcs: ["libdl.map.txt"],
248 tool_files: [":bionic-generate-version-script"],
249 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
250}
251
252genrule {
253 name: "libdl.arm64.map",
254 out: ["libdl.arm64.map"],
255 srcs: ["libdl.map.txt"],
256 tool_files: [":bionic-generate-version-script"],
257 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
258}
259
260genrule {
261 name: "libdl.x86.map",
262 out: ["libdl.x86.map"],
263 srcs: ["libdl.map.txt"],
264 tool_files: [":bionic-generate-version-script"],
265 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
266}
267
268genrule {
269 name: "libdl.x86_64.map",
270 out: ["libdl.x86_64.map"],
271 srcs: ["libdl.map.txt"],
272 tool_files: [":bionic-generate-version-script"],
273 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
274}