blob: 0533ae97baec1fd263e547f916f1aad250e1b761 [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 {
Aditya Choudharyd9d37c02024-02-02 13:57:12 +000013 default_team: "trendy_team_native_tools_libraries",
Bob Badouraa7d8352021-02-19 13:06:22 -080014 default_applicable_licenses: ["bionic_linker_license"],
15}
16
17license {
18 name: "bionic_linker_license",
19 visibility: [":__subpackages__"],
20 license_kinds: [
21 "SPDX-license-identifier-BSD",
22 ],
23 license_text: [
24 "NOTICE",
25 ],
26}
27
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070028cc_object {
29 name: "linker_wrapper",
30 host_supported: true,
31 device_supported: false,
Colin Crossda446cc2022-03-08 15:07:57 -080032 enabled: false,
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070033 target: {
Elliott Hughesd50a1de2018-02-05 17:30:57 -080034 linux_bionic: {
35 enabled: true,
36 },
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070037 },
38
39 cflags: [
40 "-fno-stack-protector",
41 "-Wstrict-overflow=5",
42 "-fvisibility=hidden",
43 "-Wall",
44 "-Wextra",
45 "-Wno-unused",
46 "-Werror",
47 ],
48
49 srcs: [
50 "linker_wrapper.cpp",
51 ],
52 arch: {
Jiyong Park3b47d602020-09-18 16:15:53 +090053 arm64: {
Colin Crossa0a591a2021-06-11 12:46:45 -070054 srcs: ["arch/arm64/linker_wrapper_begin.S"],
Jiyong Park3b47d602020-09-18 16:15:53 +090055 },
Elliott Hughes3e4f6032022-10-22 03:54:59 +000056 riscv64: {
57 srcs: ["arch/riscv64/linker_wrapper_begin.S"],
58 },
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070059 x86_64: {
Colin Crossa0a591a2021-06-11 12:46:45 -070060 srcs: ["arch/x86_64/linker_wrapper_begin.S"],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070061 },
62 },
63
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010064 header_libs: ["libc_headers"],
65
Dan Willemsen7ccc50d2017-09-18 21:28:14 -070066 // We need to access Bionic private headers in the linker.
67 include_dirs: ["bionic/libc"],
68}
69
Ryan Prichard80e40f02019-10-31 19:54:46 -070070// ========================================================
71// linker default configuration
72// ========================================================
73
74// Configuration for the linker binary and any of its static libraries.
75cc_defaults {
76 name: "linker_defaults",
77 arch: {
78 arm: {
79 cflags: ["-D__work_around_b_24465209__"],
80 },
81 x86: {
82 cflags: ["-D__work_around_b_24465209__"],
83 },
84 },
85
86 cflags: [
87 "-fno-stack-protector",
88 "-Wstrict-overflow=5",
89 "-fvisibility=hidden",
90 "-Wall",
91 "-Wextra",
92 "-Wunused",
93 "-Werror",
94 ],
95
96 // TODO: split out the asflags.
97 asflags: [
98 "-fno-stack-protector",
99 "-Wstrict-overflow=5",
100 "-fvisibility=hidden",
101 "-Wall",
102 "-Wextra",
103 "-Wunused",
104 "-Werror",
105 ],
106
107 product_variables: {
108 debuggable: {
109 cppflags: ["-DUSE_LD_CONFIG_FILE"],
110 },
111 },
112
113 cppflags: ["-Wold-style-cast"],
114
115 static_libs: [
116 "libziparchive",
117 "libbase",
118 "libz",
119
120 "libasync_safe",
121
Jiyong Park7157dfb2022-08-19 13:09:18 +0900122 "liblog_for_runtime_apex",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700123 ],
124
125 // We need to access Bionic private headers in the linker.
126 include_dirs: ["bionic/libc"],
127}
128
129// ========================================================
130// linker components
131// ========================================================
132
133// Enable a module on all targets the linker runs on (ordinary Android targets, Linux Bionic, and
134// native bridge implementations).
135cc_defaults {
136 name: "linker_all_targets",
137 defaults: ["linux_bionic_supported"],
138 recovery_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700139 vendor_ramdisk_available: true,
Ryan Prichard80e40f02019-10-31 19:54:46 -0700140 native_bridge_supported: true,
141}
142
143cc_library_static {
Ryan Prichard249757b2019-11-01 17:18:28 -0700144 name: "liblinker_main",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000145 defaults: [
146 "linker_defaults",
147 "linker_all_targets",
148 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700149 srcs: ["linker_main.cpp"],
150
151 // Ensure that the compiler won't insert string function calls before ifuncs are resolved.
152 cflags: ["-ffreestanding"],
Spandan Das0a6cfe92024-01-04 18:06:50 +0000153 apex_available: [
154 "com.android.runtime",
155 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700156}
157
158cc_library_static {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700159 name: "liblinker_malloc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000160 defaults: [
161 "linker_defaults",
162 "linker_all_targets",
163 ],
Ryan Prichard80e40f02019-10-31 19:54:46 -0700164 srcs: ["linker_memory.cpp"],
Spandan Das0a6cfe92024-01-04 18:06:50 +0000165 apex_available: [
166 "com.android.runtime",
167 ],
Ryan Prichard80e40f02019-10-31 19:54:46 -0700168}
169
170cc_library_static {
171 name: "liblinker_debuggerd_stub",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000172 defaults: [
173 "linker_defaults",
174 "linker_all_targets",
175 ],
Ryan Prichard80e40f02019-10-31 19:54:46 -0700176 srcs: ["linker_debuggerd_stub.cpp"],
177}
178
179// ========================================================
180// template for the linker binary
181// ========================================================
182
dimitryb8b3a762018-09-25 12:31:11 +0200183filegroup {
184 name: "linker_sources",
Colin Cross97f0aef2016-07-14 16:05:46 -0700185 srcs: [
186 "dlfcn.cpp",
187 "linker.cpp",
Elliott Hughes838dbac2023-08-22 14:07:48 -0700188 "linker_auxv.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700189 "linker_block_allocator.cpp",
Dimitry Ivanov769b33f2016-07-21 11:33:40 -0700190 "linker_dlwarning.cpp",
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700191 "linker_cfi.cpp",
Dimitry Ivanov4cabfaa2017-03-07 11:19:05 -0800192 "linker_config.cpp",
Ryan Prichard551565e2019-12-23 16:03:14 -0800193 "linker_debug.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700194 "linker_gdb_support.cpp",
Dimitry Ivanov48ec2882016-08-04 11:50:36 -0700195 "linker_globals.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700196 "linker_libc_support.c",
Dimitry Ivanov451909d2017-01-26 16:52:59 -0800197 "linker_libcxx_support.cpp",
Dimitry Ivanovb943f302016-08-03 16:00:10 -0700198 "linker_namespaces.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700199 "linker_logger.cpp",
200 "linker_mapped_file_fragment.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100201 "linker_note_gnu_property.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700202 "linker_phdr.cpp",
Ryan Prichard339ecef2020-01-02 16:36:06 -0800203 "linker_relocate.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700204 "linker_sdk_versions.cpp",
Dimitry Ivanov48ec2882016-08-04 11:50:36 -0700205 "linker_soinfo.cpp",
Collin Fijalkovich47d27aa2021-03-24 10:17:39 -0700206 "linker_transparent_hugepage_support.cpp",
Ryan Prichard45d13492019-01-03 02:51:30 -0800207 "linker_tls.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700208 "linker_utils.cpp",
209 "rt.cpp",
210 ],
dimitryb8b3a762018-09-25 12:31:11 +0200211}
Colin Cross97f0aef2016-07-14 16:05:46 -0700212
dimitryb8b3a762018-09-25 12:31:11 +0200213filegroup {
214 name: "linker_sources_arm",
215 srcs: [
216 "arch/arm/begin.S",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800217 "arch/arm_neon/linker_gnu_hash_neon.cpp",
dimitryb8b3a762018-09-25 12:31:11 +0200218 ],
219}
220
221filegroup {
222 name: "linker_sources_arm64",
223 srcs: [
224 "arch/arm64/begin.S",
Ryan Prichardffaae702019-01-23 17:47:10 -0800225 "arch/arm64/tlsdesc_resolver.S",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800226 "arch/arm_neon/linker_gnu_hash_neon.cpp",
dimitryb8b3a762018-09-25 12:31:11 +0200227 ],
228}
229
230filegroup {
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000231 name: "linker_sources_riscv64",
232 srcs: [
233 "arch/riscv64/begin.S",
234 ],
235}
236
237filegroup {
dimitryb8b3a762018-09-25 12:31:11 +0200238 name: "linker_sources_x86",
239 srcs: [
240 "arch/x86/begin.S",
241 ],
242}
243
244filegroup {
245 name: "linker_sources_x86_64",
246 srcs: [
247 "arch/x86_64/begin.S",
248 ],
249}
250
dimitryb8b3a762018-09-25 12:31:11 +0200251cc_defaults {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700252 name: "linker_version_script_overlay",
253 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000254 arm: {
255 version_script: "linker.arm.map",
256 },
257 arm64: {
258 version_script: "linker.generic.map",
259 },
260 riscv64: {
261 version_script: "linker.generic.map",
262 },
263 x86: {
264 version_script: "linker.generic.map",
265 },
266 x86_64: {
267 version_script: "linker.generic.map",
268 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700269 },
270}
271
272// A template for the linker binary. May be inherited by native bridge implementations.
273cc_defaults {
274 name: "linker_bin_template",
275 defaults: ["linker_defaults"],
276
277 srcs: [":linker_sources"],
278
Colin Cross97f0aef2016-07-14 16:05:46 -0700279 arch: {
280 arm: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700281 srcs: [":linker_sources_arm"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700282
283 // Arm 32 bit does not produce complete exidx unwind information
284 // so keep the .debug_frame which is relatively small and does
285 // include needed unwind information.
286 // See b/242162222 for details.
287 strip: {
288 keep_symbols_and_debug_frame: true,
289 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700290 },
291 arm64: {
292 srcs: [":linker_sources_arm64"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700293
294 // Leave the symbols in the shared library so that stack unwinders can produce
295 // meaningful name resolution.
296 strip: {
297 keep_symbols: true,
298 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700299 },
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000300 riscv64: {
301 srcs: [":linker_sources_riscv64"],
302
303 // Leave the symbols in the shared library so that stack unwinders can produce
304 // meaningful name resolution.
305 strip: {
306 keep_symbols: true,
307 },
308 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700309 x86: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700310 srcs: [":linker_sources_x86"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700311
312 // Leave the symbols in the shared library so that stack unwinders can produce
313 // meaningful name resolution.
314 strip: {
315 keep_symbols: true,
316 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700317 },
318 x86_64: {
319 srcs: [":linker_sources_x86_64"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700320
321 // Leave the symbols in the shared library so that stack unwinders can produce
322 // meaningful name resolution.
323 strip: {
324 keep_symbols: true,
325 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700326 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700327 },
328
Ryan Prichard80e40f02019-10-31 19:54:46 -0700329 // -shared is used to overwrite the -Bstatic and -static flags triggered by enabling
330 // static_executable. This dynamic linker is actually a shared object linked with static
331 // libraries.
Colin Cross97f0aef2016-07-14 16:05:46 -0700332 ldflags: [
333 "-shared",
334 "-Wl,-Bsymbolic",
335 "-Wl,--exclude-libs,ALL",
dimitry8e8c2c02018-01-04 12:08:32 +0100336 "-Wl,-soname,ld-android.so",
Colin Cross97f0aef2016-07-14 16:05:46 -0700337 ],
338
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -0800339 // we are going to link libc++_static manually because
340 // when stl is not set to "none" build system adds libdl
341 // to the list of static libraries which needs to be
342 // avoided in the case of building loader.
343 stl: "none",
344
Colin Cross97f0aef2016-07-14 16:05:46 -0700345 // we don't want crtbegin.o (because we have begin.o), so unset it
346 // just for this module
347 nocrt: true,
348
dimitryb8b3a762018-09-25 12:31:11 +0200349 static_executable: true,
350
dimitryb8b3a762018-09-25 12:31:11 +0200351 // Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb
352 // looking up symbols in the linker by mistake.
353 prefix_symbols: "__dl_",
354
355 sanitize: {
356 hwaddress: false,
357 },
dimitryb8b3a762018-09-25 12:31:11 +0200358
Colin Cross97f0aef2016-07-14 16:05:46 -0700359 static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -0700360 "liblinker_main",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700361 "liblinker_malloc",
362
363 "libc++_static",
Colin Cross97f0aef2016-07-14 16:05:46 -0700364 "libc_nomalloc",
Ryan Prichard249757b2019-11-01 17:18:28 -0700365 "libc_dynamic_dispatch",
Dimitry Ivanov451909d2017-01-26 16:52:59 -0800366 "libm",
Ryan Prichardcdf71752020-12-16 03:37:22 -0800367 "libunwind",
Colin Cross97f0aef2016-07-14 16:05:46 -0700368 ],
Colin Cross97f0aef2016-07-14 16:05:46 -0700369
Ryan Prichardd9a41152019-10-14 16:58:53 -0700370 // Ensure that if the linker needs __gnu_Unwind_Find_exidx, then the linker will have a
371 // definition of the symbol. The linker links against libgcc.a, whose arm32 unwinder has a weak
372 // reference to __gnu_Unwind_Find_exidx, which isn't sufficient to pull in the strong definition
373 // of __gnu_Unwind_Find_exidx from libc. An unresolved weak reference would create a
374 // non-relative dynamic relocation in the linker binary, which complicates linker startup.
375 //
376 // This line should be unnecessary because the linker's dependency on libunwind_llvm.a should
377 // override libgcc.a, but this line provides a simpler guarantee. It can be removed once the
378 // linker stops linking against libgcc.a's arm32 unwinder.
379 whole_static_libs: ["libc_unwind_static"],
380
Ryan Prichard80e40f02019-10-31 19:54:46 -0700381 system_shared_libs: [],
382
383 // Opt out of native_coverage when opting out of system_shared_libs
384 native_coverage: false,
385}
386
387// ========================================================
388// linker[_asan][64] binary
389// ========================================================
390
391cc_binary {
Colin Cross97f0aef2016-07-14 16:05:46 -0700392 name: "linker",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700393 defaults: [
394 "linker_bin_template",
395 "linux_bionic_supported",
396 "linker_version_script_overlay",
397 ],
398
Victor Khimenkod15229d2020-05-14 22:14:45 +0200399 srcs: [
400 "linker_translate_path.cpp",
401 ],
402
Colin Cross10fffb42016-12-08 09:57:35 -0800403 symlinks: ["linker_asan"],
Florian Mayerc10d0642023-03-22 16:12:49 -0700404 arch: {
405 arm64: {
406 symlinks: ["linker_hwasan"],
407 },
408 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700409 multilib: {
Colin Cross97f0aef2016-07-14 16:05:46 -0700410 lib64: {
411 suffix: "64",
Colin Cross10fffb42016-12-08 09:57:35 -0800412 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700413 },
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800414
Ryan Prichard80e40f02019-10-31 19:54:46 -0700415 compile_multilib: "both",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700416
417 recovery_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700418 vendor_ramdisk_available: true,
Ryan Prichard80e40f02019-10-31 19:54:46 -0700419 apex_available: [
420 "//apex_available:platform",
421 "com.android.runtime",
422 ],
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800423
Colin Cross97f0aef2016-07-14 16:05:46 -0700424 target: {
Dan Willemsen7ec52b12016-11-28 17:02:25 -0800425 android: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700426 srcs: [
427 "linker_debuggerd_android.cpp",
428 ],
Dan Albert4ea19212019-07-23 13:31:14 -0700429 static_libs: [
430 "libc++demangle",
431 "libdebuggerd_handler_fallback",
432 ],
Dan Willemsen7ec52b12016-11-28 17:02:25 -0800433 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700434 linux_bionic: {
435 static_libs: [
436 "liblinker_debuggerd_stub",
437 ],
Yi Kong6f6daaa2020-12-10 01:27:44 +0800438 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700439 },
Yi Konga7e363f2020-10-01 04:10:01 +0800440
Yi Konge20a1d92022-01-25 03:19:58 +0800441 afdo: true,
Colin Cross97f0aef2016-07-14 16:05:46 -0700442}
dimitry11da1dc2018-01-05 13:35:43 +0100443
Ryan Prichard80e40f02019-10-31 19:54:46 -0700444// ========================================================
445// assorted modules
446// ========================================================
447
Elliott Hughes90f96b92019-05-09 15:56:39 -0700448sh_binary {
449 name: "ldd",
Rupert Shuttlewortha7e29a82021-02-18 13:35:22 +0000450 src: "ldd.sh",
Elliott Hughes90f96b92019-05-09 15:56:39 -0700451}
452
Collin Fijalkovichc9521e02021-04-29 11:31:50 -0700453// Used to generate binaries that can be backed by transparent hugepages.
454cc_defaults {
455 name: "linker_hugepage_aligned",
456 arch: {
457 arm64: {
458 ldflags: ["-z max-page-size=0x200000"],
459 },
460 x86_64: {
461 ldflags: ["-z max-page-size=0x200000"],
462 },
463 },
464}
465
dimitry11da1dc2018-01-05 13:35:43 +0100466cc_library {
467 // NOTE: --exclude-libs=libgcc.a makes sure that any symbols ld-android.so pulls from
468 // libgcc.a are made static to ld-android.so. This in turn ensures that libraries that
469 // a) pull symbols from libgcc.a and b) depend on ld-android.so will not rely on ld-android.so
470 // to provide those symbols, but will instead pull them from libgcc.a. Specifically,
471 // we use this property to make sure libc.so has its own copy of the code from
472 // libgcc.a it uses.
473 //
474 // DO NOT REMOVE --exclude-libs!
475
Yi Kong7786a342018-08-31 19:01:56 -0700476 ldflags: [
477 "-Wl,--exclude-libs=libgcc.a",
Yi Kong7ac2afb2019-05-06 16:23:10 -0700478 "-Wl,--exclude-libs=libgcc_stripped.a",
Yi Kong7786a342018-08-31 19:01:56 -0700479 "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
480 "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000481 "-Wl,--exclude-libs=libclang_rt.builtins-riscv64-android.a",
Ryan Prichardef147872021-01-28 14:06:52 -0800482 "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
Yi Kong7786a342018-08-31 19:01:56 -0700483 "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
484 ],
dimitry11da1dc2018-01-05 13:35:43 +0100485
486 // for x86, exclude libgcc_eh.a for the same reasons as above
487 arch: {
488 x86: {
489 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
490 },
491 x86_64: {
492 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
493 },
494 },
dimitry581723e2018-01-05 14:31:44 +0100495
496 srcs: ["ld_android.cpp"],
dimitry11da1dc2018-01-05 13:35:43 +0100497 cflags: [
498 "-Wall",
499 "-Wextra",
500 "-Wunused",
501 "-Werror",
502 ],
503 stl: "none",
504
505 name: "ld-android",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000506 defaults: [
507 "linux_bionic_supported",
508 "linker_version_script_overlay",
509 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -0800510 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700511 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +0900512 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +0200513 native_bridge_supported: true,
dimitry11da1dc2018-01-05 13:35:43 +0100514
Ryan Prichard470b6662018-03-27 22:10:55 -0700515 nocrt: true,
dimitry11da1dc2018-01-05 13:35:43 +0100516 system_shared_libs: [],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +0100517 header_libs: ["libc_headers"],
dimitry11da1dc2018-01-05 13:35:43 +0100518
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800519 // Opt out of native_coverage when opting out of system_shared_libs
520 native_coverage: false,
521
dimitry11da1dc2018-01-05 13:35:43 +0100522 sanitize: {
523 never: true,
524 },
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900525
526 apex_available: [
527 "//apex_available:platform",
528 "com.android.runtime",
529 ],
dimitry11da1dc2018-01-05 13:35:43 +0100530}
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800531
532cc_test {
533 name: "linker-unit-tests",
Colin Cross0cc60af2021-09-30 14:04:39 -0700534 test_suites: ["device-tests"],
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800535
536 cflags: [
537 "-g",
538 "-Wall",
539 "-Wextra",
540 "-Wunused",
541 "-Werror",
542 ],
543
544 // We need to access Bionic private headers in the linker.
545 include_dirs: ["bionic/libc"],
546
547 srcs: [
548 // Tests.
549 "linker_block_allocator_test.cpp",
550 "linker_config_test.cpp",
551 "linked_list_test.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100552 "linker_note_gnu_property_test.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800553 "linker_sleb128_test.cpp",
554 "linker_utils_test.cpp",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800555 "linker_gnu_hash_test.cpp",
Kalesh Singh0396f872024-02-02 22:11:08 -0800556 "linker_crt_pad_segment_test.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800557
558 // Parts of the linker that we're testing.
Kalesh Singh0396f872024-02-02 22:11:08 -0800559 ":elf_note_sources",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800560 "linker_block_allocator.cpp",
561 "linker_config.cpp",
Ryan Prichard551565e2019-12-23 16:03:14 -0800562 "linker_debug.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100563 "linker_note_gnu_property.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800564 "linker_test_globals.cpp",
565 "linker_utils.cpp",
Kalesh Singh0396f872024-02-02 22:11:08 -0800566 "linker_phdr.cpp",
567 "linker_mapped_file_fragment.cpp",
568 "linker_sdk_versions.cpp",
569 "linker_dlwarning.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800570 ],
571
572 static_libs: [
573 "libasync_safe",
574 "libbase",
Jiyong Park7157dfb2022-08-19 13:09:18 +0900575 "liblog_for_runtime_apex",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800576 ],
Ryan Prichard129f7a12019-12-23 16:45:47 -0800577
Kalesh Singh0396f872024-02-02 22:11:08 -0800578 data_libs: [
579 "crt_pad_segment_disabled",
580 "crt_pad_segment_enabled",
581 "no_crt_pad_segment",
582 ],
583
Ryan Prichard129f7a12019-12-23 16:45:47 -0800584 arch: {
585 arm: {
586 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
587 },
588 arm64: {
589 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
590 },
591 },
592}
593
594cc_benchmark {
595 name: "linker-benchmarks",
596
597 srcs: [
598 "linker_gnu_hash_benchmark.cpp",
599 ],
600
601 arch: {
602 arm: {
603 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
604 },
605 arm64: {
606 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
607 },
608 },
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800609}