blob: 2875263bee6fad0072a473fd65c5ff5c21c2c439 [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",
144 defaults: ["linker_defaults", "linker_all_targets"],
145 srcs: ["linker_main.cpp"],
146
147 // Ensure that the compiler won't insert string function calls before ifuncs are resolved.
148 cflags: ["-ffreestanding"],
149}
150
151cc_library_static {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700152 name: "liblinker_malloc",
153 defaults: ["linker_defaults", "linker_all_targets"],
154 srcs: ["linker_memory.cpp"],
155}
156
157cc_library_static {
158 name: "liblinker_debuggerd_stub",
159 defaults: ["linker_defaults", "linker_all_targets"],
160 srcs: ["linker_debuggerd_stub.cpp"],
161}
162
163// ========================================================
164// template for the linker binary
165// ========================================================
166
dimitryb8b3a762018-09-25 12:31:11 +0200167filegroup {
168 name: "linker_sources",
Colin Cross97f0aef2016-07-14 16:05:46 -0700169 srcs: [
170 "dlfcn.cpp",
171 "linker.cpp",
Elliott Hughes838dbac2023-08-22 14:07:48 -0700172 "linker_auxv.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700173 "linker_block_allocator.cpp",
Dimitry Ivanov769b33f2016-07-21 11:33:40 -0700174 "linker_dlwarning.cpp",
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700175 "linker_cfi.cpp",
Dimitry Ivanov4cabfaa2017-03-07 11:19:05 -0800176 "linker_config.cpp",
Ryan Prichard551565e2019-12-23 16:03:14 -0800177 "linker_debug.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700178 "linker_gdb_support.cpp",
Dimitry Ivanov48ec2882016-08-04 11:50:36 -0700179 "linker_globals.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700180 "linker_libc_support.c",
Dimitry Ivanov451909d2017-01-26 16:52:59 -0800181 "linker_libcxx_support.cpp",
Dimitry Ivanovb943f302016-08-03 16:00:10 -0700182 "linker_namespaces.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700183 "linker_logger.cpp",
184 "linker_mapped_file_fragment.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100185 "linker_note_gnu_property.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700186 "linker_phdr.cpp",
Ryan Prichard339ecef2020-01-02 16:36:06 -0800187 "linker_relocate.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700188 "linker_sdk_versions.cpp",
Dimitry Ivanov48ec2882016-08-04 11:50:36 -0700189 "linker_soinfo.cpp",
Collin Fijalkovich47d27aa2021-03-24 10:17:39 -0700190 "linker_transparent_hugepage_support.cpp",
Ryan Prichard45d13492019-01-03 02:51:30 -0800191 "linker_tls.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -0700192 "linker_utils.cpp",
193 "rt.cpp",
194 ],
dimitryb8b3a762018-09-25 12:31:11 +0200195}
Colin Cross97f0aef2016-07-14 16:05:46 -0700196
dimitryb8b3a762018-09-25 12:31:11 +0200197filegroup {
198 name: "linker_sources_arm",
199 srcs: [
200 "arch/arm/begin.S",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800201 "arch/arm_neon/linker_gnu_hash_neon.cpp",
dimitryb8b3a762018-09-25 12:31:11 +0200202 ],
203}
204
205filegroup {
206 name: "linker_sources_arm64",
207 srcs: [
208 "arch/arm64/begin.S",
Ryan Prichardffaae702019-01-23 17:47:10 -0800209 "arch/arm64/tlsdesc_resolver.S",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800210 "arch/arm_neon/linker_gnu_hash_neon.cpp",
dimitryb8b3a762018-09-25 12:31:11 +0200211 ],
212}
213
214filegroup {
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000215 name: "linker_sources_riscv64",
216 srcs: [
217 "arch/riscv64/begin.S",
218 ],
219}
220
221filegroup {
dimitryb8b3a762018-09-25 12:31:11 +0200222 name: "linker_sources_x86",
223 srcs: [
224 "arch/x86/begin.S",
225 ],
226}
227
228filegroup {
229 name: "linker_sources_x86_64",
230 srcs: [
231 "arch/x86_64/begin.S",
232 ],
233}
234
dimitryb8b3a762018-09-25 12:31:11 +0200235cc_defaults {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700236 name: "linker_version_script_overlay",
237 arch: {
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000238 arm: { version_script: "linker.arm.map" },
239 arm64: { version_script: "linker.generic.map" },
240 riscv64: { version_script: "linker.generic.map" },
241 x86: { version_script: "linker.generic.map" },
242 x86_64: { version_script: "linker.generic.map" },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700243 },
244}
245
246// A template for the linker binary. May be inherited by native bridge implementations.
247cc_defaults {
248 name: "linker_bin_template",
249 defaults: ["linker_defaults"],
250
251 srcs: [":linker_sources"],
252
Colin Cross97f0aef2016-07-14 16:05:46 -0700253 arch: {
254 arm: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700255 srcs: [":linker_sources_arm"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700256
257 // Arm 32 bit does not produce complete exidx unwind information
258 // so keep the .debug_frame which is relatively small and does
259 // include needed unwind information.
260 // See b/242162222 for details.
261 strip: {
262 keep_symbols_and_debug_frame: true,
263 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700264 },
265 arm64: {
266 srcs: [":linker_sources_arm64"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700267
268 // Leave the symbols in the shared library so that stack unwinders can produce
269 // meaningful name resolution.
270 strip: {
271 keep_symbols: true,
272 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700273 },
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000274 riscv64: {
275 srcs: [":linker_sources_riscv64"],
276
277 // Leave the symbols in the shared library so that stack unwinders can produce
278 // meaningful name resolution.
279 strip: {
280 keep_symbols: true,
281 },
282 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700283 x86: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700284 srcs: [":linker_sources_x86"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700285
286 // Leave the symbols in the shared library so that stack unwinders can produce
287 // meaningful name resolution.
288 strip: {
289 keep_symbols: true,
290 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700291 },
292 x86_64: {
293 srcs: [":linker_sources_x86_64"],
Christopher Ferrisd37df2b2022-08-11 17:27:50 -0700294
295 // Leave the symbols in the shared library so that stack unwinders can produce
296 // meaningful name resolution.
297 strip: {
298 keep_symbols: true,
299 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700300 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700301 },
302
Ryan Prichard80e40f02019-10-31 19:54:46 -0700303 // -shared is used to overwrite the -Bstatic and -static flags triggered by enabling
304 // static_executable. This dynamic linker is actually a shared object linked with static
305 // libraries.
Colin Cross97f0aef2016-07-14 16:05:46 -0700306 ldflags: [
307 "-shared",
308 "-Wl,-Bsymbolic",
309 "-Wl,--exclude-libs,ALL",
dimitry8e8c2c02018-01-04 12:08:32 +0100310 "-Wl,-soname,ld-android.so",
Colin Cross97f0aef2016-07-14 16:05:46 -0700311 ],
312
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -0800313 // we are going to link libc++_static manually because
314 // when stl is not set to "none" build system adds libdl
315 // to the list of static libraries which needs to be
316 // avoided in the case of building loader.
317 stl: "none",
318
Colin Cross97f0aef2016-07-14 16:05:46 -0700319 // we don't want crtbegin.o (because we have begin.o), so unset it
320 // just for this module
321 nocrt: true,
322
dimitryb8b3a762018-09-25 12:31:11 +0200323 static_executable: true,
324
dimitryb8b3a762018-09-25 12:31:11 +0200325 // Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb
326 // looking up symbols in the linker by mistake.
327 prefix_symbols: "__dl_",
328
329 sanitize: {
330 hwaddress: false,
Mitch Phillipse8139f52022-11-23 15:18:01 -0800331 // TODO(mitchp): For now, disable MTE globals in the linker. MTE globals
332 // change the relocation semantics, and GVs that are touched before the
333 // linker has the chance to relocate itself have to be annotated.
334 memtag_globals: false,
dimitryb8b3a762018-09-25 12:31:11 +0200335 },
dimitryb8b3a762018-09-25 12:31:11 +0200336
Colin Cross97f0aef2016-07-14 16:05:46 -0700337 static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -0700338 "liblinker_main",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700339 "liblinker_malloc",
340
341 "libc++_static",
Colin Cross97f0aef2016-07-14 16:05:46 -0700342 "libc_nomalloc",
Ryan Prichard249757b2019-11-01 17:18:28 -0700343 "libc_dynamic_dispatch",
Dimitry Ivanov451909d2017-01-26 16:52:59 -0800344 "libm",
Ryan Prichardcdf71752020-12-16 03:37:22 -0800345 "libunwind",
Colin Cross97f0aef2016-07-14 16:05:46 -0700346 ],
Colin Cross97f0aef2016-07-14 16:05:46 -0700347
Ryan Prichardd9a41152019-10-14 16:58:53 -0700348 // Ensure that if the linker needs __gnu_Unwind_Find_exidx, then the linker will have a
349 // definition of the symbol. The linker links against libgcc.a, whose arm32 unwinder has a weak
350 // reference to __gnu_Unwind_Find_exidx, which isn't sufficient to pull in the strong definition
351 // of __gnu_Unwind_Find_exidx from libc. An unresolved weak reference would create a
352 // non-relative dynamic relocation in the linker binary, which complicates linker startup.
353 //
354 // This line should be unnecessary because the linker's dependency on libunwind_llvm.a should
355 // override libgcc.a, but this line provides a simpler guarantee. It can be removed once the
356 // linker stops linking against libgcc.a's arm32 unwinder.
357 whole_static_libs: ["libc_unwind_static"],
358
Ryan Prichard80e40f02019-10-31 19:54:46 -0700359 system_shared_libs: [],
360
361 // Opt out of native_coverage when opting out of system_shared_libs
362 native_coverage: false,
363}
364
365// ========================================================
366// linker[_asan][64] binary
367// ========================================================
368
369cc_binary {
Colin Cross97f0aef2016-07-14 16:05:46 -0700370 name: "linker",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700371 defaults: [
372 "linker_bin_template",
373 "linux_bionic_supported",
374 "linker_version_script_overlay",
375 ],
376
Victor Khimenkod15229d2020-05-14 22:14:45 +0200377 srcs: [
378 "linker_translate_path.cpp",
379 ],
380
Colin Cross10fffb42016-12-08 09:57:35 -0800381 symlinks: ["linker_asan"],
Florian Mayerc10d0642023-03-22 16:12:49 -0700382 arch: {
383 arm64: {
384 symlinks: ["linker_hwasan"],
385 },
386 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700387 multilib: {
Colin Cross97f0aef2016-07-14 16:05:46 -0700388 lib64: {
389 suffix: "64",
Colin Cross10fffb42016-12-08 09:57:35 -0800390 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700391 },
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800392
Ryan Prichard80e40f02019-10-31 19:54:46 -0700393 compile_multilib: "both",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700394
395 recovery_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700396 vendor_ramdisk_available: true,
Ryan Prichard80e40f02019-10-31 19:54:46 -0700397 apex_available: [
398 "//apex_available:platform",
399 "com.android.runtime",
400 ],
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800401
Colin Cross97f0aef2016-07-14 16:05:46 -0700402 target: {
Dan Willemsen7ec52b12016-11-28 17:02:25 -0800403 android: {
Ryan Prichard80e40f02019-10-31 19:54:46 -0700404 srcs: [
405 "linker_debuggerd_android.cpp",
406 ],
Dan Albert4ea19212019-07-23 13:31:14 -0700407 static_libs: [
408 "libc++demangle",
409 "libdebuggerd_handler_fallback",
410 ],
Dan Willemsen7ec52b12016-11-28 17:02:25 -0800411 },
Ryan Prichard80e40f02019-10-31 19:54:46 -0700412 linux_bionic: {
413 static_libs: [
414 "liblinker_debuggerd_stub",
415 ],
Yi Kong6f6daaa2020-12-10 01:27:44 +0800416 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700417 },
Yi Konga7e363f2020-10-01 04:10:01 +0800418
Yi Konge20a1d92022-01-25 03:19:58 +0800419 afdo: true,
Colin Cross97f0aef2016-07-14 16:05:46 -0700420}
dimitry11da1dc2018-01-05 13:35:43 +0100421
Ryan Prichard80e40f02019-10-31 19:54:46 -0700422// ========================================================
423// assorted modules
424// ========================================================
425
Elliott Hughes90f96b92019-05-09 15:56:39 -0700426sh_binary {
427 name: "ldd",
Rupert Shuttlewortha7e29a82021-02-18 13:35:22 +0000428 src: "ldd.sh",
Elliott Hughes90f96b92019-05-09 15:56:39 -0700429}
430
Collin Fijalkovichc9521e02021-04-29 11:31:50 -0700431// Used to generate binaries that can be backed by transparent hugepages.
432cc_defaults {
433 name: "linker_hugepage_aligned",
434 arch: {
435 arm64: {
436 ldflags: ["-z max-page-size=0x200000"],
437 },
438 x86_64: {
439 ldflags: ["-z max-page-size=0x200000"],
440 },
441 },
442}
443
dimitry11da1dc2018-01-05 13:35:43 +0100444cc_library {
445 // NOTE: --exclude-libs=libgcc.a makes sure that any symbols ld-android.so pulls from
446 // libgcc.a are made static to ld-android.so. This in turn ensures that libraries that
447 // a) pull symbols from libgcc.a and b) depend on ld-android.so will not rely on ld-android.so
448 // to provide those symbols, but will instead pull them from libgcc.a. Specifically,
449 // we use this property to make sure libc.so has its own copy of the code from
450 // libgcc.a it uses.
451 //
452 // DO NOT REMOVE --exclude-libs!
453
Yi Kong7786a342018-08-31 19:01:56 -0700454 ldflags: [
455 "-Wl,--exclude-libs=libgcc.a",
Yi Kong7ac2afb2019-05-06 16:23:10 -0700456 "-Wl,--exclude-libs=libgcc_stripped.a",
Yi Kong7786a342018-08-31 19:01:56 -0700457 "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
458 "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
Elliott Hughes3e4f6032022-10-22 03:54:59 +0000459 "-Wl,--exclude-libs=libclang_rt.builtins-riscv64-android.a",
Ryan Prichardef147872021-01-28 14:06:52 -0800460 "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
Yi Kong7786a342018-08-31 19:01:56 -0700461 "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
462 ],
dimitry11da1dc2018-01-05 13:35:43 +0100463
464 // for x86, exclude libgcc_eh.a for the same reasons as above
465 arch: {
466 x86: {
467 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
468 },
469 x86_64: {
470 ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
471 },
472 },
dimitry581723e2018-01-05 14:31:44 +0100473
474 srcs: ["ld_android.cpp"],
dimitry11da1dc2018-01-05 13:35:43 +0100475 cflags: [
476 "-Wall",
477 "-Wextra",
478 "-Wunused",
479 "-Werror",
480 ],
481 stl: "none",
482
483 name: "ld-android",
Ryan Prichard80e40f02019-10-31 19:54:46 -0700484 defaults: ["linux_bionic_supported", "linker_version_script_overlay"],
Yifan Hong5a39cee2020-01-21 16:43:56 -0800485 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700486 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +0900487 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +0200488 native_bridge_supported: true,
dimitry11da1dc2018-01-05 13:35:43 +0100489
Ryan Prichard470b6662018-03-27 22:10:55 -0700490 nocrt: true,
dimitry11da1dc2018-01-05 13:35:43 +0100491 system_shared_libs: [],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +0100492 header_libs: ["libc_headers"],
dimitry11da1dc2018-01-05 13:35:43 +0100493
Pirama Arumuga Nainarfcd35382019-02-14 13:48:01 -0800494 // Opt out of native_coverage when opting out of system_shared_libs
495 native_coverage: false,
496
dimitry11da1dc2018-01-05 13:35:43 +0100497 sanitize: {
498 never: true,
499 },
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900500
501 apex_available: [
502 "//apex_available:platform",
503 "com.android.runtime",
504 ],
dimitry11da1dc2018-01-05 13:35:43 +0100505}
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800506
507cc_test {
508 name: "linker-unit-tests",
Colin Cross0cc60af2021-09-30 14:04:39 -0700509 test_suites: ["device-tests"],
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800510
511 cflags: [
512 "-g",
513 "-Wall",
514 "-Wextra",
515 "-Wunused",
516 "-Werror",
517 ],
518
519 // We need to access Bionic private headers in the linker.
520 include_dirs: ["bionic/libc"],
521
522 srcs: [
523 // Tests.
524 "linker_block_allocator_test.cpp",
525 "linker_config_test.cpp",
526 "linked_list_test.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100527 "linker_note_gnu_property_test.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800528 "linker_sleb128_test.cpp",
529 "linker_utils_test.cpp",
Ryan Prichard129f7a12019-12-23 16:45:47 -0800530 "linker_gnu_hash_test.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800531
532 // Parts of the linker that we're testing.
533 "linker_block_allocator.cpp",
534 "linker_config.cpp",
Ryan Prichard551565e2019-12-23 16:03:14 -0800535 "linker_debug.cpp",
Tamas Petz8d55d182020-02-24 14:15:25 +0100536 "linker_note_gnu_property.cpp",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800537 "linker_test_globals.cpp",
538 "linker_utils.cpp",
539 ],
540
541 static_libs: [
542 "libasync_safe",
543 "libbase",
Jiyong Park7157dfb2022-08-19 13:09:18 +0900544 "liblog_for_runtime_apex",
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800545 ],
Ryan Prichard129f7a12019-12-23 16:45:47 -0800546
547 arch: {
548 arm: {
549 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
550 },
551 arm64: {
552 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
553 },
554 },
555}
556
557cc_benchmark {
558 name: "linker-benchmarks",
559
560 srcs: [
561 "linker_gnu_hash_benchmark.cpp",
562 ],
563
564 arch: {
565 arm: {
566 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
567 },
568 arm64: {
569 srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"],
570 },
571 },
Elliott Hughes15a2b7b2019-02-15 13:48:38 -0800572}