blob: c7d7cf300d6307760cddf1b749c2fb8892989814 [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 },
Spandan Das0a6cfe92024-01-04 18:06:50 +000050 apex_available: [
51 "com.android.runtime",
52 ],
dimitryc5ea3eb2017-10-05 17:23:10 +020053}
54
Dan Willemsen208ae172015-09-16 16:33:27 -070055cc_library {
Dan Willemsen7ec52b12016-11-28 17:02:25 -080056 name: "libdl",
Yifan Hong5a39cee2020-01-21 16:43:56 -080057 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -070058 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090059 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020060 native_bridge_supported: true,
Dan Albert40f15ec2017-10-27 11:21:20 -070061 static_ndk_lib: true,
Dan Willemsen7ec52b12016-11-28 17:02:25 -080062
63 defaults: ["linux_bionic_supported"],
Dan Willemsen208ae172015-09-16 16:33:27 -070064
65 // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
66 // libgcc.a are made static to libdl.so. This in turn ensures that libraries that
67 // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so
68 // to provide those symbols, but will instead pull them from libgcc.a. Specifically,
69 // we use this property to make sure libc.so has its own copy of the code from
70 // libgcc.a it uses.
71 //
72 // DO NOT REMOVE --exclude-libs!
73
Yi Kong7786a342018-08-31 19:01:56 -070074 ldflags: [
75 "-Wl,--exclude-libs=libgcc.a",
Yi Kong7ac2afb2019-05-06 16:23:10 -070076 "-Wl,--exclude-libs=libgcc_stripped.a",
Yi Kong7786a342018-08-31 19:01:56 -070077 "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
78 "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
Ryan Prichardef147872021-01-28 14:06:52 -080079 "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
Elliott Hughesed70c172022-10-11 19:01:30 +000080 "-Wl,--exclude-libs=libclang_rt.builtins-riscv64-android.a",
Yi Kong7786a342018-08-31 19:01:56 -070081 "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
82 ],
Dan Willemsen208ae172015-09-16 16:33:27 -070083
84 // for x86, exclude libgcc_eh.a for the same reasons as above
85 arch: {
Dan Willemsen9e6f98f2015-11-03 14:30:57 -080086 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -070087 version_script: ":libdl.arm.map",
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -070088 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -080089 ldflags: ["-Wl,--hash-style=both"],
Dan Willemsen9e6f98f2015-11-03 14:30:57 -080090 },
91 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -070092 version_script: ":libdl.arm64.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -080093 },
Elliott Hughesed70c172022-10-11 19:01:30 +000094 riscv64: {
95 version_script: ":libdl.riscv64.map",
96 },
Dan Willemsen208ae172015-09-16 16:33:27 -070097 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -070098 pack_relocations: false,
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -080099 ldflags: [
100 "-Wl,--exclude-libs=libgcc_eh.a",
Ian Pedowitzb6310c22018-01-18 16:26:19 -0800101 "-Wl,--hash-style=both",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800102 ],
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700103 version_script: ":libdl.x86.map",
Dan Willemsen208ae172015-09-16 16:33:27 -0700104 },
105 x86_64: {
106 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700107 version_script: ":libdl.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -0700108 },
109 },
dimitrydc7cc622017-08-30 10:52:19 +0200110 shared: {
dimitryc5ea3eb2017-10-05 17:23:10 +0200111 whole_static_libs: ["libdl_static"],
dimitrydc7cc622017-08-30 10:52:19 +0200112 },
113 static: {
Elliott Hughes46a943c2018-04-03 15:56:35 -0700114 srcs: ["libdl_static.cpp"],
dimitrydc7cc622017-08-30 10:52:19 +0200115 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700116 cflags: [
117 "-Wall",
118 "-Wextra",
119 "-Wunused",
120 "-Werror",
121 ],
122 stl: "none",
123
Ryan Prichard470b6662018-03-27 22:10:55 -0700124 nocrt: true,
Dan Willemsen208ae172015-09-16 16:33:27 -0700125 system_shared_libs: [],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +0100126 header_libs: ["libc_headers"],
Pirama Arumuga Nainareeb2ee62019-02-15 11:40:40 -0800127
128 // Opt out of native_coverage when opting out of system_shared_libs
Pirama Arumuga Nainar852d5232018-12-20 13:52:19 -0800129 native_coverage: false,
Dan Willemsen208ae172015-09-16 16:33:27 -0700130
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800131 // This is placeholder library the actual implementation is (currently)
132 // provided by the linker.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800133 shared_libs: ["ld-android"],
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800134
135 sanitize: {
136 never: true,
137 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +0900138
139 stubs: {
140 symbol_file: "libdl.map.txt",
Jooyung Han26ddc4d2020-02-27 18:33:25 +0900141 versions: [
142 "29",
Dan Albert48943b22020-07-27 13:28:56 -0700143 "current",
Jooyung Han26ddc4d2020-02-27 18:33:25 +0900144 ],
Jiyong Parkc45fe9f2018-12-13 18:26:48 +0900145 },
Colin Crossa0a4a6c2021-03-02 10:23:04 -0800146 llndk: {
147 symbol_file: "libdl.map.txt",
148 },
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900149
150 apex_available: [
151 "//apex_available:platform",
152 "com.android.runtime",
153 ],
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800154}
155
dimitry8868d9e2019-03-19 13:01:42 +0100156cc_library {
157 name: "libdl_android",
158
159 defaults: ["linux_bionic_supported"],
Yifan Hong5a39cee2020-01-21 16:43:56 -0800160 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700161 vendor_ramdisk_available: true,
Jiyong Park3ff116a2019-04-02 23:04:52 +0900162 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +0200163 native_bridge_supported: true,
dimitry8868d9e2019-03-19 13:01:42 +0100164
165 // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
166 // libgcc.a are made static to libdl.so. This in turn ensures that libraries that
167 // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so
168 // to provide those symbols, but will instead pull them from libgcc.a. Specifically,
169 // we use this property to make sure libc.so has its own copy of the code from
170 // libgcc.a it uses.
171 //
172 // DO NOT REMOVE --exclude-libs!
173
174 ldflags: [
175 "-Wl,--exclude-libs=libgcc.a",
Yi Kong7ac2afb2019-05-06 16:23:10 -0700176 "-Wl,--exclude-libs=libgcc_stripped.a",
dimitry8868d9e2019-03-19 13:01:42 +0100177 "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
178 "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
Ryan Prichardef147872021-01-28 14:06:52 -0800179 "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
Elliott Hughesed70c172022-10-11 19:01:30 +0000180 "-Wl,--exclude-libs=libclang_rt.builtins-riscv64-android.a",
dimitry8868d9e2019-03-19 13:01:42 +0100181 "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
182 ],
183
184 // for x86, exclude libgcc_eh.a for the same reasons as above
185 arch: {
186 x86: {
187 ldflags: [
188 "-Wl,--exclude-libs=libgcc_eh.a",
189 ],
190 },
191 x86_64: {
192 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
193 },
194 },
195
196 srcs: [ "libdl_android.cpp" ],
197 version_script: "libdl_android.map.txt",
198
199 cflags: [
200 "-Wall",
201 "-Wextra",
202 "-Wunused",
203 "-Werror",
204 ],
205
206 stl: "none",
207
208 nocrt: true,
209 system_shared_libs: [],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +0100210 header_libs: ["libc_headers"],
dimitry8868d9e2019-03-19 13:01:42 +0100211
212 // Opt out of native_coverage when opting out of system_shared_libs
213 native_coverage: false,
214
215 // This is placeholder library the actual implementation is (currently)
216 // provided by the linker.
217 shared_libs: ["ld-android"],
218
219 sanitize: {
220 never: true,
221 },
222
223 stubs: {
224 symbol_file: "libdl_android.map.txt",
Dan Albert48943b22020-07-27 13:28:56 -0700225 versions: ["current"],
dimitry8868d9e2019-03-19 13:01:42 +0100226 },
Martin Stjernholm3274cc42019-11-11 15:33:22 +0000227
228 apex_available: [
229 "//apex_available:platform",
230 "com.android.runtime",
231 ],
dimitry8868d9e2019-03-19 13:01:42 +0100232}
233
Dan Alberte8a91082016-08-04 13:45:44 -0700234ndk_library {
Dan Willemsen993b0832017-04-07 14:09:18 -0700235 name: "libdl",
Dan Alberte8a91082016-08-04 13:45:44 -0700236 symbol_file: "libdl.map.txt",
237 first_version: "9",
238}
Dan Willemsenb93d3c22017-03-20 14:07:47 -0700239
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700240genrule {
241 name: "libdl.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -0700242 out: ["libdl.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700243 srcs: ["libdl.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +0000244 tools: ["generate-version-script"],
245 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700246}
247
248genrule {
249 name: "libdl.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -0700250 out: ["libdl.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700251 srcs: ["libdl.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +0000252 tools: ["generate-version-script"],
253 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700254}
255
256genrule {
Elliott Hughesed70c172022-10-11 19:01:30 +0000257 name: "libdl.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -0700258 out: ["libdl.riscv64.map.txt"],
Elliott Hughesed70c172022-10-11 19:01:30 +0000259 srcs: ["libdl.map.txt"],
260 tools: ["generate-version-script"],
261 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
262}
263
264genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700265 name: "libdl.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -0700266 out: ["libdl.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700267 srcs: ["libdl.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +0000268 tools: ["generate-version-script"],
269 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700270}
271
272genrule {
273 name: "libdl.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -0700274 out: ["libdl.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700275 srcs: ["libdl.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +0000276 tools: ["generate-version-script"],
277 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -0700278}