blob: 32305c8b4f97b4b185d53b9f4b3a0c352dc3c2e8 [file] [log] [blame]
Ryan Prichard80e40f02019-10-31 19:54:46 -07001// ========================================================
2// linker_wrapper - Linux Bionic (on the host)
3// ========================================================
Colin Cross97f0aef2016-07-14 16:05:46 -07004
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07005// This is used for bionic on (host) Linux to bootstrap our linker embedded into
6// a binary.
7//
8// Host bionic binaries do not have a PT_INTERP section, instead this gets
9// embedded as the entry point, and the linker is embedded as ELF sections in
10// each binary. There's a linker script that sets all of that up (generated by
11// extract_linker), and defines the extern symbols used in this file.
Bob Badouraa7d8352021-02-19 13:06:22 -080012package {
13 default_applicable_licenses: ["bionic_linker_license"],
14}
15
16license {
17 name: "bionic_linker_license",
18 visibility: [":__subpackages__"],
19 license_kinds: [
20 "SPDX-license-identifier-BSD",
21 ],
22 license_text: [
23 "NOTICE",
24 ],
25}
26
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070027cc_object {
28 name: "linker_wrapper",
29 host_supported: true,
30 device_supported: false,
Colin Crossda446cc2022-03-08 15:07:57 -080031 enabled: false,
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070032 target: {
Elliott Hughesd50a1de2018-02-05 17:30:57 -080033 linux_bionic: {
34 enabled: true,
35 },
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070036 },
37
38 cflags: [
39 "-fno-stack-protector",
40 "-Wstrict-overflow=5",
41 "-fvisibility=hidden",
42 "-Wall",
43 "-Wextra",
44 "-Wno-unused",
45 "-Werror",
46 ],
47
48 srcs: [
49 "linker_wrapper.cpp",
50 ],
51 arch: {
Jiyong Park3b47d602020-09-18 16:15:53 +090052 arm64: {
Colin Crossa0a591a2021-06-11 12:46:45 -070053 srcs: ["arch/arm64/linker_wrapper_begin.S"],
Jiyong Park3b47d602020-09-18 16:15:53 +090054 },
Elliott Hughes3e4f6032022-10-22 03:54:59 +000055 riscv64: {
56 srcs: ["arch/riscv64/linker_wrapper_begin.S"],
57 },
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070058 x86_64: {
Colin Crossa0a591a2021-06-11 12:46:45 -070059 srcs: ["arch/x86_64/linker_wrapper_begin.S"],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070060 },
61 },
62
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010063 header_libs: ["libc_headers"],
64
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070065 // We need to access Bionic private headers in the linker.
66 include_dirs: ["bionic/libc"],
67}
68
Ryan Prichard80e40f02019-10-31 19:54:46 -070069// ========================================================
70// linker default configuration
71// ========================================================
72
73// Configuration for the linker binary and any of its static libraries.
74cc_defaults {
75 name: "linker_defaults",
76 arch: {
77 arm: {
78 cflags: ["-D__work_around_b_24465209__"],
79 },
80 x86: {
81 cflags: ["-D__work_around_b_24465209__"],
82 },
83 },
84
85 cflags: [
86 "-fno-stack-protector",
87 "-Wstrict-overflow=5",
88 "-fvisibility=hidden",
89 "-Wall",
90 "-Wextra",
91 "-Wunused",
92 "-Werror",
93 ],
94
95 // TODO: split out the asflags.
96 asflags: [
97 "-fno-stack-protector",
98 "-Wstrict-overflow=5",
99 "-fvisibility=hidden",
100 "-Wall",
101 "-Wextra",
102 "-Wunused",
103 "-Werror",
104 ],
105
106 product_variables: {
107 debuggable: {
108 cppflags: ["-DUSE_LD_CONFIG_FILE"],
109 },
110 },
111
112 cppflags: ["-Wold-style-cast"],
113
114 static_libs: [
115 "libziparchive",
116 "libbase",
117 "libz",
118
119 "libasync_safe",
120
Jiyong Park7157dfb2022-08-19 13:09:18 +0900121 "liblog_for_runtime_apex",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700122 ],
123
124 // We need to access Bionic private headers in the linker.
125 include_dirs: ["bionic/libc"],
126}
127
128// ========================================================
129// linker components
130// ========================================================
131
132// Enable a module on all targets the linker runs on (ordinary Android targets, Linux Bionic, and
133// native bridge implementations).
134cc_defaults {
135 name: "linker_all_targets",
136 defaults: ["linux_bionic_supported"],
137 recovery_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700138 vendor_ramdisk_available: true,
Ryan Prichard80e40f02019-10-31 19:54:46 -0700139 native_bridge_supported: true,
140}
141
142cc_library_static {
Ryan Prichard249757b2019-11-01 17:18:28 -0700143 name: "liblinker_main",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000144 defaults: [
145 "linker_defaults",
146 "linker_all_targets",
147 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700148 srcs: ["linker_main.cpp"],
149
150 // Ensure that the compiler won't insert string function calls before ifuncs are resolved.
151 cflags: ["-ffreestanding"],
Spandan Das0a6cfe92024-01-04 18:06:50 +0000152 apex_available: [
153 "com.android.runtime",
154 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700155}
156
157cc_library_static {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700158 name: "liblinker_malloc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000159 defaults: [
160 "linker_defaults",
161 "linker_all_targets",
162 ],
Ryan Prichard80e40f02019-10-31 19:54:46 -0700163 srcs: ["linker_memory.cpp"],
Spandan Das0a6cfe92024-01-04 18:06:50 +0000164 apex_available: [
165 "com.android.runtime",
166 ],
Ryan Prichard80e40f02019-10-31 19:54:46 -0700167}
168
169cc_library_static {
170 name: "liblinker_debuggerd_stub",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000171 defaults: [
172 "linker_defaults",
173 "linker_all_targets",
174 ],
Ryan Prichard80e40f02019-10-31 19:54:46 -0700175 srcs: ["linker_debuggerd_stub.cpp"],
176}
177
178// ========================================================
179// template for the linker binary
180// ========================================================
181
dimitryb8b3a762018-09-25 12:31:11 +0200182filegroup {
183 name: "linker_sources",
Colin Cross97f0aef2016-07-14 16:05:46 -0700184 srcs: [
185 "dlfcn.cpp",
186 "linker.cpp",
Elliott Hughes838dbac2023-08-22 14:07:48 -0700187 "linker_auxv.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700188 "linker_block_allocator.cpp",
Dimitry Ivanov769b33f2016-07-21 11:33:40 -0700189 "linker_dlwarning.cpp",
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700190 "linker_cfi.cpp",
Dimitry Ivanov4cabfaa2017-03-07 11:19:05 -0800191 "linker_config.cpp",
Ryan Prichard551565e2019-12-23 16:03:14 -0800192 "linker_debug.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700193 "linker_gdb_support.cpp",
Dimitry Ivanov48ec2882016-08-04 11:50:36 -0700194 "linker_globals.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700195 "linker_libc_support.c",
Dimitry Ivanov451909d2017-01-26 16:52:59 -0800196 "linker_libcxx_support.cpp",
Dimitry Ivanovb943f302016-08-03 16:00:10 -0700197 "linker_namespaces.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700198 "linker_logger.cpp",
199 "linker_mapped_file_fragment.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100200 "linker_note_gnu_property.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700201 "linker_phdr.cpp",
Ryan Prichard339ecef2020-01-02 16:36:06 -0800202 "linker_relocate.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700203 "linker_sdk_versions.cpp",
Dimitry Ivanov48ec2882016-08-04 11:50:36 -0700204 "linker_soinfo.cpp",
Collin Fijalkovich47d27aa2021-03-24 10:17:39 -0700205 "linker_transparent_hugepage_support.cpp",
Ryan Prichard45d13492019-01-03 02:51:30 -0800206 "linker_tls.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700207 "linker_utils.cpp",
208 "rt.cpp",
209 ],
dimitryb8b3a762018-09-25 12:31:11 +0200210}
Colin Cross97f0aef2016-07-14 16:05:46 -0700211
dimitryb8b3a762018-09-25 12:31:11 +0200212filegroup {
213 name: "linker_sources_arm",
214 srcs: [
215 "arch/arm/begin.S",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800216 "arch/arm_neon/linker_gnu_hash_neon.cpp",
dimitryb8b3a762018-09-25 12:31:11 +0200217 ],
218}
219
220filegroup {
221 name: "linker_sources_arm64",
222 srcs: [
223 "arch/arm64/begin.S",
Ryan Prichardffaae702019-01-23 17:47:10 -0800224 "arch/arm64/tlsdesc_resolver.S",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800225 "arch/arm_neon/linker_gnu_hash_neon.cpp",
dimitryb8b3a762018-09-25 12:31:11 +0200226 ],
227}
228
229filegroup {
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000230 name: "linker_sources_riscv64",
231 srcs: [
232 "arch/riscv64/begin.S",
233 ],
234}
235
236filegroup {
dimitryb8b3a762018-09-25 12:31:11 +0200237 name: "linker_sources_x86",
238 srcs: [
239 "arch/x86/begin.S",
240 ],
241}
242
243filegroup {
244 name: "linker_sources_x86_64",
245 srcs: [
246 "arch/x86_64/begin.S",
247 ],
248}
249
dimitryb8b3a762018-09-25 12:31:11 +0200250cc_defaults {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700251 name: "linker_version_script_overlay",
252 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000253 arm: {
254 version_script: "linker.arm.map",
255 },
256 arm64: {
257 version_script: "linker.generic.map",
258 },
259 riscv64: {
260 version_script: "linker.generic.map",
261 },
262 x86: {
263 version_script: "linker.generic.map",
264 },
265 x86_64: {
266 version_script: "linker.generic.map",
267 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700268 },
269}
270
271// A template for the linker binary. May be inherited by native bridge implementations.
272cc_defaults {
273 name: "linker_bin_template",
274 defaults: ["linker_defaults"],
275
276 srcs: [":linker_sources"],
277
Colin Cross97f0aef2016-07-14 16:05:46 -0700278 arch: {
279 arm: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700280 srcs: [":linker_sources_arm"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700281
282 // Arm 32 bit does not produce complete exidx unwind information
283 // so keep the .debug_frame which is relatively small and does
284 // include needed unwind information.
285 // See b/242162222 for details.
286 strip: {
287 keep_symbols_and_debug_frame: true,
288 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700289 },
290 arm64: {
291 srcs: [":linker_sources_arm64"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700292
293 // Leave the symbols in the shared library so that stack unwinders can produce
294 // meaningful name resolution.
295 strip: {
296 keep_symbols: true,
297 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700298 },
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000299 riscv64: {
300 srcs: [":linker_sources_riscv64"],
301
302 // Leave the symbols in the shared library so that stack unwinders can produce
303 // meaningful name resolution.
304 strip: {
305 keep_symbols: true,
306 },
307 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700308 x86: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700309 srcs: [":linker_sources_x86"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700310
311 // Leave the symbols in the shared library so that stack unwinders can produce
312 // meaningful name resolution.
313 strip: {
314 keep_symbols: true,
315 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700316 },
317 x86_64: {
318 srcs: [":linker_sources_x86_64"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700319
320 // Leave the symbols in the shared library so that stack unwinders can produce
321 // meaningful name resolution.
322 strip: {
323 keep_symbols: true,
324 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700325 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700326 },
327
Ryan Prichard80e40f02019-10-31 19:54:46 -0700328 // -shared is used to overwrite the -Bstatic and -static flags triggered by enabling
329 // static_executable. This dynamic linker is actually a shared object linked with static
330 // libraries.
Colin Cross97f0aef2016-07-14 16:05:46 -0700331 ldflags: [
332 "-shared",
333 "-Wl,-Bsymbolic",
334 "-Wl,--exclude-libs,ALL",
dimitry8e8c2c02018-01-04 12:08:32 +0100335 "-Wl,-soname,ld-android.so",
Colin Cross97f0aef2016-07-14 16:05:46 -0700336 ],
337
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -0800338 // we are going to link libc++_static manually because
339 // when stl is not set to "none" build system adds libdl
340 // to the list of static libraries which needs to be
341 // avoided in the case of building loader.
342 stl: "none",
343
Colin Cross97f0aef2016-07-14 16:05:46 -0700344 // we don't want crtbegin.o (because we have begin.o), so unset it
345 // just for this module
346 nocrt: true,
347
dimitryb8b3a762018-09-25 12:31:11 +0200348 static_executable: true,
349
dimitryb8b3a762018-09-25 12:31:11 +0200350 // Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb
351 // looking up symbols in the linker by mistake.
352 prefix_symbols: "__dl_",
353
354 sanitize: {
355 hwaddress: false,
356 },
dimitryb8b3a762018-09-25 12:31:11 +0200357
Colin Cross97f0aef2016-07-14 16:05:46 -0700358 static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -0700359 "liblinker_main",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700360 "liblinker_malloc",
361
362 "libc++_static",
Colin Cross97f0aef2016-07-14 16:05:46 -0700363 "libc_nomalloc",
Ryan Prichard249757b2019-11-01 17:18:28 -0700364 "libc_dynamic_dispatch",
Dimitry Ivanov451909d2017-01-26 16:52:59 -0800365 "libm",
Ryan Prichardcdf71752020-12-16 03:37:22 -0800366 "libunwind",
Colin Cross97f0aef2016-07-14 16:05:46 -0700367 ],
Colin Cross97f0aef2016-07-14 16:05:46 -0700368
Ryan Prichardd9a41152019-10-14 16:58:53 -0700369 // Ensure that if the linker needs __gnu_Unwind_Find_exidx, then the linker will have a
370 // definition of the symbol. The linker links against libgcc.a, whose arm32 unwinder has a weak
371 // reference to __gnu_Unwind_Find_exidx, which isn't sufficient to pull in the strong definition
372 // of __gnu_Unwind_Find_exidx from libc. An unresolved weak reference would create a
373 // non-relative dynamic relocation in the linker binary, which complicates linker startup.
374 //
375 // This line should be unnecessary because the linker's dependency on libunwind_llvm.a should
376 // override libgcc.a, but this line provides a simpler guarantee. It can be removed once the
377 // linker stops linking against libgcc.a's arm32 unwinder.
378 whole_static_libs: ["libc_unwind_static"],
379
Ryan Prichard80e40f02019-10-31 19:54:46 -0700380 system_shared_libs: [],
381
382 // Opt out of native_coverage when opting out of system_shared_libs
383 native_coverage: false,
384}
385
386// ========================================================
387// linker[_asan][64] binary
388// ========================================================
389
390cc_binary {
Colin Cross97f0aef2016-07-14 16:05:46 -0700391 name: "linker",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700392 defaults: [
393 "linker_bin_template",
394 "linux_bionic_supported",
395 "linker_version_script_overlay",
396 ],
397
Victor Khimenkod15229d2020-05-14 22:14:45 +0200398 srcs: [
399 "linker_translate_path.cpp",
400 ],
401
Colin Cross10fffb42016-12-08 09:57:35 -0800402 symlinks: ["linker_asan"],
Florian Mayerc10d0642023-03-22 16:12:49 -0700403 arch: {
404 arm64: {
405 symlinks: ["linker_hwasan"],
406 },
407 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700408 multilib: {
Colin Cross97f0aef2016-07-14 16:05:46 -0700409 lib64: {
410 suffix: "64",
Colin Cross10fffb42016-12-08 09:57:35 -0800411 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700412 },
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800413
Ryan Prichard80e40f02019-10-31 19:54:46 -0700414 compile_multilib: "both",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700415
416 recovery_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700417 vendor_ramdisk_available: true,
Ryan Prichard80e40f02019-10-31 19:54:46 -0700418 apex_available: [
419 "//apex_available:platform",
420 "com.android.runtime",
421 ],
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800422
Colin Cross97f0aef2016-07-14 16:05:46 -0700423 target: {
Dan Willemsen7ec52b12016-11-28 17:02:25 -0800424 android: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700425 srcs: [
426 "linker_debuggerd_android.cpp",
427 ],
Dan Albert4ea19212019-07-23 13:31:14 -0700428 static_libs: [
429 "libc++demangle",
430 "libdebuggerd_handler_fallback",
431 ],
Dan Willemsen7ec52b12016-11-28 17:02:25 -0800432 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700433 linux_bionic: {
434 static_libs: [
435 "liblinker_debuggerd_stub",
436 ],
Yi Kong6f6daaa2020-12-10 01:27:44 +0800437 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700438 },
Yi Konga7e363f2020-10-01 04:10:01 +0800439
Yi Konge20a1d92022-01-25 03:19:58 +0800440 afdo: true,
Colin Cross97f0aef2016-07-14 16:05:46 -0700441}
dimitry11da1dc2018-01-05 13:35:43 +0100442
Ryan Prichard80e40f02019-10-31 19:54:46 -0700443// ========================================================
444// assorted modules
445// ========================================================
446
Elliott Hughes90f96b92019-05-09 15:56:39 -0700447sh_binary {
448 name: "ldd",
Rupert Shuttlewortha7e29a82021-02-18 13:35:22 +0000449 src: "ldd.sh",
Elliott Hughes90f96b92019-05-09 15:56:39 -0700450}
451
Collin Fijalkovichc9521e02021-04-29 11:31:50 -0700452// Used to generate binaries that can be backed by transparent hugepages.
453cc_defaults {
454 name: "linker_hugepage_aligned",
455 arch: {
456 arm64: {
457 ldflags: ["-z max-page-size=0x200000"],
458 },
459 x86_64: {
460 ldflags: ["-z max-page-size=0x200000"],
461 },
462 },
463}
464
dimitry11da1dc2018-01-05 13:35:43 +0100465cc_library {
466 // NOTE: --exclude-libs=libgcc.a makes sure that any symbols ld-android.so pulls from
467 // libgcc.a are made static to ld-android.so. This in turn ensures that libraries that
468 // a) pull symbols from libgcc.a and b) depend on ld-android.so will not rely on ld-android.so
469 // to provide those symbols, but will instead pull them from libgcc.a. Specifically,
470 // we use this property to make sure libc.so has its own copy of the code from
471 // libgcc.a it uses.
472 //
473 // DO NOT REMOVE --exclude-libs!
474
Yi Kong7786a342018-08-31 19:01:56 -0700475 ldflags: [
476 "-Wl,--exclude-libs=libgcc.a",
Yi Kong7ac2afb2019-05-06 16:23:10 -0700477 "-Wl,--exclude-libs=libgcc_stripped.a",
Yi Kong7786a342018-08-31 19:01:56 -0700478 "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
479 "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000480 "-Wl,--exclude-libs=libclang_rt.builtins-riscv64-android.a",
Ryan Prichardef147872021-01-28 14:06:52 -0800481 "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
Yi Kong7786a342018-08-31 19:01:56 -0700482 "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
483 ],
dimitry11da1dc2018-01-05 13:35:43 +0100484
485 // for x86, exclude libgcc_eh.a for the same reasons as above
486 arch: {
487 x86: {
488 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
489 },
490 x86_64: {
491 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
492 },
493 },
dimitry581723e2018-01-05 14:31:44 +0100494
495 srcs: ["ld_android.cpp"],
dimitry11da1dc2018-01-05 13:35:43 +0100496 cflags: [
497 "-Wall",
498 "-Wextra",
499 "-Wunused",
500 "-Werror",
501 ],
502 stl: "none",
503
504 name: "ld-android",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000505 defaults: [
506 "linux_bionic_supported",
507 "linker_version_script_overlay",
508 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -0800509 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700510 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +0900511 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +0200512 native_bridge_supported: true,
dimitry11da1dc2018-01-05 13:35:43 +0100513
Ryan Prichard470b6662018-03-27 22:10:55 -0700514 nocrt: true,
dimitry11da1dc2018-01-05 13:35:43 +0100515 system_shared_libs: [],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +0100516 header_libs: ["libc_headers"],
dimitry11da1dc2018-01-05 13:35:43 +0100517
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800518 // Opt out of native_coverage when opting out of system_shared_libs
519 native_coverage: false,
520
dimitry11da1dc2018-01-05 13:35:43 +0100521 sanitize: {
522 never: true,
523 },
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900524
525 apex_available: [
526 "//apex_available:platform",
527 "com.android.runtime",
528 ],
dimitry11da1dc2018-01-05 13:35:43 +0100529}
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800530
531cc_test {
532 name: "linker-unit-tests",
Colin Cross0cc60af2021-09-30 14:04:39 -0700533 test_suites: ["device-tests"],
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800534
535 cflags: [
536 "-g",
537 "-Wall",
538 "-Wextra",
539 "-Wunused",
540 "-Werror",
541 ],
542
543 // We need to access Bionic private headers in the linker.
544 include_dirs: ["bionic/libc"],
545
546 srcs: [
547 // Tests.
548 "linker_block_allocator_test.cpp",
549 "linker_config_test.cpp",
550 "linked_list_test.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100551 "linker_note_gnu_property_test.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800552 "linker_sleb128_test.cpp",
553 "linker_utils_test.cpp",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800554 "linker_gnu_hash_test.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800555
556 // Parts of the linker that we're testing.
557 "linker_block_allocator.cpp",
558 "linker_config.cpp",
Ryan Prichard551565e2019-12-23 16:03:14 -0800559 "linker_debug.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100560 "linker_note_gnu_property.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800561 "linker_test_globals.cpp",
562 "linker_utils.cpp",
563 ],
564
565 static_libs: [
566 "libasync_safe",
567 "libbase",
Jiyong Park7157dfb2022-08-19 13:09:18 +0900568 "liblog_for_runtime_apex",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800569 ],
Ryan Prichard129f7a12019-12-23 16:45:47 -0800570
571 arch: {
572 arm: {
573 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
574 },
575 arm64: {
576 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
577 },
578 },
579}
580
581cc_benchmark {
582 name: "linker-benchmarks",
583
584 srcs: [
585 "linker_gnu_hash_benchmark.cpp",
586 ],
587
588 arch: {
589 arm: {
590 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
591 },
592 arm64: {
593 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
594 },
595 },
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800596}