xref: /aosp_15_r20/external/strace/Android.bp (revision cf84ac9a129d8ea9952db616b4e9b904c4bdde56)
1package {
2    default_applicable_licenses: ["external_strace_license"],
3}
4
5license {
6    name: "external_strace_license",
7    visibility: [":__subpackages__"],
8    license_kinds: [
9        "SPDX-license-identifier-BSD",
10        "SPDX-license-identifier-FSFAP",
11        "SPDX-license-identifier-MIT",
12        "legacy_notice",
13        "legacy_unencumbered",
14    ],
15    license_text: [
16        "COPYING",
17    ],
18}
19
20cc_binary {
21
22    srcs: [
23        "access.c",
24        "affinity.c",
25        "aio.c",
26        "basic_filters.c",
27        "bind.c",
28        "bjm.c",
29        "block.c",
30        "bpf.c",
31        "bpf_filter.c",
32        "bpf_seccomp_filter.c",
33        "bpf_sock_filter.c",
34        "btrfs.c",
35        "cacheflush.c",
36        "capability.c",
37        "chdir.c",
38        "chmod.c",
39        "clone.c",
40        "copy_file_range.c",
41        "count.c",
42        "delay.c",
43        "desc.c",
44        "dirent.c",
45        "dirent64.c",
46        "dm.c",
47        "dyxlat.c",
48        "epoll.c",
49        "error_prints.c",
50        "evdev.c",
51        "evdev_mpers.c",
52        "eventfd.c",
53        "execve.c",
54        "fadvise.c",
55        "fallocate.c",
56        "fanotify.c",
57        "fchownat.c",
58        "fcntl.c",
59        "fetch_bpf_fprog.c",
60        "fetch_indirect_syscall_args.c",
61        "fetch_struct_flock.c",
62        "fetch_struct_keyctl_kdf_params.c",
63        "fetch_struct_mmsghdr.c",
64        "fetch_struct_msghdr.c",
65        "fetch_struct_stat.c",
66        "fetch_struct_stat64.c",
67        "fetch_struct_statfs.c",
68        "fetch_struct_xfs_quotastat.c",
69        "file_handle.c",
70        "file_ioctl.c",
71        "filter_qualify.c",
72        "flock.c",
73        "fstatfs.c",
74        "fstatfs64.c",
75        "fs_x_ioctl.c",
76        "futex.c",
77        "getcpu.c",
78        "getcwd.c",
79        "getpagesize.c",
80        "getrandom.c",
81        "get_robust_list.c",
82        "hdio.c",
83        "hostname.c",
84        "inotify.c",
85        "inotify_ioctl.c",
86        "io.c",
87        "ioctl.c",
88        "ioperm.c",
89        "iopl.c",
90        "ioprio.c",
91        "ipc.c",
92        "ipc_msg.c",
93        "ipc_msgctl.c",
94        "ipc_sem.c",
95        "ipc_shm.c",
96        "ipc_shmctl.c",
97        "kcmp.c",
98        "kexec.c",
99        "keyctl.c",
100        "kvm.c",
101        "ldt.c",
102        "link.c",
103        "listen.c",
104        "lookup_dcookie.c",
105        "loop.c",
106        "lseek.c",
107        "mem.c",
108        "membarrier.c",
109        "memfd_create.c",
110        "mknod.c",
111        "mmap_cache.c",
112        "mmap_notify.c",
113        "mmsghdr.c",
114        "mount.c",
115        "mq.c",
116        "msghdr.c",
117        "mtd.c",
118        "nbd_ioctl.c",
119        "net.c",
120        "netlink.c",
121        "netlink_crypto.c",
122        "netlink_inet_diag.c",
123        "netlink_kobject_uevent.c",
124        "netlink_netfilter.c",
125        "netlink_netlink_diag.c",
126        "netlink_packet_diag.c",
127        "netlink_route.c",
128        "netlink_selinux.c",
129        "netlink_smc_diag.c",
130        "netlink_sock_diag.c",
131        "netlink_unix_diag.c",
132        "nlattr.c",
133        "nsfs.c",
134        "numa.c",
135        "number_set.c",
136        "oldstat.c",
137        "open.c",
138        "pathtrace.c",
139        "perf.c",
140        "perf_ioctl.c",
141        "personality.c",
142        "pkeys.c",
143        "poll.c",
144        "prctl.c",
145        "print_aio_sigset.c",
146        "print_dev_t.c",
147        "print_group_req.c",
148        "print_ifindex.c",
149        "print_mac.c",
150        "print_mq_attr.c",
151        "print_msgbuf.c",
152        "print_sigevent.c",
153        "print_sg_req_info.c",
154        "print_statfs.c",
155        "print_struct_stat.c",
156        "print_time.c",
157        "print_timespec.c",
158        "print_timeval.c",
159        "print_timex.c",
160        "printmode.c",
161        "printrusage.c",
162        "printsiginfo.c",
163        "process.c",
164        "process_vm.c",
165        "ptp.c",
166        "quota.c",
167        "readahead.c",
168        "readlink.c",
169        "reboot.c",
170        "renameat.c",
171        "resource.c",
172        "retval.c",
173        "riscv.c",
174        "rtc.c",
175        "rtnl_addr.c",
176        "rtnl_addrlabel.c",
177        "rtnl_dcb.c",
178        "rtnl_link.c",
179        "rtnl_mdb.c",
180        "rtnl_neigh.c",
181        "rtnl_neightbl.c",
182        "rtnl_netconf.c",
183        "rtnl_nsid.c",
184        "rtnl_route.c",
185        "rtnl_rule.c",
186        "rtnl_tc.c",
187        "rtnl_tc_action.c",
188        "rt_sigframe.c",
189        "rt_sigreturn.c",
190        "sched.c",
191        "scsi.c",
192        "seccomp.c",
193        "sendfile.c",
194        "sg_io_v3.c",
195        "sg_io_v4.c",
196        "shutdown.c",
197        "sigaltstack.c",
198        "signal.c",
199        "signalfd.c",
200        "sigreturn.c",
201        "sock.c",
202        "sockaddr.c",
203        "socketcall.c",
204        "socketutils.c",
205        "sram_alloc.c",
206        "stat.c",
207        "stat64.c",
208        "statfs.c",
209        "statfs64.c",
210        "statx.c",
211        "strace.c",
212        "string_to_uint.c",
213        "swapon.c",
214        "sync_file_range.c",
215        "sync_file_range2.c",
216        "syscall.c",
217        "sysctl.c",
218        "sysinfo.c",
219        "syslog.c",
220        "sysmips.c",
221        "term.c",
222        "time.c",
223        "times.c",
224        "truncate.c",
225        "ubi.c",
226        "ucopy.c",
227        "uid16.c",
228        "uid.c",
229        "umask.c",
230        "umount.c",
231        "uname.c",
232        "upeek.c",
233        "upoke.c",
234        "userfaultfd.c",
235        "ustat.c",
236        "util.c",
237        "utime.c",
238        "utimes.c",
239        "v4l2.c",
240        "wait.c",
241        "xattr.c",
242        "xlat.c",
243        "xmalloc.c",
244    ],
245
246    // We have "config.h", but since we're using one file for both LP32 and LP64,
247    // we need to set the hard-coded size #defines here instead.
248    cflags: ["-DHAVE_CONFIG_H"] + [
249        "-DSIZEOF_KERNEL_LONG_T=SIZEOF_LONG",
250        "-DSIZEOF_OFF_T=SIZEOF_LONG",
251    ] + [
252        "-Wall",
253        "-Werror",
254        "-Wno-initializer-overrides",
255        "-Wno-missing-field-initializers",
256        "-Wno-nonnull",
257        "-Wno-pointer-arith",
258        "-Wno-unused-parameter",
259        "-Wno-sign-compare",
260        "-fno-strict-aliasing",
261    ],
262    multilib: {
263        lib32: {
264            cflags: [
265                "-DSIZEOF_LONG_LONG=8",
266                "-DSIZEOF_LONG=4",
267                "-DSIZEOF_RLIM_T=4",
268                "-DHAVE_STRUCT_STAT64=1",
269            ],
270        },
271        lib64: {
272            cflags: [
273                "-DSIZEOF_LONG_LONG=8",
274                "-DSIZEOF_LONG=8",
275                "-DSIZEOF_RLIM_T=8",
276            ],
277        },
278    },
279
280    arch: {
281        arm: {
282            cflags: ["-DARM=1"] + ["-DHAVE_STRUCT___OLD_KERNEL_STAT=1"],
283
284            local_include_dirs: [
285                "linux/arm",
286                "linux",
287            ],
288        },
289        arm64: {
290            cflags: ["-DAARCH64=1"],
291
292            local_include_dirs: [
293                "linux/aarch64",
294                "linux",
295            ],
296        },
297        riscv64: {
298            cflags: ["-DRISCV=1"],
299
300            local_include_dirs: [
301                "linux/riscv",
302                "linux",
303            ],
304        },
305        x86: {
306            cflags: ["-DI386=1"] + ["-DHAVE_STRUCT___OLD_KERNEL_STAT=1"],
307
308            local_include_dirs: [
309                "linux/i386",
310                "linux",
311            ],
312        },
313        x86_64: {
314            cflags: ["-DX86_64=1"],
315
316            local_include_dirs: [
317                "linux/x86_64",
318                "linux",
319            ],
320        },
321    },
322
323    name: "strace",
324
325}
326