blob: 61e7bf634f2abaa16cfa53b139a16d1cc9dfb6a5 [file] [log] [blame]
Ryan Prichard2c236bc2019-09-26 12:47:47 -07001//
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
Bob Badouraa7d8352021-02-19 13:06:22 -080029package {
30 default_applicable_licenses: ["bionic_benchmarks_license"],
31}
32
Ryan Prichard41f19702019-12-23 13:21:42 -080033cc_defaults {
34 name: "bionic_spawn_benchmark_targets",
Ryan Prichard2c236bc2019-09-26 12:47:47 -070035 host_supported: true,
36 target: {
Tom Cherry2f95d192020-01-09 10:06:12 -080037 darwin: {
38 enabled: false,
39 },
40 windows: {
41 enabled: false,
42 },
43 linux_glibc_x86: {
44 enabled: false,
45 },
Colin Crossda446cc2022-03-08 15:07:57 -080046 linux_musl_x86: {
47 enabled: false,
48 },
Ryan Prichard2c236bc2019-09-26 12:47:47 -070049 },
50}
51
Ryan Prichard41f19702019-12-23 13:21:42 -080052cc_library_static {
53 name: "libbionic_spawn_benchmark",
54 defaults: ["bionic_spawn_benchmark_targets"],
55
56 srcs: ["spawn_benchmark.cpp"],
57 export_include_dirs: ["include"],
58 static_libs: [
59 "libbase",
60 "libgoogle-benchmark",
61 "liblog",
62 ],
63}
64
65cc_benchmark {
66 name: "bionic-spawn-benchmarks",
67 defaults: ["bionic_spawn_benchmark_targets"],
68
69 srcs: ["spawn_benchmarks.cpp"],
70 static_libs: [
71 "libbase",
72 "libbionic_spawn_benchmark",
73 "liblog",
74 ],
75
76 // Install these binaries in the same directory as the main benchmark binary.
77 data: [
Ryan Pricharda3d41ee2020-10-07 16:32:27 -070078 ":bench_cxa_atexit",
Ryan Prichard41f19702019-12-23 13:21:42 -080079 ":bench_noop",
80 ":bench_noop_nostl",
81 ":bench_noop_static",
82 ],
83}
84
Ryan Prichard2c236bc2019-09-26 12:47:47 -070085cc_defaults {
Ryan Pricharda3d41ee2020-10-07 16:32:27 -070086 name: "bionic_spawn_benchmark_binary",
Ryan Prichard41f19702019-12-23 13:21:42 -080087 defaults: ["bionic_spawn_benchmark_targets"],
Ryan Prichard2c236bc2019-09-26 12:47:47 -070088
89 compile_multilib: "both",
90 multilib: {
Tom Cherry2f95d192020-01-09 10:06:12 -080091 lib32: {
92 suffix: "32",
93 },
94 lib64: {
95 suffix: "64",
96 },
Ryan Prichard2c236bc2019-09-26 12:47:47 -070097 },
Ryan Prichard2c236bc2019-09-26 12:47:47 -070098
99 // When this binary is installed to host/linux-x86/bin, its runpath is ${ORIGIN}/../lib64, which
100 // is fine for finding host/linux-x86/lib64/libc++.so. When it's installed to
Ryan Pricharda3d41ee2020-10-07 16:32:27 -0700101 // host/linux-x86/benchmarktest64/bionic-spawn-benchmarks, the runpath needs an extra "..". This
102 // argument has no effect when a static executable is produced.
Ryan Prichard2c236bc2019-09-26 12:47:47 -0700103 target: {
104 linux_glibc_x86_64: {
105 ldflags: [
106 "-Wl,--rpath,${ORIGIN}/../../lib64",
107 ],
108 },
Colin Crossda446cc2022-03-08 15:07:57 -0800109 linux_musl_x86_64: {
110 ldflags: [
111 "-Wl,--rpath,${ORIGIN}/../../lib64",
112 ],
113 },
Tom Cherry2f95d192020-01-09 10:06:12 -0800114 },
Ryan Prichard2c236bc2019-09-26 12:47:47 -0700115}
116
117cc_binary {
Ryan Pricharda3d41ee2020-10-07 16:32:27 -0700118 defaults: ["bionic_spawn_benchmark_binary"],
119 name: "bench_cxa_atexit",
120 srcs: ["bench_cxa_atexit.cpp"],
121}
122
123cc_binary {
124 defaults: ["bionic_spawn_benchmark_binary"],
125 name: "bench_noop",
126 srcs: ["noop.cpp"],
127}
128
129cc_binary {
130 defaults: ["bionic_spawn_benchmark_binary"],
Ryan Prichard2c236bc2019-09-26 12:47:47 -0700131 name: "bench_noop_nostl",
132 srcs: ["noop.cpp"],
133 stl: "none",
134}
135
136cc_binary {
Ryan Pricharda3d41ee2020-10-07 16:32:27 -0700137 defaults: ["bionic_spawn_benchmark_binary"],
Ryan Prichard2c236bc2019-09-26 12:47:47 -0700138 name: "bench_noop_static",
139 srcs: ["noop.cpp"],
140 static_executable: true,
141 stl: "libc++_static",
142}