1// 2// Copyright (C) 2019 The Android Open Source Project 3// All rights reserved. 4// 5// Redistribution and use in source and binary forms, with or without 6// modification, are permitted provided that the following conditions 7// are met: 8// * Redistributions of source code must retain the above copyright 9// notice, this list of conditions and the following disclaimer. 10// * Redistributions in binary form must reproduce the above copyright 11// notice, this list of conditions and the following disclaimer in 12// the documentation and/or other materials provided with the 13// distribution. 14// 15// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26// SUCH DAMAGE. 27// 28 29package { 30 default_applicable_licenses: ["bionic_benchmarks_license"], 31} 32 33cc_defaults { 34 name: "bionic_spawn_benchmark_targets", 35 host_supported: true, 36 target: { 37 darwin: { 38 enabled: false, 39 }, 40 windows: { 41 enabled: false, 42 }, 43 linux_glibc_x86: { 44 enabled: false, 45 }, 46 }, 47} 48 49cc_library_static { 50 name: "libbionic_spawn_benchmark", 51 defaults: ["bionic_spawn_benchmark_targets"], 52 53 srcs: ["spawn_benchmark.cpp"], 54 export_include_dirs: ["include"], 55 static_libs: [ 56 "libbase", 57 "libgoogle-benchmark", 58 "liblog", 59 ], 60} 61 62cc_benchmark { 63 name: "bionic-spawn-benchmarks", 64 defaults: ["bionic_spawn_benchmark_targets"], 65 66 srcs: ["spawn_benchmarks.cpp"], 67 static_libs: [ 68 "libbase", 69 "libbionic_spawn_benchmark", 70 "liblog", 71 ], 72 73 // Install these binaries in the same directory as the main benchmark binary. 74 data: [ 75 ":bench_cxa_atexit", 76 ":bench_noop", 77 ":bench_noop_nostl", 78 ":bench_noop_static", 79 ], 80} 81 82cc_defaults { 83 name: "bionic_spawn_benchmark_binary", 84 defaults: ["bionic_spawn_benchmark_targets"], 85 86 compile_multilib: "both", 87 multilib: { 88 lib32: { 89 suffix: "32", 90 }, 91 lib64: { 92 suffix: "64", 93 }, 94 }, 95 96 // When this binary is installed to host/linux-x86/bin, its runpath is ${ORIGIN}/../lib64, which 97 // is fine for finding host/linux-x86/lib64/libc++.so. When it's installed to 98 // host/linux-x86/benchmarktest64/bionic-spawn-benchmarks, the runpath needs an extra "..". This 99 // argument has no effect when a static executable is produced. 100 target: { 101 linux_glibc_x86_64: { 102 ldflags: [ 103 "-Wl,--rpath,${ORIGIN}/../../lib64", 104 ], 105 }, 106 }, 107} 108 109cc_binary { 110 defaults: ["bionic_spawn_benchmark_binary"], 111 name: "bench_cxa_atexit", 112 srcs: ["bench_cxa_atexit.cpp"], 113} 114 115cc_binary { 116 defaults: ["bionic_spawn_benchmark_binary"], 117 name: "bench_noop", 118 srcs: ["noop.cpp"], 119} 120 121cc_binary { 122 defaults: ["bionic_spawn_benchmark_binary"], 123 name: "bench_noop_nostl", 124 srcs: ["noop.cpp"], 125 stl: "none", 126} 127 128cc_binary { 129 defaults: ["bionic_spawn_benchmark_binary"], 130 name: "bench_noop_static", 131 srcs: ["noop.cpp"], 132 static_executable: true, 133 stl: "libc++_static", 134} 135