blob: 19776751037b1c29dbaa0bfe7bc932bc3bc1bcfc [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",
Christopher R. Palmerd38aaed2017-04-08 22:40:01 +020076 defaults: [
77 "shim_libs_defaults",
78 ],
Ryan Prichard80e40f02019-10-31 19:54:46 -070079 arch: {
80 arm: {
81 cflags: ["-D__work_around_b_24465209__"],
82 },
83 x86: {
84 cflags: ["-D__work_around_b_24465209__"],
85 },
86 },
87
88 cflags: [
89 "-fno-stack-protector",
90 "-Wstrict-overflow=5",
91 "-fvisibility=hidden",
92 "-Wall",
93 "-Wextra",
94 "-Wunused",
95 "-Werror",
96 ],
97
98 // TODO: split out the asflags.
99 asflags: [
100 "-fno-stack-protector",
101 "-Wstrict-overflow=5",
102 "-fvisibility=hidden",
103 "-Wall",
104 "-Wextra",
105 "-Wunused",
106 "-Werror",
107 ],
108
109 product_variables: {
110 debuggable: {
111 cppflags: ["-DUSE_LD_CONFIG_FILE"],
112 },
113 },
114
115 cppflags: ["-Wold-style-cast"],
116
117 static_libs: [
118 "libziparchive",
119 "libbase",
120 "libz",
121
122 "libasync_safe",
123
Jiyong Park7157dfb2022-08-19 13:09:18 +0900124 "liblog_for_runtime_apex",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700125 ],
126
127 // We need to access Bionic private headers in the linker.
128 include_dirs: ["bionic/libc"],
129}
130
131// ========================================================
132// linker components
133// ========================================================
134
135// Enable a module on all targets the linker runs on (ordinary Android targets, Linux Bionic, and
136// native bridge implementations).
137cc_defaults {
138 name: "linker_all_targets",
139 defaults: ["linux_bionic_supported"],
140 recovery_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700141 vendor_ramdisk_available: true,
Ryan Prichard80e40f02019-10-31 19:54:46 -0700142 native_bridge_supported: true,
143}
144
145cc_library_static {
Ryan Prichard249757b2019-11-01 17:18:28 -0700146 name: "liblinker_main",
147 defaults: ["linker_defaults", "linker_all_targets"],
148 srcs: ["linker_main.cpp"],
149
150 // Ensure that the compiler won't insert string function calls before ifuncs are resolved.
151 cflags: ["-ffreestanding"],
152}
153
154cc_library_static {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700155 name: "liblinker_malloc",
156 defaults: ["linker_defaults", "linker_all_targets"],
157 srcs: ["linker_memory.cpp"],
158}
159
160cc_library_static {
161 name: "liblinker_debuggerd_stub",
162 defaults: ["linker_defaults", "linker_all_targets"],
163 srcs: ["linker_debuggerd_stub.cpp"],
164}
165
166// ========================================================
167// template for the linker binary
168// ========================================================
169
dimitryb8b3a762018-09-25 12:31:11 +0200170filegroup {
171 name: "linker_sources",
Colin Cross97f0aef2016-07-14 16:05:46 -0700172 srcs: [
173 "dlfcn.cpp",
174 "linker.cpp",
175 "linker_block_allocator.cpp",
Dimitry Ivanov769b33f2016-07-21 11:33:40 -0700176 "linker_dlwarning.cpp",
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700177 "linker_cfi.cpp",
Dimitry Ivanov4cabfaa2017-03-07 11:19:05 -0800178 "linker_config.cpp",
Ryan Prichard551565e2019-12-23 16:03:14 -0800179 "linker_debug.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700180 "linker_gdb_support.cpp",
Dimitry Ivanov48ec2882016-08-04 11:50:36 -0700181 "linker_globals.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700182 "linker_libc_support.c",
Dimitry Ivanov451909d2017-01-26 16:52:59 -0800183 "linker_libcxx_support.cpp",
Dimitry Ivanovb943f302016-08-03 16:00:10 -0700184 "linker_namespaces.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700185 "linker_logger.cpp",
186 "linker_mapped_file_fragment.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100187 "linker_note_gnu_property.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700188 "linker_phdr.cpp",
Ryan Prichard339ecef2020-01-02 16:36:06 -0800189 "linker_relocate.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700190 "linker_sdk_versions.cpp",
Dimitry Ivanov48ec2882016-08-04 11:50:36 -0700191 "linker_soinfo.cpp",
Collin Fijalkovich47d27aa2021-03-24 10:17:39 -0700192 "linker_transparent_hugepage_support.cpp",
Ryan Prichard45d13492019-01-03 02:51:30 -0800193 "linker_tls.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700194 "linker_utils.cpp",
195 "rt.cpp",
196 ],
dimitryb8b3a762018-09-25 12:31:11 +0200197}
Colin Cross97f0aef2016-07-14 16:05:46 -0700198
dimitryb8b3a762018-09-25 12:31:11 +0200199filegroup {
200 name: "linker_sources_arm",
201 srcs: [
202 "arch/arm/begin.S",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800203 "arch/arm_neon/linker_gnu_hash_neon.cpp",
dimitryb8b3a762018-09-25 12:31:11 +0200204 ],
205}
206
207filegroup {
208 name: "linker_sources_arm64",
209 srcs: [
210 "arch/arm64/begin.S",
Ryan Prichardffaae702019-01-23 17:47:10 -0800211 "arch/arm64/tlsdesc_resolver.S",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800212 "arch/arm_neon/linker_gnu_hash_neon.cpp",
dimitryb8b3a762018-09-25 12:31:11 +0200213 ],
214}
215
216filegroup {
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000217 name: "linker_sources_riscv64",
218 srcs: [
219 "arch/riscv64/begin.S",
220 ],
221}
222
223filegroup {
dimitryb8b3a762018-09-25 12:31:11 +0200224 name: "linker_sources_x86",
225 srcs: [
226 "arch/x86/begin.S",
227 ],
228}
229
230filegroup {
231 name: "linker_sources_x86_64",
232 srcs: [
233 "arch/x86_64/begin.S",
234 ],
235}
236
dimitryb8b3a762018-09-25 12:31:11 +0200237cc_defaults {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700238 name: "linker_version_script_overlay",
239 arch: {
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000240 arm: { version_script: "linker.arm.map" },
241 arm64: { version_script: "linker.generic.map" },
242 riscv64: { version_script: "linker.generic.map" },
243 x86: { version_script: "linker.generic.map" },
244 x86_64: { version_script: "linker.generic.map" },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700245 },
246}
247
248// A template for the linker binary. May be inherited by native bridge implementations.
249cc_defaults {
250 name: "linker_bin_template",
251 defaults: ["linker_defaults"],
252
253 srcs: [":linker_sources"],
254
Colin Cross97f0aef2016-07-14 16:05:46 -0700255 arch: {
256 arm: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700257 srcs: [":linker_sources_arm"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700258
259 // Arm 32 bit does not produce complete exidx unwind information
260 // so keep the .debug_frame which is relatively small and does
261 // include needed unwind information.
262 // See b/242162222 for details.
263 strip: {
264 keep_symbols_and_debug_frame: true,
265 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700266 },
267 arm64: {
268 srcs: [":linker_sources_arm64"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700269
270 // Leave the symbols in the shared library so that stack unwinders can produce
271 // meaningful name resolution.
272 strip: {
273 keep_symbols: true,
274 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700275 },
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000276 riscv64: {
277 srcs: [":linker_sources_riscv64"],
278
279 // Leave the symbols in the shared library so that stack unwinders can produce
280 // meaningful name resolution.
281 strip: {
282 keep_symbols: true,
283 },
284 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700285 x86: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700286 srcs: [":linker_sources_x86"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700287
288 // Leave the symbols in the shared library so that stack unwinders can produce
289 // meaningful name resolution.
290 strip: {
291 keep_symbols: true,
292 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700293 },
294 x86_64: {
295 srcs: [":linker_sources_x86_64"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700296
297 // Leave the symbols in the shared library so that stack unwinders can produce
298 // meaningful name resolution.
299 strip: {
300 keep_symbols: true,
301 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700302 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700303 },
304
Ryan Prichard80e40f02019-10-31 19:54:46 -0700305 // -shared is used to overwrite the -Bstatic and -static flags triggered by enabling
306 // static_executable. This dynamic linker is actually a shared object linked with static
307 // libraries.
Colin Cross97f0aef2016-07-14 16:05:46 -0700308 ldflags: [
309 "-shared",
310 "-Wl,-Bsymbolic",
311 "-Wl,--exclude-libs,ALL",
dimitry8e8c2c02018-01-04 12:08:32 +0100312 "-Wl,-soname,ld-android.so",
Colin Cross97f0aef2016-07-14 16:05:46 -0700313 ],
314
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -0800315 // we are going to link libc++_static manually because
316 // when stl is not set to "none" build system adds libdl
317 // to the list of static libraries which needs to be
318 // avoided in the case of building loader.
319 stl: "none",
320
Colin Cross97f0aef2016-07-14 16:05:46 -0700321 // we don't want crtbegin.o (because we have begin.o), so unset it
322 // just for this module
323 nocrt: true,
324
dimitryb8b3a762018-09-25 12:31:11 +0200325 static_executable: true,
326
dimitryb8b3a762018-09-25 12:31:11 +0200327 // Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb
328 // looking up symbols in the linker by mistake.
329 prefix_symbols: "__dl_",
330
331 sanitize: {
332 hwaddress: false,
333 },
dimitryb8b3a762018-09-25 12:31:11 +0200334
Colin Cross97f0aef2016-07-14 16:05:46 -0700335 static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -0700336 "liblinker_main",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700337 "liblinker_malloc",
338
339 "libc++_static",
Colin Cross97f0aef2016-07-14 16:05:46 -0700340 "libc_nomalloc",
Ryan Prichard249757b2019-11-01 17:18:28 -0700341 "libc_dynamic_dispatch",
Dimitry Ivanov451909d2017-01-26 16:52:59 -0800342 "libm",
Ryan Prichardcdf71752020-12-16 03:37:22 -0800343 "libunwind",
Colin Cross97f0aef2016-07-14 16:05:46 -0700344 ],
Colin Cross97f0aef2016-07-14 16:05:46 -0700345
Ryan Prichardd9a41152019-10-14 16:58:53 -0700346 // Ensure that if the linker needs __gnu_Unwind_Find_exidx, then the linker will have a
347 // definition of the symbol. The linker links against libgcc.a, whose arm32 unwinder has a weak
348 // reference to __gnu_Unwind_Find_exidx, which isn't sufficient to pull in the strong definition
349 // of __gnu_Unwind_Find_exidx from libc. An unresolved weak reference would create a
350 // non-relative dynamic relocation in the linker binary, which complicates linker startup.
351 //
352 // This line should be unnecessary because the linker's dependency on libunwind_llvm.a should
353 // override libgcc.a, but this line provides a simpler guarantee. It can be removed once the
354 // linker stops linking against libgcc.a's arm32 unwinder.
355 whole_static_libs: ["libc_unwind_static"],
356
Ryan Prichard80e40f02019-10-31 19:54:46 -0700357 system_shared_libs: [],
358
359 // Opt out of native_coverage when opting out of system_shared_libs
360 native_coverage: false,
361}
362
363// ========================================================
364// linker[_asan][64] binary
365// ========================================================
366
367cc_binary {
Colin Cross97f0aef2016-07-14 16:05:46 -0700368 name: "linker",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700369 defaults: [
370 "linker_bin_template",
371 "linux_bionic_supported",
372 "linker_version_script_overlay",
373 ],
374
Victor Khimenkod15229d2020-05-14 22:14:45 +0200375 srcs: [
376 "linker_translate_path.cpp",
377 ],
378
Colin Cross10fffb42016-12-08 09:57:35 -0800379 symlinks: ["linker_asan"],
Florian Mayerc10d0642023-03-22 16:12:49 -0700380 arch: {
381 arm64: {
382 symlinks: ["linker_hwasan"],
383 },
384 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700385 multilib: {
Colin Cross97f0aef2016-07-14 16:05:46 -0700386 lib64: {
387 suffix: "64",
Colin Cross10fffb42016-12-08 09:57:35 -0800388 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700389 },
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800390
Ryan Prichard80e40f02019-10-31 19:54:46 -0700391 compile_multilib: "both",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700392
393 recovery_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700394 vendor_ramdisk_available: true,
Ryan Prichard80e40f02019-10-31 19:54:46 -0700395 apex_available: [
396 "//apex_available:platform",
397 "com.android.runtime",
398 ],
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800399
Colin Cross97f0aef2016-07-14 16:05:46 -0700400 target: {
Dan Willemsen7ec52b12016-11-28 17:02:25 -0800401 android: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700402 srcs: [
403 "linker_debuggerd_android.cpp",
404 ],
Dan Albert4ea19212019-07-23 13:31:14 -0700405 static_libs: [
406 "libc++demangle",
407 "libdebuggerd_handler_fallback",
408 ],
Dan Willemsen7ec52b12016-11-28 17:02:25 -0800409 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700410 linux_bionic: {
411 static_libs: [
412 "liblinker_debuggerd_stub",
413 ],
Yi Kong6f6daaa2020-12-10 01:27:44 +0800414 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700415 },
Yi Konga7e363f2020-10-01 04:10:01 +0800416
Yi Konge20a1d92022-01-25 03:19:58 +0800417 afdo: true,
Colin Cross97f0aef2016-07-14 16:05:46 -0700418}
dimitry11da1dc2018-01-05 13:35:43 +0100419
Ryan Prichard80e40f02019-10-31 19:54:46 -0700420// ========================================================
421// assorted modules
422// ========================================================
423
Elliott Hughes90f96b92019-05-09 15:56:39 -0700424sh_binary {
425 name: "ldd",
Rupert Shuttlewortha7e29a82021-02-18 13:35:22 +0000426 src: "ldd.sh",
Elliott Hughes90f96b92019-05-09 15:56:39 -0700427}
428
Collin Fijalkovichc9521e02021-04-29 11:31:50 -0700429// Used to generate binaries that can be backed by transparent hugepages.
430cc_defaults {
431 name: "linker_hugepage_aligned",
432 arch: {
433 arm64: {
434 ldflags: ["-z max-page-size=0x200000"],
435 },
436 x86_64: {
437 ldflags: ["-z max-page-size=0x200000"],
438 },
439 },
440}
441
dimitry11da1dc2018-01-05 13:35:43 +0100442cc_library {
443 // NOTE: --exclude-libs=libgcc.a makes sure that any symbols ld-android.so pulls from
444 // libgcc.a are made static to ld-android.so. This in turn ensures that libraries that
445 // a) pull symbols from libgcc.a and b) depend on ld-android.so will not rely on ld-android.so
446 // to provide those symbols, but will instead pull them from libgcc.a. Specifically,
447 // we use this property to make sure libc.so has its own copy of the code from
448 // libgcc.a it uses.
449 //
450 // DO NOT REMOVE --exclude-libs!
451
Yi Kong7786a342018-08-31 19:01:56 -0700452 ldflags: [
453 "-Wl,--exclude-libs=libgcc.a",
Yi Kong7ac2afb2019-05-06 16:23:10 -0700454 "-Wl,--exclude-libs=libgcc_stripped.a",
Yi Kong7786a342018-08-31 19:01:56 -0700455 "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
456 "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000457 "-Wl,--exclude-libs=libclang_rt.builtins-riscv64-android.a",
Ryan Prichardef147872021-01-28 14:06:52 -0800458 "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
Yi Kong7786a342018-08-31 19:01:56 -0700459 "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
460 ],
dimitry11da1dc2018-01-05 13:35:43 +0100461
462 // for x86, exclude libgcc_eh.a for the same reasons as above
463 arch: {
464 x86: {
465 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
466 },
467 x86_64: {
468 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
469 },
470 },
dimitry581723e2018-01-05 14:31:44 +0100471
472 srcs: ["ld_android.cpp"],
dimitry11da1dc2018-01-05 13:35:43 +0100473 cflags: [
474 "-Wall",
475 "-Wextra",
476 "-Wunused",
477 "-Werror",
478 ],
479 stl: "none",
480
481 name: "ld-android",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700482 defaults: ["linux_bionic_supported", "linker_version_script_overlay"],
Yifan Hong5a39cee2020-01-21 16:43:56 -0800483 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700484 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +0900485 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +0200486 native_bridge_supported: true,
dimitry11da1dc2018-01-05 13:35:43 +0100487
Ryan Prichard470b6662018-03-27 22:10:55 -0700488 nocrt: true,
dimitry11da1dc2018-01-05 13:35:43 +0100489 system_shared_libs: [],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +0100490 header_libs: ["libc_headers"],
dimitry11da1dc2018-01-05 13:35:43 +0100491
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800492 // Opt out of native_coverage when opting out of system_shared_libs
493 native_coverage: false,
494
dimitry11da1dc2018-01-05 13:35:43 +0100495 sanitize: {
496 never: true,
497 },
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900498
499 apex_available: [
500 "//apex_available:platform",
501 "com.android.runtime",
502 ],
Yi Kong15a05a72020-09-22 00:56:13 +0800503
504 lto: {
505 never: true,
506 },
dimitry11da1dc2018-01-05 13:35:43 +0100507}
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800508
509cc_test {
510 name: "linker-unit-tests",
Colin Cross0cc60af2021-09-30 14:04:39 -0700511 test_suites: ["device-tests"],
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800512
513 cflags: [
514 "-g",
515 "-Wall",
516 "-Wextra",
517 "-Wunused",
518 "-Werror",
519 ],
520
521 // We need to access Bionic private headers in the linker.
522 include_dirs: ["bionic/libc"],
523
524 srcs: [
525 // Tests.
526 "linker_block_allocator_test.cpp",
527 "linker_config_test.cpp",
528 "linked_list_test.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100529 "linker_note_gnu_property_test.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800530 "linker_sleb128_test.cpp",
531 "linker_utils_test.cpp",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800532 "linker_gnu_hash_test.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800533
534 // Parts of the linker that we're testing.
535 "linker_block_allocator.cpp",
536 "linker_config.cpp",
Ryan Prichard551565e2019-12-23 16:03:14 -0800537 "linker_debug.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100538 "linker_note_gnu_property.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800539 "linker_test_globals.cpp",
540 "linker_utils.cpp",
541 ],
542
543 static_libs: [
544 "libasync_safe",
545 "libbase",
Jiyong Park7157dfb2022-08-19 13:09:18 +0900546 "liblog_for_runtime_apex",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800547 ],
Ryan Prichard129f7a12019-12-23 16:45:47 -0800548
549 arch: {
550 arm: {
551 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
552 },
553 arm64: {
554 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
555 },
556 },
557}
558
559cc_benchmark {
560 name: "linker-benchmarks",
561
562 srcs: [
563 "linker_gnu_hash_benchmark.cpp",
564 ],
565
566 arch: {
567 arm: {
568 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
569 },
570 arm64: {
571 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
572 },
573 },
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800574}