Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 1 | // ======================================================== |
| 2 | // linker_wrapper - Linux Bionic (on the host) |
| 3 | // ======================================================== |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 4 | |
Dan Willemsen | 7ccc50d | 2017-09-18 21:28:14 -0700 | [diff] [blame] | 5 | // 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. |
| 12 | cc_object { |
| 13 | name: "linker_wrapper", |
| 14 | host_supported: true, |
| 15 | device_supported: false, |
| 16 | target: { |
Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 17 | linux_bionic: { |
| 18 | enabled: true, |
| 19 | }, |
| 20 | linux_glibc: { |
| 21 | enabled: false, |
| 22 | }, |
| 23 | darwin: { |
| 24 | enabled: false, |
| 25 | }, |
Dan Willemsen | 7ccc50d | 2017-09-18 21:28:14 -0700 | [diff] [blame] | 26 | }, |
| 27 | |
| 28 | cflags: [ |
| 29 | "-fno-stack-protector", |
| 30 | "-Wstrict-overflow=5", |
| 31 | "-fvisibility=hidden", |
| 32 | "-Wall", |
| 33 | "-Wextra", |
| 34 | "-Wno-unused", |
| 35 | "-Werror", |
| 36 | ], |
| 37 | |
| 38 | srcs: [ |
| 39 | "linker_wrapper.cpp", |
| 40 | ], |
| 41 | arch: { |
| 42 | x86_64: { |
| 43 | srcs: ["arch/x86_64/begin.S"], |
| 44 | }, |
| 45 | }, |
| 46 | |
| 47 | prefix_symbols: "__dlwrap_", |
| 48 | |
| 49 | // We need to access Bionic private headers in the linker. |
| 50 | include_dirs: ["bionic/libc"], |
| 51 | } |
| 52 | |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 53 | // ======================================================== |
| 54 | // linker default configuration |
| 55 | // ======================================================== |
| 56 | |
| 57 | // Configuration for the linker binary and any of its static libraries. |
| 58 | cc_defaults { |
| 59 | name: "linker_defaults", |
| 60 | arch: { |
| 61 | arm: { |
| 62 | cflags: ["-D__work_around_b_24465209__"], |
| 63 | }, |
| 64 | x86: { |
| 65 | cflags: ["-D__work_around_b_24465209__"], |
| 66 | }, |
| 67 | }, |
| 68 | |
| 69 | cflags: [ |
| 70 | "-fno-stack-protector", |
| 71 | "-Wstrict-overflow=5", |
| 72 | "-fvisibility=hidden", |
| 73 | "-Wall", |
| 74 | "-Wextra", |
| 75 | "-Wunused", |
| 76 | "-Werror", |
| 77 | ], |
| 78 | |
| 79 | // TODO: split out the asflags. |
| 80 | asflags: [ |
| 81 | "-fno-stack-protector", |
| 82 | "-Wstrict-overflow=5", |
| 83 | "-fvisibility=hidden", |
| 84 | "-Wall", |
| 85 | "-Wextra", |
| 86 | "-Wunused", |
| 87 | "-Werror", |
| 88 | ], |
| 89 | |
| 90 | product_variables: { |
| 91 | debuggable: { |
| 92 | cppflags: ["-DUSE_LD_CONFIG_FILE"], |
| 93 | }, |
| 94 | }, |
| 95 | |
| 96 | cppflags: ["-Wold-style-cast"], |
| 97 | |
| 98 | static_libs: [ |
| 99 | "libziparchive", |
| 100 | "libbase", |
| 101 | "libz", |
| 102 | |
| 103 | "libasync_safe", |
| 104 | |
| 105 | "liblog", |
| 106 | ], |
| 107 | |
| 108 | // We need to access Bionic private headers in the linker. |
| 109 | include_dirs: ["bionic/libc"], |
| 110 | } |
| 111 | |
| 112 | // ======================================================== |
| 113 | // linker components |
| 114 | // ======================================================== |
| 115 | |
| 116 | // Enable a module on all targets the linker runs on (ordinary Android targets, Linux Bionic, and |
| 117 | // native bridge implementations). |
| 118 | cc_defaults { |
| 119 | name: "linker_all_targets", |
| 120 | defaults: ["linux_bionic_supported"], |
| 121 | recovery_available: true, |
| 122 | native_bridge_supported: true, |
| 123 | } |
| 124 | |
| 125 | cc_library_static { |
Ryan Prichard | 249757b | 2019-11-01 17:18:28 -0700 | [diff] [blame] | 126 | name: "liblinker_main", |
| 127 | defaults: ["linker_defaults", "linker_all_targets"], |
| 128 | srcs: ["linker_main.cpp"], |
| 129 | |
| 130 | // Ensure that the compiler won't insert string function calls before ifuncs are resolved. |
| 131 | cflags: ["-ffreestanding"], |
| 132 | } |
| 133 | |
| 134 | cc_library_static { |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 135 | name: "liblinker_malloc", |
| 136 | defaults: ["linker_defaults", "linker_all_targets"], |
| 137 | srcs: ["linker_memory.cpp"], |
| 138 | } |
| 139 | |
| 140 | cc_library_static { |
| 141 | name: "liblinker_debuggerd_stub", |
| 142 | defaults: ["linker_defaults", "linker_all_targets"], |
| 143 | srcs: ["linker_debuggerd_stub.cpp"], |
| 144 | } |
| 145 | |
| 146 | // ======================================================== |
| 147 | // template for the linker binary |
| 148 | // ======================================================== |
| 149 | |
dimitry | b8b3a76 | 2018-09-25 12:31:11 +0200 | [diff] [blame] | 150 | filegroup { |
| 151 | name: "linker_sources", |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 152 | srcs: [ |
| 153 | "dlfcn.cpp", |
| 154 | "linker.cpp", |
| 155 | "linker_block_allocator.cpp", |
Dimitry Ivanov | 769b33f | 2016-07-21 11:33:40 -0700 | [diff] [blame] | 156 | "linker_dlwarning.cpp", |
Evgenii Stepanov | 0a3637d | 2016-07-06 13:20:59 -0700 | [diff] [blame] | 157 | "linker_cfi.cpp", |
Dimitry Ivanov | 4cabfaa | 2017-03-07 11:19:05 -0800 | [diff] [blame] | 158 | "linker_config.cpp", |
Ryan Prichard | 551565e | 2019-12-23 16:03:14 -0800 | [diff] [blame] | 159 | "linker_debug.cpp", |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 160 | "linker_gdb_support.cpp", |
Dimitry Ivanov | 48ec288 | 2016-08-04 11:50:36 -0700 | [diff] [blame] | 161 | "linker_globals.cpp", |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 162 | "linker_libc_support.c", |
Dimitry Ivanov | 451909d | 2017-01-26 16:52:59 -0800 | [diff] [blame] | 163 | "linker_libcxx_support.cpp", |
Dimitry Ivanov | b943f30 | 2016-08-03 16:00:10 -0700 | [diff] [blame] | 164 | "linker_namespaces.cpp", |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 165 | "linker_logger.cpp", |
| 166 | "linker_mapped_file_fragment.cpp", |
| 167 | "linker_phdr.cpp", |
Ryan Prichard | 339ecef | 2020-01-02 16:36:06 -0800 | [diff] [blame] | 168 | "linker_relocate.cpp", |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 169 | "linker_sdk_versions.cpp", |
Dimitry Ivanov | 48ec288 | 2016-08-04 11:50:36 -0700 | [diff] [blame] | 170 | "linker_soinfo.cpp", |
Ryan Prichard | 45d1349 | 2019-01-03 02:51:30 -0800 | [diff] [blame] | 171 | "linker_tls.cpp", |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 172 | "linker_utils.cpp", |
| 173 | "rt.cpp", |
| 174 | ], |
dimitry | b8b3a76 | 2018-09-25 12:31:11 +0200 | [diff] [blame] | 175 | } |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 176 | |
dimitry | b8b3a76 | 2018-09-25 12:31:11 +0200 | [diff] [blame] | 177 | filegroup { |
| 178 | name: "linker_sources_arm", |
| 179 | srcs: [ |
| 180 | "arch/arm/begin.S", |
Ryan Prichard | 129f7a1 | 2019-12-23 16:45:47 -0800 | [diff] [blame] | 181 | "arch/arm_neon/linker_gnu_hash_neon.cpp", |
dimitry | b8b3a76 | 2018-09-25 12:31:11 +0200 | [diff] [blame] | 182 | ], |
| 183 | } |
| 184 | |
| 185 | filegroup { |
| 186 | name: "linker_sources_arm64", |
| 187 | srcs: [ |
| 188 | "arch/arm64/begin.S", |
Ryan Prichard | ffaae70 | 2019-01-23 17:47:10 -0800 | [diff] [blame] | 189 | "arch/arm64/tlsdesc_resolver.S", |
Ryan Prichard | 129f7a1 | 2019-12-23 16:45:47 -0800 | [diff] [blame] | 190 | "arch/arm_neon/linker_gnu_hash_neon.cpp", |
dimitry | b8b3a76 | 2018-09-25 12:31:11 +0200 | [diff] [blame] | 191 | ], |
| 192 | } |
| 193 | |
| 194 | filegroup { |
| 195 | name: "linker_sources_x86", |
| 196 | srcs: [ |
| 197 | "arch/x86/begin.S", |
| 198 | ], |
| 199 | } |
| 200 | |
| 201 | filegroup { |
| 202 | name: "linker_sources_x86_64", |
| 203 | srcs: [ |
| 204 | "arch/x86_64/begin.S", |
| 205 | ], |
| 206 | } |
| 207 | |
dimitry | b8b3a76 | 2018-09-25 12:31:11 +0200 | [diff] [blame] | 208 | cc_defaults { |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 209 | name: "linker_version_script_overlay", |
| 210 | arch: { |
| 211 | arm: { version_script: "linker.arm.map" }, |
| 212 | arm64: { version_script: "linker.generic.map" }, |
| 213 | x86: { version_script: "linker.generic.map" }, |
| 214 | x86_64: { version_script: "linker.generic.map" }, |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 215 | }, |
| 216 | } |
| 217 | |
| 218 | // A template for the linker binary. May be inherited by native bridge implementations. |
| 219 | cc_defaults { |
| 220 | name: "linker_bin_template", |
| 221 | defaults: ["linker_defaults"], |
| 222 | |
| 223 | srcs: [":linker_sources"], |
| 224 | |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 225 | arch: { |
| 226 | arm: { |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 227 | srcs: [":linker_sources_arm"], |
| 228 | static_libs: ["libunwind_llvm"], |
| 229 | }, |
| 230 | arm64: { |
| 231 | srcs: [":linker_sources_arm64"], |
Peter Collingbourne | f2b1e03 | 2019-12-10 17:41:16 -0800 | [diff] [blame] | 232 | static_libs: ["libgcc_stripped"], |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 233 | }, |
| 234 | x86: { |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 235 | srcs: [":linker_sources_x86"], |
Peter Collingbourne | f2b1e03 | 2019-12-10 17:41:16 -0800 | [diff] [blame] | 236 | static_libs: ["libgcc_stripped"], |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 237 | }, |
| 238 | x86_64: { |
| 239 | srcs: [":linker_sources_x86_64"], |
Peter Collingbourne | f2b1e03 | 2019-12-10 17:41:16 -0800 | [diff] [blame] | 240 | static_libs: ["libgcc_stripped"], |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 241 | }, |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 242 | }, |
| 243 | |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 244 | // -shared is used to overwrite the -Bstatic and -static flags triggered by enabling |
| 245 | // static_executable. This dynamic linker is actually a shared object linked with static |
| 246 | // libraries. |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 247 | ldflags: [ |
| 248 | "-shared", |
| 249 | "-Wl,-Bsymbolic", |
| 250 | "-Wl,--exclude-libs,ALL", |
dimitry | 8e8c2c0 | 2018-01-04 12:08:32 +0100 | [diff] [blame] | 251 | "-Wl,-soname,ld-android.so", |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 252 | ], |
| 253 | |
Dimitry Ivanov | fc0d480 | 2016-12-06 11:10:09 -0800 | [diff] [blame] | 254 | // we are going to link libc++_static manually because |
| 255 | // when stl is not set to "none" build system adds libdl |
| 256 | // to the list of static libraries which needs to be |
| 257 | // avoided in the case of building loader. |
| 258 | stl: "none", |
| 259 | |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 260 | // we don't want crtbegin.o (because we have begin.o), so unset it |
| 261 | // just for this module |
| 262 | nocrt: true, |
| 263 | |
dimitry | b8b3a76 | 2018-09-25 12:31:11 +0200 | [diff] [blame] | 264 | static_executable: true, |
| 265 | |
| 266 | // Leave the symbols in the shared library so that stack unwinders can produce |
| 267 | // meaningful name resolution. |
| 268 | strip: { |
| 269 | keep_symbols: true, |
| 270 | }, |
| 271 | |
| 272 | // Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb |
| 273 | // looking up symbols in the linker by mistake. |
| 274 | prefix_symbols: "__dl_", |
| 275 | |
| 276 | sanitize: { |
| 277 | hwaddress: false, |
| 278 | }, |
dimitry | b8b3a76 | 2018-09-25 12:31:11 +0200 | [diff] [blame] | 279 | |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 280 | static_libs: [ |
Ryan Prichard | 249757b | 2019-11-01 17:18:28 -0700 | [diff] [blame] | 281 | "liblinker_main", |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 282 | "liblinker_malloc", |
| 283 | |
| 284 | "libc++_static", |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 285 | "libc_nomalloc", |
Ryan Prichard | 249757b | 2019-11-01 17:18:28 -0700 | [diff] [blame] | 286 | "libc_dynamic_dispatch", |
Dimitry Ivanov | 451909d | 2017-01-26 16:52:59 -0800 | [diff] [blame] | 287 | "libm", |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 288 | ], |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 289 | |
Ryan Prichard | d9a4115 | 2019-10-14 16:58:53 -0700 | [diff] [blame] | 290 | // Ensure that if the linker needs __gnu_Unwind_Find_exidx, then the linker will have a |
| 291 | // definition of the symbol. The linker links against libgcc.a, whose arm32 unwinder has a weak |
| 292 | // reference to __gnu_Unwind_Find_exidx, which isn't sufficient to pull in the strong definition |
| 293 | // of __gnu_Unwind_Find_exidx from libc. An unresolved weak reference would create a |
| 294 | // non-relative dynamic relocation in the linker binary, which complicates linker startup. |
| 295 | // |
| 296 | // This line should be unnecessary because the linker's dependency on libunwind_llvm.a should |
| 297 | // override libgcc.a, but this line provides a simpler guarantee. It can be removed once the |
| 298 | // linker stops linking against libgcc.a's arm32 unwinder. |
| 299 | whole_static_libs: ["libc_unwind_static"], |
| 300 | |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 301 | system_shared_libs: [], |
| 302 | |
| 303 | // Opt out of native_coverage when opting out of system_shared_libs |
| 304 | native_coverage: false, |
| 305 | } |
| 306 | |
| 307 | // ======================================================== |
| 308 | // linker[_asan][64] binary |
| 309 | // ======================================================== |
| 310 | |
| 311 | cc_binary { |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 312 | name: "linker", |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 313 | defaults: [ |
| 314 | "linker_bin_template", |
| 315 | "linux_bionic_supported", |
| 316 | "linker_version_script_overlay", |
| 317 | ], |
| 318 | |
Colin Cross | 10fffb4 | 2016-12-08 09:57:35 -0800 | [diff] [blame] | 319 | symlinks: ["linker_asan"], |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 320 | multilib: { |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 321 | lib64: { |
| 322 | suffix: "64", |
Colin Cross | 10fffb4 | 2016-12-08 09:57:35 -0800 | [diff] [blame] | 323 | }, |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 324 | }, |
Pirama Arumuga Nainar | fcd3538 | 2019-02-14 13:48:01 -0800 | [diff] [blame] | 325 | |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 326 | compile_multilib: "both", |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 327 | |
| 328 | recovery_available: true, |
| 329 | apex_available: [ |
| 330 | "//apex_available:platform", |
| 331 | "com.android.runtime", |
| 332 | ], |
Pirama Arumuga Nainar | fcd3538 | 2019-02-14 13:48:01 -0800 | [diff] [blame] | 333 | |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 334 | target: { |
Dan Willemsen | 7ec52b1 | 2016-11-28 17:02:25 -0800 | [diff] [blame] | 335 | android: { |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 336 | srcs: [ |
| 337 | "linker_debuggerd_android.cpp", |
| 338 | ], |
Dan Albert | 4ea1921 | 2019-07-23 13:31:14 -0700 | [diff] [blame] | 339 | static_libs: [ |
| 340 | "libc++demangle", |
| 341 | "libdebuggerd_handler_fallback", |
| 342 | ], |
Dan Willemsen | 7ec52b1 | 2016-11-28 17:02:25 -0800 | [diff] [blame] | 343 | }, |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 344 | linux_bionic: { |
| 345 | static_libs: [ |
| 346 | "liblinker_debuggerd_stub", |
| 347 | ], |
| 348 | } |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 349 | }, |
Colin Cross | 97f0aef | 2016-07-14 16:05:46 -0700 | [diff] [blame] | 350 | } |
dimitry | 11da1dc | 2018-01-05 13:35:43 +0100 | [diff] [blame] | 351 | |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 352 | // ======================================================== |
| 353 | // assorted modules |
| 354 | // ======================================================== |
| 355 | |
Elliott Hughes | 90f96b9 | 2019-05-09 15:56:39 -0700 | [diff] [blame] | 356 | sh_binary { |
| 357 | name: "ldd", |
| 358 | src: "ldd", |
| 359 | } |
| 360 | |
dimitry | 11da1dc | 2018-01-05 13:35:43 +0100 | [diff] [blame] | 361 | cc_library { |
| 362 | // NOTE: --exclude-libs=libgcc.a makes sure that any symbols ld-android.so pulls from |
| 363 | // libgcc.a are made static to ld-android.so. This in turn ensures that libraries that |
| 364 | // a) pull symbols from libgcc.a and b) depend on ld-android.so will not rely on ld-android.so |
| 365 | // to provide those symbols, but will instead pull them from libgcc.a. Specifically, |
| 366 | // we use this property to make sure libc.so has its own copy of the code from |
| 367 | // libgcc.a it uses. |
| 368 | // |
| 369 | // DO NOT REMOVE --exclude-libs! |
| 370 | |
Yi Kong | 7786a34 | 2018-08-31 19:01:56 -0700 | [diff] [blame] | 371 | ldflags: [ |
| 372 | "-Wl,--exclude-libs=libgcc.a", |
Yi Kong | 7ac2afb | 2019-05-06 16:23:10 -0700 | [diff] [blame] | 373 | "-Wl,--exclude-libs=libgcc_stripped.a", |
Yi Kong | 7786a34 | 2018-08-31 19:01:56 -0700 | [diff] [blame] | 374 | "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a", |
| 375 | "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a", |
| 376 | "-Wl,--exclude-libs=libclang_rt.builtins-x86-android.a", |
| 377 | "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a", |
| 378 | ], |
dimitry | 11da1dc | 2018-01-05 13:35:43 +0100 | [diff] [blame] | 379 | |
| 380 | // for x86, exclude libgcc_eh.a for the same reasons as above |
| 381 | arch: { |
| 382 | x86: { |
| 383 | ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], |
| 384 | }, |
| 385 | x86_64: { |
| 386 | ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], |
| 387 | }, |
| 388 | }, |
dimitry | 581723e | 2018-01-05 14:31:44 +0100 | [diff] [blame] | 389 | |
| 390 | srcs: ["ld_android.cpp"], |
dimitry | 11da1dc | 2018-01-05 13:35:43 +0100 | [diff] [blame] | 391 | cflags: [ |
| 392 | "-Wall", |
| 393 | "-Wextra", |
| 394 | "-Wunused", |
| 395 | "-Werror", |
| 396 | ], |
| 397 | stl: "none", |
| 398 | |
| 399 | name: "ld-android", |
Ryan Prichard | 80e40f0 | 2019-10-31 19:54:46 -0700 | [diff] [blame] | 400 | defaults: ["linux_bionic_supported", "linker_version_script_overlay"], |
Yifan Hong | 5a39cee | 2020-01-21 16:43:56 -0800 | [diff] [blame] | 401 | ramdisk_available: true, |
Jiyong Park | 5603c6e | 2018-04-27 21:53:11 +0900 | [diff] [blame] | 402 | recovery_available: true, |
dimitry | 7f04880 | 2019-05-03 15:57:34 +0200 | [diff] [blame] | 403 | native_bridge_supported: true, |
dimitry | 11da1dc | 2018-01-05 13:35:43 +0100 | [diff] [blame] | 404 | |
Ryan Prichard | 470b666 | 2018-03-27 22:10:55 -0700 | [diff] [blame] | 405 | nocrt: true, |
dimitry | 11da1dc | 2018-01-05 13:35:43 +0100 | [diff] [blame] | 406 | system_shared_libs: [], |
| 407 | |
Pirama Arumuga Nainar | fcd3538 | 2019-02-14 13:48:01 -0800 | [diff] [blame] | 408 | // Opt out of native_coverage when opting out of system_shared_libs |
| 409 | native_coverage: false, |
| 410 | |
dimitry | 11da1dc | 2018-01-05 13:35:43 +0100 | [diff] [blame] | 411 | sanitize: { |
| 412 | never: true, |
| 413 | }, |
Jiyong Park | e87e0dc | 2019-10-02 17:09:33 +0900 | [diff] [blame] | 414 | |
| 415 | apex_available: [ |
| 416 | "//apex_available:platform", |
| 417 | "com.android.runtime", |
| 418 | ], |
dimitry | 11da1dc | 2018-01-05 13:35:43 +0100 | [diff] [blame] | 419 | } |
Elliott Hughes | 15a2b7b | 2019-02-15 13:48:38 -0800 | [diff] [blame] | 420 | |
| 421 | cc_test { |
| 422 | name: "linker-unit-tests", |
| 423 | |
| 424 | cflags: [ |
| 425 | "-g", |
| 426 | "-Wall", |
| 427 | "-Wextra", |
| 428 | "-Wunused", |
| 429 | "-Werror", |
| 430 | ], |
| 431 | |
| 432 | // We need to access Bionic private headers in the linker. |
| 433 | include_dirs: ["bionic/libc"], |
| 434 | |
| 435 | srcs: [ |
| 436 | // Tests. |
| 437 | "linker_block_allocator_test.cpp", |
| 438 | "linker_config_test.cpp", |
| 439 | "linked_list_test.cpp", |
| 440 | "linker_sleb128_test.cpp", |
| 441 | "linker_utils_test.cpp", |
Ryan Prichard | 129f7a1 | 2019-12-23 16:45:47 -0800 | [diff] [blame] | 442 | "linker_gnu_hash_test.cpp", |
Elliott Hughes | 15a2b7b | 2019-02-15 13:48:38 -0800 | [diff] [blame] | 443 | |
| 444 | // Parts of the linker that we're testing. |
| 445 | "linker_block_allocator.cpp", |
| 446 | "linker_config.cpp", |
Ryan Prichard | 551565e | 2019-12-23 16:03:14 -0800 | [diff] [blame] | 447 | "linker_debug.cpp", |
Elliott Hughes | 15a2b7b | 2019-02-15 13:48:38 -0800 | [diff] [blame] | 448 | "linker_test_globals.cpp", |
| 449 | "linker_utils.cpp", |
| 450 | ], |
| 451 | |
| 452 | static_libs: [ |
| 453 | "libasync_safe", |
| 454 | "libbase", |
| 455 | "liblog", |
| 456 | ], |
Ryan Prichard | 129f7a1 | 2019-12-23 16:45:47 -0800 | [diff] [blame] | 457 | |
| 458 | arch: { |
| 459 | arm: { |
| 460 | srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"], |
| 461 | }, |
| 462 | arm64: { |
| 463 | srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"], |
| 464 | }, |
| 465 | }, |
| 466 | } |
| 467 | |
| 468 | cc_benchmark { |
| 469 | name: "linker-benchmarks", |
| 470 | |
| 471 | srcs: [ |
| 472 | "linker_gnu_hash_benchmark.cpp", |
| 473 | ], |
| 474 | |
| 475 | arch: { |
| 476 | arm: { |
| 477 | srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"], |
| 478 | }, |
| 479 | arm64: { |
| 480 | srcs: ["arch/arm_neon/linker_gnu_hash_neon.cpp"], |
| 481 | }, |
| 482 | }, |
Elliott Hughes | 15a2b7b | 2019-02-15 13:48:38 -0800 | [diff] [blame] | 483 | } |