Lorenz Brun | 0de1893 | 2021-03-11 00:36:48 +0100 | [diff] [blame] | 1 | Copyright 2020 The Monogon Project Authors. |
| 2 | |
| 3 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | you may not use this file except in compliance with the License. |
| 5 | You may obtain a copy of the License at |
| 6 | |
| 7 | http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | |
| 9 | Unless required by applicable law or agreed to in writing, software |
| 10 | distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | See the License for the specific language governing permissions and |
| 13 | limitations under the License. |
| 14 | |
| 15 | |
| 16 | From 88ba396b627c26b9b01c2bc358557964cbb59cf8 Mon Sep 17 00:00:00 2001 |
| 17 | From: Lorenz Brun <lorenz@brun.one> |
| 18 | Date: Wed, 10 Mar 2021 18:25:11 +0100 |
| 19 | Subject: [PATCH 3/6] Add Bazel support |
| 20 | |
| 21 | --- |
| 22 | BUILD | 1146 +++++++++++++++++++++++++++++++ |
| 23 | defs.bzl | 52 ++ |
| 24 | qapi/BUILD | 25 + |
| 25 | qapi/defs.bzl | 40 ++ |
| 26 | scripts/BUILD | 35 + |
| 27 | scripts/modules/BUILD | 7 + |
| 28 | scripts/qapi/BUILD | 7 + |
| 29 | scripts/qapi/defs.bzl | 52 ++ |
| 30 | scripts/tracetool/BUILD | 11 + |
| 31 | scripts/tracetool/backend/BUILD | 7 + |
| 32 | scripts/tracetool/defs.bzl | 65 ++ |
| 33 | scripts/tracetool/format/BUILD | 7 + |
| 34 | trace/BUILD | 18 + |
| 35 | 13 files changed, 1472 insertions(+) |
| 36 | create mode 100644 BUILD |
| 37 | create mode 100644 defs.bzl |
| 38 | create mode 100644 qapi/BUILD |
| 39 | create mode 100644 qapi/defs.bzl |
| 40 | create mode 100644 scripts/BUILD |
| 41 | create mode 100644 scripts/modules/BUILD |
| 42 | create mode 100644 scripts/qapi/BUILD |
| 43 | create mode 100644 scripts/qapi/defs.bzl |
| 44 | create mode 100644 scripts/tracetool/BUILD |
| 45 | create mode 100644 scripts/tracetool/backend/BUILD |
| 46 | create mode 100644 scripts/tracetool/defs.bzl |
| 47 | create mode 100644 scripts/tracetool/format/BUILD |
| 48 | create mode 100644 trace/BUILD |
| 49 | |
| 50 | diff --git a/BUILD b/BUILD |
| 51 | new file mode 100644 |
| 52 | index 0000000000..436f8c5cf3 |
| 53 | --- /dev/null |
| 54 | +++ b/BUILD |
| 55 | @@ -0,0 +1,1147 @@ |
| 56 | +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") |
| 57 | +load("@rules_python//python:defs.bzl", "py_binary") |
| 58 | +load("@dev_source_monogon//build/utils:template_file.bzl", "template_file") |
| 59 | +load(":defs.bzl", "filter_label_suffix") |
| 60 | +load("//:defs.bzl", "cc_qemu_keymaps") |
| 61 | + |
| 62 | +filegroup( |
| 63 | + name = "trace-files", |
| 64 | + srcs = glob(["**/trace-events"]) + ["//qapi:trace-events"], |
| 65 | + visibility = ["//visibility:public"], |
| 66 | +) |
| 67 | + |
| 68 | +filter_label_suffix( |
| 69 | + name = "qapi_hdrs_gen", |
| 70 | + srcs = ["//qapi:qapi_generated"], |
| 71 | + suffix = ".h", |
| 72 | +) |
| 73 | + |
| 74 | +filter_label_suffix( |
| 75 | + name = "qapi_c", |
| 76 | + srcs = ["//qapi:qapi_generated"], |
| 77 | + suffix = ".c", |
| 78 | +) |
| 79 | + |
| 80 | +filter_label_suffix( |
| 81 | + name = "trace_c", |
| 82 | + srcs = ["//trace"], |
| 83 | + exclude = [ |
| 84 | + "trace-linux-user.c", |
| 85 | + "trace-hw_pci-host.c", |
| 86 | + ], |
| 87 | + suffix = ".c", |
| 88 | +) |
| 89 | + |
| 90 | +genrule( |
| 91 | + name = "block-coroutine-gen", |
| 92 | + srcs = [ |
| 93 | + "include/block/block.h", |
| 94 | + "block/coroutines.h", |
| 95 | + ], |
| 96 | + outs = ["block-gen.c"], |
| 97 | + cmd = "./$(location //scripts:block-coroutine-wrapper) \"$@\" $(location include/block/block.h) $(location block/coroutines.h)", |
| 98 | + tools = ["//scripts:block-coroutine-wrapper"], |
| 99 | +) |
| 100 | + |
| 101 | +filter_label_suffix( |
| 102 | + name = "trace_hdrs_gen", |
| 103 | + srcs = ["//trace"], |
| 104 | + suffix = ".h", |
| 105 | +) |
| 106 | + |
| 107 | +filegroup( |
| 108 | + name = "gen_hdrs", |
| 109 | + srcs = [ |
| 110 | + ":libslirp-version.h", |
| 111 | + ":qapi_hdrs_gen", |
| 112 | + ":trace_hdrs_gen", |
| 113 | + "//qapi:extra_hdrs", |
| 114 | + "//trace:extra_hdrs", |
| 115 | + ], |
| 116 | +) |
| 117 | + |
| 118 | +filegroup( |
| 119 | + name = "all_headers", |
| 120 | + srcs = glob([ |
| 121 | + "accel/**/*.h", |
| 122 | + "accel/**/*.inc", |
| 123 | + "audio/**/*.h", |
| 124 | + "audio/**/*.inc", |
| 125 | + "authz/**/*.h", |
| 126 | + "authz/**/*.inc", |
| 127 | + "backends/**/*.h", |
| 128 | + "backends/**/*.inc", |
| 129 | + "block/**/*.h", |
| 130 | + "block/**/*.inc", |
| 131 | + "capstone/**/*.h", |
| 132 | + "capstone/**/*.inc", |
| 133 | + "chardev/**/*.h", |
| 134 | + "chardev/**/*.inc", |
| 135 | + "contrib/**/*.h", |
| 136 | + "contrib/**/*.inc", |
| 137 | + "crypto/**/*.h", |
| 138 | + "crypto/**/*.inc", |
| 139 | + "default-configs/**/*.h", |
| 140 | + "default-configs/**/*.inc", |
| 141 | + "disas/**/*.h", |
| 142 | + "disas/**/*.inc", |
| 143 | + "dtc/**/*.h", |
| 144 | + "dtc/**/*.inc", |
| 145 | + "dump/**/*.h", |
| 146 | + "dump/**/*.inc", |
| 147 | + "fpu/**/*.h", |
| 148 | + "fpu/**/*.inc", |
| 149 | + "fsdev/**/*.h", |
| 150 | + "fsdev/**/*.inc", |
| 151 | + "gdb-xml/**/*.h", |
| 152 | + "gdb-xml/**/*.inc", |
| 153 | + "hw/**/*.h", |
| 154 | + "hw/**/*.inc", |
| 155 | + "include/**/*.h", |
| 156 | + "include/**/*.inc", |
| 157 | + "io/**/*.h", |
| 158 | + "io/**/*.inc", |
| 159 | + "libdecnumber/**/*.h", |
| 160 | + "libdecnumber/**/*.inc", |
| 161 | + "linux-headers/**/*.h", |
| 162 | + "linux-headers/**/*.inc", |
| 163 | + "linux-user/**/*.h", |
| 164 | + "linux-user/**/*.inc", |
| 165 | + "migration/**/*.h", |
| 166 | + "migration/**/*.inc", |
| 167 | + "monitor/**/*.h", |
| 168 | + "monitor/**/*.inc", |
| 169 | + "nbd/**/*.h", |
| 170 | + "nbd/**/*.inc", |
| 171 | + "net/**/*.h", |
| 172 | + "net/**/*.inc", |
| 173 | + "plugins/**/*.h", |
| 174 | + "plugins/**/*.inc", |
| 175 | + "qapi/**/*.h", |
| 176 | + "qapi/**/*.inc", |
| 177 | + "qga/**/*.h", |
| 178 | + "qga/**/*.inc", |
| 179 | + "qobject/**/*.h", |
| 180 | + "qobject/**/*.inc", |
| 181 | + "qom/**/*.h", |
| 182 | + "qom/**/*.inc", |
| 183 | + "replay/**/*.h", |
| 184 | + "replay/**/*.inc", |
| 185 | + "scripts/**/*.h", |
| 186 | + "scripts/**/*.inc", |
| 187 | + "scsi/**/*.h", |
| 188 | + "scsi/**/*.inc", |
| 189 | + "slirp/**/*.h", |
| 190 | + "slirp/**/*.inc", |
| 191 | + "softmmu/**/*.h", |
| 192 | + "softmmu/**/*.inc", |
| 193 | + "storage-daemon/**/*.h", |
| 194 | + "storage-daemon/**/*.inc", |
| 195 | + "subprojects/**/*.h", |
| 196 | + "subprojects/**/*.inc", |
| 197 | + "stubs/**/*.h", |
| 198 | + "stubs/**/*.inc", |
| 199 | + "target/**/*.h", |
| 200 | + "target/**/*.inc", |
| 201 | + "tcg/**/*.h", |
| 202 | + "tcg/**/*.inc", |
| 203 | + "tools/**/*.h", |
| 204 | + "tools/**/*.inc", |
| 205 | + "trace/**/*.h", |
| 206 | + "trace/**/*.inc", |
| 207 | + "ui/**/*.h", |
| 208 | + "ui/**/*.inc", |
| 209 | + "util/**/*.h", |
| 210 | + "util/**/*.inc", |
| 211 | + ]) + [ |
| 212 | + ":hmp-commands", |
| 213 | + ":module-block", |
| 214 | + ":cursor-hdrs", |
| 215 | + ":keymaps-gen", |
| 216 | + "qemu-img-cmds.h", |
| 217 | + "qemu-options.h", |
| 218 | + "qemu-options-wrapper.h", |
| 219 | + "qemu-version.h", |
| 220 | + "replication.h", |
| 221 | + "x86_64-softmmu-config-devices.h", |
| 222 | + "x86_64-softmmu-config-target.h", |
| 223 | + "memory_ldst.c.inc", |
| 224 | + ], |
| 225 | +) |
| 226 | + |
| 227 | +cc_library( |
| 228 | + name = "capstone", |
| 229 | + srcs = [":all_headers"] + [ |
| 230 | + "capstone/cs.c", |
| 231 | + "capstone/MCInst.c", |
| 232 | + "capstone/MCInstrDesc.c", |
| 233 | + "capstone/MCRegisterInfo.c", |
| 234 | + "capstone/SStream.c", |
| 235 | + "capstone/utils.c", |
| 236 | + "capstone/arch/X86/X86Disassembler.c", |
| 237 | + "capstone/arch/X86/X86DisassemblerDecoder.c", |
| 238 | + "capstone/arch/X86/X86ATTInstPrinter.c", |
| 239 | + "capstone/arch/X86/X86IntelInstPrinter.c", |
| 240 | + "capstone/arch/X86/X86InstPrinterCommon.c", |
| 241 | + "capstone/arch/X86/X86Mapping.c", |
| 242 | + "capstone/arch/X86/X86Module.c", |
| 243 | + ], |
| 244 | + local_defines = [ |
| 245 | + "_GNU_SOURCE", |
| 246 | + "_FILE_OFFSET_BITS=64", |
| 247 | + "_LARGEFILE_SOURCE", |
| 248 | + ], |
| 249 | + includes = ["capstone/include"], |
| 250 | +) |
| 251 | + |
| 252 | +template_file( |
| 253 | + name = "libslirp-version.h", |
| 254 | + src = "slirp/src/libslirp-version.h.in", |
| 255 | + substitutions = { |
| 256 | + "@SLIRP_MAJOR_VERSION@": "0", |
| 257 | + "@SLIRP_MINOR_VERSION@": "0", |
| 258 | + "@SLIRP_MICRO_VERSION@": "1", |
| 259 | + "@SLIRP_VERSION_STRING@": "\"0.0.1\"", |
| 260 | + }, |
| 261 | +) |
| 262 | + |
| 263 | +cc_library( |
| 264 | + name = "slirp", |
| 265 | + srcs = [":all_headers"] + [ |
| 266 | + "slirp/src/arp_table.c", |
| 267 | + "slirp/src/bootp.c", |
| 268 | + "slirp/src/cksum.c", |
| 269 | + "slirp/src/dhcpv6.c", |
| 270 | + "slirp/src/dnssearch.c", |
| 271 | + "slirp/src/if.c", |
| 272 | + "slirp/src/ip6_icmp.c", |
| 273 | + "slirp/src/ip6_input.c", |
| 274 | + "slirp/src/ip6_output.c", |
| 275 | + "slirp/src/ip_icmp.c", |
| 276 | + "slirp/src/ip_input.c", |
| 277 | + "slirp/src/ip_output.c", |
| 278 | + "slirp/src/mbuf.c", |
| 279 | + "slirp/src/misc.c", |
| 280 | + "slirp/src/ncsi.c", |
| 281 | + "slirp/src/ndp_table.c", |
| 282 | + "slirp/src/sbuf.c", |
| 283 | + "slirp/src/slirp.c", |
| 284 | + "slirp/src/socket.c", |
| 285 | + "slirp/src/state.c", |
| 286 | + "slirp/src/stream.c", |
| 287 | + "slirp/src/tcp_input.c", |
| 288 | + "slirp/src/tcp_output.c", |
| 289 | + "slirp/src/tcp_subr.c", |
| 290 | + "slirp/src/tcp_timer.c", |
| 291 | + "slirp/src/tftp.c", |
| 292 | + "slirp/src/udp.c", |
| 293 | + "slirp/src/udp6.c", |
| 294 | + "slirp/src/util.c", |
| 295 | + "slirp/src/version.c", |
| 296 | + "slirp/src/vmstate.c", |
| 297 | + ] + [":libslirp-version.h"], |
| 298 | + local_defines = [ |
| 299 | + "_GNU_SOURCE", |
| 300 | + "_FILE_OFFSET_BITS=64", |
| 301 | + "_LARGEFILE_SOURCE", |
| 302 | + "G_LOG_DOMAIN=\\\"Slirp\\\"", |
| 303 | + ], |
| 304 | + deps = [ |
| 305 | + "@glib//glib", |
| 306 | + ], |
| 307 | + includes = ["include", "slirp/src"], |
| 308 | +) |
| 309 | + |
| 310 | +cc_library( |
| 311 | + name = "fdt", |
| 312 | + srcs = [":all_headers"] + [ |
| 313 | + "dtc/libfdt/fdt.c", |
| 314 | + "dtc/libfdt/fdt_ro.c", |
| 315 | + "dtc/libfdt/fdt_wip.c", |
| 316 | + "dtc/libfdt/fdt_sw.c", |
| 317 | + "dtc/libfdt/fdt_rw.c", |
| 318 | + "dtc/libfdt/fdt_strerror.c", |
| 319 | + "dtc/libfdt/fdt_empty_tree.c", |
| 320 | + "dtc/libfdt/fdt_addresses.c", |
| 321 | + "dtc/libfdt/fdt_overlay.c", |
| 322 | + "dtc/libfdt/fdt_check.c", |
| 323 | + ], |
| 324 | + local_defines = [ |
| 325 | + "_GNU_SOURCE", |
| 326 | + "_FILE_OFFSET_BITS=64", |
| 327 | + "_LARGEFILE_SOURCE", |
| 328 | + ], |
| 329 | + includes = ["include", "dtc/libfdt", "disas/libvixl"], |
| 330 | +) |
| 331 | + |
| 332 | +cc_library( |
| 333 | + name = "qemu", |
| 334 | + srcs = [":all_headers"] + [ |
| 335 | + "accel/accel.c", |
| 336 | + "audio/audio_legacy.c", |
| 337 | + "audio/audio.c", |
| 338 | + "audio/mixeng.c", |
| 339 | + "audio/noaudio.c", |
| 340 | + "audio/wavaudio.c", |
| 341 | + "audio/wavcapture.c", |
| 342 | + "authz/base.c", |
| 343 | + "authz/list.c", |
| 344 | + "authz/listfile.c", |
| 345 | + "authz/simple.c", |
| 346 | + "backends/cryptodev-builtin.c", |
| 347 | + "backends/cryptodev-vhost.c", |
| 348 | + "backends/cryptodev.c", |
| 349 | + "backends/hostmem-file.c", |
| 350 | + "backends/hostmem-memfd.c", |
| 351 | + "backends/hostmem-ram.c", |
| 352 | + "backends/hostmem.c", |
| 353 | + "backends/rng-builtin.c", |
| 354 | + "backends/rng-egd.c", |
| 355 | + "backends/rng-random.c", |
| 356 | + "backends/rng.c", |
| 357 | + "backends/tpm/tpm_backend.c", |
| 358 | + "backends/tpm/tpm_emulator.c", |
| 359 | + "backends/tpm/tpm_passthrough.c", |
| 360 | + "backends/tpm/tpm_util.c", |
| 361 | + "block.c", |
| 362 | + "block/accounting.c", |
| 363 | + "block/aio_task.c", |
| 364 | + "block/amend.c", |
| 365 | + "block/backup-top.c", |
| 366 | + "block/backup.c", |
| 367 | + "block/blkdebug.c", |
| 368 | + "block/blklogwrites.c", |
| 369 | + "block/blkverify.c", |
| 370 | + "block/block-backend.c", |
| 371 | + "block/block-copy.c", |
| 372 | + "block/commit.c", |
| 373 | + "block/copy-on-read.c", |
| 374 | + "block/create.c", |
| 375 | + "block/crypto.c", |
| 376 | + "block/dirty-bitmap.c", |
| 377 | + "block/export/export.c", |
| 378 | + "block/file-posix.c", |
| 379 | + "block/filter-compress.c", |
| 380 | + "block/io_uring.c", |
| 381 | + "block/io.c", |
| 382 | + "block/mirror.c", |
| 383 | + "block/monitor/bitmap-qmp-cmds.c", |
| 384 | + "block/monitor/block-hmp-cmds.c", |
| 385 | + "block/nbd.c", |
| 386 | + "block/null.c", |
| 387 | + "block/nvme.c", |
| 388 | + "block/qapi-sysemu.c", |
| 389 | + "block/qapi.c", |
| 390 | + "block/qcow2-bitmap.c", |
| 391 | + "block/qcow2-cache.c", |
| 392 | + "block/qcow2-cluster.c", |
| 393 | + "block/qcow2-refcount.c", |
| 394 | + "block/qcow2-snapshot.c", |
| 395 | + "block/qcow2-threads.c", |
| 396 | + "block/qcow2.c", |
| 397 | + "block/quorum.c", |
| 398 | + "block/raw-format.c", |
| 399 | + "block/snapshot.c", |
| 400 | + "block/stream.c", |
| 401 | + "block/throttle-groups.c", |
| 402 | + "block/throttle.c", |
| 403 | + "block/vhdx-endian.c", |
| 404 | + "block/vhdx-log.c", |
| 405 | + "block/vhdx.c", |
| 406 | + "block/vmdk.c", |
| 407 | + "block/vpc.c", |
| 408 | + "block/write-threshold.c", |
| 409 | + "blockdev-nbd.c", |
| 410 | + "blockdev.c", |
| 411 | + "blockjob.c", |
| 412 | + "chardev/char-fd.c", |
| 413 | + "chardev/char-fe.c", |
| 414 | + "chardev/char-file.c", |
| 415 | + "chardev/char-io.c", |
| 416 | + "chardev/char-mux.c", |
| 417 | + "chardev/char-null.c", |
| 418 | + "chardev/char-parallel.c", |
| 419 | + "chardev/char-pipe.c", |
| 420 | + "chardev/char-pty.c", |
| 421 | + "chardev/char-ringbuf.c", |
| 422 | + "chardev/char-serial.c", |
| 423 | + "chardev/char-socket.c", |
| 424 | + "chardev/char-stdio.c", |
| 425 | + "chardev/char-udp.c", |
| 426 | + "chardev/char.c", |
| 427 | + "chardev/msmouse.c", |
| 428 | + "chardev/testdev.c", |
| 429 | + "chardev/wctablet.c", |
| 430 | + "cpus-common.c", |
| 431 | + "crypto/aes.c", |
| 432 | + "crypto/afsplit.c", |
| 433 | + "crypto/block-luks.c", |
| 434 | + "crypto/block-qcow.c", |
| 435 | + "crypto/block.c", |
| 436 | + "crypto/cipher.c", |
| 437 | + "crypto/desrfb.c", |
| 438 | + "crypto/hash-glib.c", |
| 439 | + "crypto/hash.c", |
| 440 | + "crypto/hmac-glib.c", |
| 441 | + "crypto/hmac.c", |
| 442 | + "crypto/init.c", |
| 443 | + "crypto/ivgen-essiv.c", |
| 444 | + "crypto/ivgen-plain.c", |
| 445 | + "crypto/ivgen-plain64.c", |
| 446 | + "crypto/ivgen.c", |
| 447 | + "crypto/pbkdf-stub.c", |
| 448 | + "crypto/pbkdf.c", |
| 449 | + "crypto/random-platform.c", |
| 450 | + "crypto/secret_common.c", |
| 451 | + "crypto/secret.c", |
| 452 | + "crypto/tlscreds.c", |
| 453 | + "crypto/tlscredsanon.c", |
| 454 | + "crypto/tlscredspsk.c", |
| 455 | + "crypto/tlscredsx509.c", |
| 456 | + "crypto/tlssession.c", |
| 457 | + "crypto/xts.c", |
| 458 | + "disas/capstone.c", |
| 459 | + "disas/i386.c", |
| 460 | + "dump/dump-hmp-cmds.c", |
| 461 | + "fsdev/qemu-fsdev-dummy.c", |
| 462 | + "fsdev/qemu-fsdev-opts.c", |
| 463 | + "fsdev/qemu-fsdev-throttle.c", |
| 464 | + "hw/acpi/acpi_interface.c", |
| 465 | + "hw/acpi/aml-build.c", |
| 466 | + "hw/acpi/bios-linker-loader.c", |
| 467 | + "hw/acpi/core.c", |
| 468 | + "hw/acpi/cpu_hotplug.c", |
| 469 | + "hw/acpi/cpu.c", |
| 470 | + "hw/acpi/generic_event_device.c", |
| 471 | + "hw/acpi/hmat.c", |
| 472 | + "hw/acpi/ich9.c", |
| 473 | + "hw/acpi/ipmi.c", |
| 474 | + "hw/acpi/memory_hotplug.c", |
| 475 | + "hw/acpi/nvdimm.c", |
| 476 | + "hw/acpi/pci.c", |
| 477 | + "hw/acpi/pcihp.c", |
| 478 | + "hw/acpi/piix4.c", |
| 479 | + "hw/acpi/tco.c", |
| 480 | + "hw/acpi/tpm.c", |
| 481 | + "hw/acpi/utils.c", |
| 482 | + "hw/acpi/vmgenid.c", |
| 483 | + "hw/audio/ac97.c", |
| 484 | + "hw/audio/adlib.c", |
| 485 | + "hw/audio/cs4231a.c", |
| 486 | + "hw/audio/es1370.c", |
| 487 | + "hw/audio/fmopl.c", |
| 488 | + "hw/audio/gus.c", |
| 489 | + "hw/audio/gusemu_hal.c", |
| 490 | + "hw/audio/gusemu_mixer.c", |
| 491 | + "hw/audio/hda-codec.c", |
| 492 | + "hw/audio/intel-hda.c", |
| 493 | + "hw/audio/pcspk.c", |
| 494 | + "hw/audio/sb16.c", |
| 495 | + "hw/audio/soundhw.c", |
| 496 | + "hw/block/block.c", |
| 497 | + "hw/block/cdrom.c", |
| 498 | + "hw/block/fdc.c", |
| 499 | + "hw/block/hd-geometry.c", |
| 500 | + "hw/block/nvme-ns.c", |
| 501 | + "hw/block/nvme.c", |
| 502 | + "hw/block/pflash_cfi01.c", |
| 503 | + "hw/char/debugcon.c", |
| 504 | + "hw/char/ipoctal232.c", |
| 505 | + "hw/char/parallel-isa.c", |
| 506 | + "hw/char/parallel.c", |
| 507 | + "hw/char/serial-isa.c", |
| 508 | + "hw/char/serial-pci-multi.c", |
| 509 | + "hw/char/serial-pci.c", |
| 510 | + "hw/char/serial.c", |
| 511 | + "hw/char/virtio-console.c", |
| 512 | + "hw/core/bus.c", |
| 513 | + "hw/core/clock-vmstate.c", |
| 514 | + "hw/core/clock.c", |
| 515 | + "hw/core/cpu.c", |
| 516 | + "hw/core/fw-path-provider.c", |
| 517 | + "hw/core/generic-loader.c", |
| 518 | + "hw/core/hotplug.c", |
| 519 | + "hw/core/irq.c", |
| 520 | + "hw/core/loader.c", |
| 521 | + "hw/core/machine-hmp-cmds.c", |
| 522 | + "hw/core/machine.c", |
| 523 | + "hw/core/nmi.c", |
| 524 | + "hw/core/null-machine.c", |
| 525 | + "hw/core/qdev-clock.c", |
| 526 | + "hw/core/qdev-fw.c", |
| 527 | + "hw/core/qdev-properties-system.c", |
| 528 | + "hw/core/qdev-properties.c", |
| 529 | + "hw/core/qdev.c", |
| 530 | + "hw/core/reset.c", |
| 531 | + "hw/core/resettable.c", |
| 532 | + "hw/core/sysbus.c", |
| 533 | + "hw/core/vm-change-state-handler.c", |
| 534 | + "hw/core/vmstate-if.c", |
| 535 | + "hw/cpu/cluster.c", |
| 536 | + "hw/cpu/core.c", |
| 537 | + "hw/display/ati_2d.c", |
| 538 | + "hw/display/ati_dbg.c", |
| 539 | + "hw/display/ati.c", |
| 540 | + "hw/display/bochs-display.c", |
| 541 | + "hw/display/cirrus_vga_isa.c", |
| 542 | + "hw/display/cirrus_vga.c", |
| 543 | + "hw/display/edid-generate.c", |
| 544 | + "hw/display/edid-region.c", |
| 545 | + "hw/display/i2c-ddc.c", |
| 546 | + "hw/display/ramfb-standalone.c", |
| 547 | + "hw/display/ramfb.c", |
| 548 | + "hw/display/vga-isa.c", |
| 549 | + "hw/display/vga-pci.c", |
| 550 | + "hw/display/virtio-gpu-base.c", |
| 551 | + "hw/display/virtio-gpu-pci.c", |
| 552 | + "hw/display/virtio-gpu.c", |
| 553 | + "hw/display/virtio-vga.c", |
| 554 | + "hw/display/vmware_vga.c", |
| 555 | + "hw/dma/i8257.c", |
| 556 | + "hw/i2c/bitbang_i2c.c", |
| 557 | + "hw/i2c/core.c", |
| 558 | + "hw/i2c/pm_smbus.c", |
| 559 | + "hw/i2c/smbus_eeprom.c", |
| 560 | + "hw/i2c/smbus_ich9.c", |
| 561 | + "hw/i2c/smbus_master.c", |
| 562 | + "hw/i2c/smbus_slave.c", |
| 563 | + "hw/ide/ahci.c", |
| 564 | + "hw/ide/atapi.c", |
| 565 | + "hw/ide/core.c", |
| 566 | + "hw/ide/ich.c", |
| 567 | + "hw/ide/ioport.c", |
| 568 | + "hw/ide/isa.c", |
| 569 | + "hw/ide/pci.c", |
| 570 | + "hw/ide/piix.c", |
| 571 | + "hw/ide/qdev.c", |
| 572 | + "hw/input/hid.c", |
| 573 | + "hw/input/pckbd.c", |
| 574 | + "hw/input/ps2.c", |
| 575 | + "hw/input/virtio-input-hid.c", |
| 576 | + "hw/input/virtio-input-host.c", |
| 577 | + "hw/input/virtio-input.c", |
| 578 | + "hw/intc/i8259_common.c", |
| 579 | + "hw/intc/i8259.c", |
| 580 | + "hw/intc/intc.c", |
| 581 | + "hw/intc/ioapic_common.c", |
| 582 | + "hw/ipack/ipack.c", |
| 583 | + "hw/ipack/tpci200.c", |
| 584 | + "hw/ipmi/ipmi_bmc_extern.c", |
| 585 | + "hw/ipmi/ipmi_bmc_sim.c", |
| 586 | + "hw/ipmi/ipmi_bt.c", |
| 587 | + "hw/ipmi/ipmi_kcs.c", |
| 588 | + "hw/ipmi/ipmi.c", |
| 589 | + "hw/ipmi/isa_ipmi_bt.c", |
| 590 | + "hw/ipmi/isa_ipmi_kcs.c", |
| 591 | + "hw/ipmi/pci_ipmi_bt.c", |
| 592 | + "hw/ipmi/pci_ipmi_kcs.c", |
| 593 | + "hw/ipmi/smbus_ipmi.c", |
| 594 | + "hw/isa/apm.c", |
| 595 | + "hw/isa/isa-bus.c", |
| 596 | + "hw/isa/piix3.c", |
| 597 | + "hw/mem/memory-device.c", |
| 598 | + "hw/mem/nvdimm.c", |
| 599 | + "hw/mem/pc-dimm.c", |
| 600 | + "hw/misc/applesmc.c", |
| 601 | + "hw/misc/debugexit.c", |
| 602 | + "hw/misc/edu.c", |
| 603 | + "hw/misc/ivshmem.c", |
| 604 | + "hw/misc/pc-testdev.c", |
| 605 | + "hw/misc/pci-testdev.c", |
| 606 | + "hw/misc/pvpanic.c", |
| 607 | + "hw/misc/sga.c", |
| 608 | + "hw/misc/vmcoreinfo.c", |
| 609 | + "hw/net/can/can_kvaser_pci.c", |
| 610 | + "hw/net/can/can_mioe3680_pci.c", |
| 611 | + "hw/net/can/can_pcm3680_pci.c", |
| 612 | + "hw/net/can/can_sja1000.c", |
| 613 | + "hw/net/can/ctucan_core.c", |
| 614 | + "hw/net/can/ctucan_pci.c", |
| 615 | + "hw/net/e1000.c", |
| 616 | + "hw/net/e1000e_core.c", |
| 617 | + "hw/net/e1000e.c", |
| 618 | + "hw/net/e1000x_common.c", |
| 619 | + "hw/net/eepro100.c", |
| 620 | + "hw/net/ne2000-isa.c", |
| 621 | + "hw/net/ne2000-pci.c", |
| 622 | + "hw/net/ne2000.c", |
| 623 | + "hw/net/net_rx_pkt.c", |
| 624 | + "hw/net/net_tx_pkt.c", |
| 625 | + "hw/net/pcnet-pci.c", |
| 626 | + "hw/net/pcnet.c", |
| 627 | + "hw/net/rocker/rocker_desc.c", |
| 628 | + "hw/net/rocker/rocker_fp.c", |
| 629 | + "hw/net/rocker/rocker_of_dpa.c", |
| 630 | + "hw/net/rocker/rocker_world.c", |
| 631 | + "hw/net/rocker/rocker.c", |
| 632 | + "hw/net/rtl8139.c", |
| 633 | + "hw/net/tulip.c", |
| 634 | + "hw/net/vhost_net.c", |
| 635 | + "hw/net/vmxnet3.c", |
| 636 | + "hw/nvram/eeprom93xx.c", |
| 637 | + "hw/nvram/fw_cfg-interface.c", |
| 638 | + "hw/nvram/fw_cfg.c", |
| 639 | + "hw/pci-bridge/gen_pcie_root_port.c", |
| 640 | + "hw/pci-bridge/i82801b11.c", |
| 641 | + "hw/pci-bridge/ioh3420.c", |
| 642 | + "hw/pci-bridge/pci_bridge_dev.c", |
| 643 | + "hw/pci-bridge/pci_expander_bridge.c", |
| 644 | + "hw/pci-bridge/pcie_pci_bridge.c", |
| 645 | + "hw/pci-bridge/pcie_root_port.c", |
| 646 | + "hw/pci-bridge/xio3130_downstream.c", |
| 647 | + "hw/pci-bridge/xio3130_upstream.c", |
| 648 | + "hw/pci-host/gpex-acpi.c", |
| 649 | + "hw/pci-host/gpex.c", |
| 650 | + "hw/pci-host/i440fx.c", |
| 651 | + "hw/pci-host/pam.c", |
| 652 | + "hw/pci-host/q35.c", |
| 653 | + "hw/pci/msi.c", |
| 654 | + "hw/pci/msix.c", |
| 655 | + "hw/pci/pci_bridge.c", |
| 656 | + "hw/pci/pci_host.c", |
| 657 | + "hw/pci/pci.c", |
| 658 | + "hw/pci/pcie_aer.c", |
| 659 | + "hw/pci/pcie_host.c", |
| 660 | + "hw/pci/pcie_port.c", |
| 661 | + "hw/pci/pcie.c", |
| 662 | + "hw/pci/shpc.c", |
| 663 | + "hw/pci/slotid_cap.c", |
| 664 | + "hw/pcmcia/pcmcia.c", |
| 665 | + "hw/scsi/emulation.c", |
| 666 | + "hw/scsi/esp-pci.c", |
| 667 | + "hw/scsi/esp.c", |
| 668 | + "hw/scsi/lsi53c895a.c", |
| 669 | + "hw/scsi/megasas.c", |
| 670 | + "hw/scsi/mptconfig.c", |
| 671 | + "hw/scsi/mptendian.c", |
| 672 | + "hw/scsi/mptsas.c", |
| 673 | + "hw/scsi/scsi-bus.c", |
| 674 | + "hw/scsi/scsi-disk.c", |
| 675 | + "hw/scsi/scsi-generic.c", |
| 676 | + "hw/scsi/vmw_pvscsi.c", |
| 677 | + "hw/sd/core.c", |
| 678 | + "hw/sd/sd.c", |
| 679 | + "hw/sd/sdhci-pci.c", |
| 680 | + "hw/sd/sdhci.c", |
| 681 | + "hw/sd/sdmmc-internal.c", |
| 682 | + "hw/smbios/smbios_type_38.c", |
| 683 | + "hw/smbios/smbios.c", |
| 684 | + "hw/timer/hpet.c", |
| 685 | + "hw/timer/i8254_common.c", |
| 686 | + "hw/timer/i8254.c", |
| 687 | + "hw/usb/bus.c", |
| 688 | + "hw/usb/combined-packet.c", |
| 689 | + "hw/usb/core.c", |
| 690 | + "hw/usb/desc-msos.c", |
| 691 | + "hw/usb/desc.c", |
| 692 | + "hw/usb/dev-audio.c", |
| 693 | + "hw/usb/dev-hid.c", |
| 694 | + "hw/usb/dev-hub.c", |
| 695 | + "hw/usb/dev-mtp.c", |
| 696 | + "hw/usb/dev-network.c", |
| 697 | + "hw/usb/dev-serial.c", |
| 698 | + "hw/usb/dev-smartcard-reader.c", |
| 699 | + "hw/usb/dev-storage.c", |
| 700 | + "hw/usb/dev-uas.c", |
| 701 | + "hw/usb/dev-wacom.c", |
| 702 | + "hw/usb/hcd-ehci-pci.c", |
| 703 | + "hw/usb/hcd-ehci.c", |
| 704 | + "hw/usb/hcd-ohci-pci.c", |
| 705 | + "hw/usb/hcd-ohci.c", |
| 706 | + "hw/usb/hcd-uhci.c", |
| 707 | + "hw/usb/hcd-xhci-nec.c", |
| 708 | + "hw/usb/hcd-xhci-pci.c", |
| 709 | + "hw/usb/hcd-xhci-sysbus.c", |
| 710 | + "hw/usb/hcd-xhci.c", |
| 711 | + "hw/usb/host-stub.c", |
| 712 | + "hw/usb/imx-usb-phy.c", |
| 713 | + "hw/usb/libhw.c", |
| 714 | + "hw/usb/u2f-passthru.c", |
| 715 | + "hw/usb/u2f.c", |
| 716 | + "hw/virtio/virtio-bus.c", |
| 717 | + "hw/virtio/virtio-mmio.c", |
| 718 | + "hw/virtio/virtio-pci.c", |
| 719 | + "hw/watchdog/watchdog.c", |
| 720 | + "hw/watchdog/wdt_i6300esb.c", |
| 721 | + "hw/watchdog/wdt_ib700.c", |
| 722 | + "io/channel-buffer.c", |
| 723 | + "io/channel-command.c", |
| 724 | + "io/channel-file.c", |
| 725 | + "io/channel-socket.c", |
| 726 | + "io/channel-tls.c", |
| 727 | + "io/channel-util.c", |
| 728 | + "io/channel-watch.c", |
| 729 | + "io/channel-websock.c", |
| 730 | + "io/channel.c", |
| 731 | + "io/dns-resolver.c", |
| 732 | + "io/net-listener.c", |
| 733 | + "io/task.c", |
| 734 | + "iothread.c", |
| 735 | + "job-qmp.c", |
| 736 | + "job.c", |
| 737 | + "migration/block-dirty-bitmap.c", |
| 738 | + "migration/channel.c", |
| 739 | + "migration/colo-failover.c", |
| 740 | + "migration/colo.c", |
| 741 | + "migration/exec.c", |
| 742 | + "migration/fd.c", |
| 743 | + "migration/global_state.c", |
| 744 | + "migration/migration.c", |
| 745 | + "migration/multifd-zlib.c", |
| 746 | + "migration/multifd.c", |
| 747 | + "migration/page_cache.c", |
| 748 | + "migration/postcopy-ram.c", |
| 749 | + "migration/qemu-file-channel.c", |
| 750 | + "migration/qemu-file.c", |
| 751 | + "migration/savevm.c", |
| 752 | + "migration/socket.c", |
| 753 | + "migration/tls.c", |
| 754 | + "migration/vmstate-types.c", |
| 755 | + "migration/vmstate.c", |
| 756 | + "migration/xbzrle.c", |
| 757 | + "migration/qjson.c", |
| 758 | + "monitor/hmp-cmds.c", |
| 759 | + "monitor/hmp.c", |
| 760 | + "monitor/monitor.c", |
| 761 | + "monitor/qmp-cmds-control.c", |
| 762 | + "monitor/qmp-cmds.c", |
| 763 | + "monitor/qmp.c", |
| 764 | + "nbd/client.c", |
| 765 | + "nbd/common.c", |
| 766 | + "nbd/server.c", |
| 767 | + "net/announce.c", |
| 768 | + "net/can/can_core.c", |
| 769 | + "net/can/can_host.c", |
| 770 | + "net/can/can_socketcan.c", |
| 771 | + "net/checksum.c", |
| 772 | + "net/colo-compare.c", |
| 773 | + "net/colo.c", |
| 774 | + "net/dump.c", |
| 775 | + "net/eth.c", |
| 776 | + "net/filter-buffer.c", |
| 777 | + "net/filter-mirror.c", |
| 778 | + "net/filter-rewriter.c", |
| 779 | + "net/filter.c", |
| 780 | + "net/hub.c", |
| 781 | + "net/l2tpv3.c", |
| 782 | + "net/net.c", |
| 783 | + "net/queue.c", |
| 784 | + "net/slirp.c", |
| 785 | + "net/socket.c", |
| 786 | + "net/tap-linux.c", |
| 787 | + "net/tap.c", |
| 788 | + "net/util.c", |
| 789 | + "net/vhost-user-stub.c", |
| 790 | + "net/vhost-vdpa.c", |
| 791 | + "os-posix.c", |
| 792 | + "qemu-io-cmds.c", |
| 793 | + "qobject/block-qdict.c", |
| 794 | + "qobject/json-lexer.c", |
| 795 | + "qobject/json-parser.c", |
| 796 | + "qobject/json-streamer.c", |
| 797 | + "qobject/qbool.c", |
| 798 | + "qobject/qdict.c", |
| 799 | + "qobject/qjson.c", |
| 800 | + "qobject/qlist.c", |
| 801 | + "qobject/qlit.c", |
| 802 | + "qobject/qnull.c", |
| 803 | + "qobject/qnum.c", |
| 804 | + "qobject/qobject.c", |
| 805 | + "qobject/qstring.c", |
| 806 | + "qom/container.c", |
| 807 | + "qom/object_interfaces.c", |
| 808 | + "qom/object.c", |
| 809 | + "qom/qom-hmp-cmds.c", |
| 810 | + "qom/qom-qmp-cmds.c", |
| 811 | + "qom/qom-qobject.c", |
| 812 | + "replay/stubs-system.c", |
| 813 | + "scsi/pr-manager-helper.c", |
| 814 | + "scsi/pr-manager.c", |
| 815 | + "scsi/utils.c", |
| 816 | + "softmmu/bootdevice.c", |
| 817 | + "softmmu/device_tree.c", |
| 818 | + "softmmu/dma-helpers.c", |
| 819 | + "softmmu/qdev-monitor.c", |
| 820 | + "softmmu/qemu-seccomp.c", |
| 821 | + "softmmu/tpm.c", |
| 822 | + "stubs/gdbstub.c", |
| 823 | + "stubs/icount.c", |
| 824 | + "stubs/replay-tools.c", |
| 825 | + "stubs/replay.c", |
| 826 | + "stubs/semihost.c", |
| 827 | + "stubs/target-get-monitor-def.c", |
| 828 | + "stubs/win32-kbd-hook.c", |
| 829 | + "stubs/xen-hw-stub.c", |
| 830 | + "contrib/libvhost-user/libvhost-user-glib.c", |
| 831 | + "contrib/libvhost-user/libvhost-user.c", |
| 832 | + "ui/console.c", |
| 833 | + "ui/cursor.c", |
| 834 | + "ui/input-barrier.c", |
| 835 | + "ui/input-keymap.c", |
| 836 | + "ui/input-legacy.c", |
| 837 | + "ui/input-linux.c", |
| 838 | + "ui/input.c", |
| 839 | + "ui/kbd-state.c", |
| 840 | + "ui/keymaps.c", |
| 841 | + "ui/qemu-pixman.c", |
| 842 | + "ui/spice-module.c", |
| 843 | + "ui/vnc-stubs.c", |
| 844 | + "util/aio-posix.c", |
| 845 | + "util/aio-wait.c", |
| 846 | + "util/aiocb.c", |
| 847 | + "util/async.c", |
| 848 | + "util/base64.c", |
| 849 | + "util/bitmap.c", |
| 850 | + "util/bitops.c", |
| 851 | + "util/block-helpers.c", |
| 852 | + "util/buffer.c", |
| 853 | + "util/bufferiszero.c", |
| 854 | + "util/cacheinfo.c", |
| 855 | + "util/compatfd.c", |
Lorenz Brun | 647cbb2 | 2021-03-16 15:09:56 +0100 | [diff] [blame] | 856 | + "util/coroutine-sigaltstack.c", |
Lorenz Brun | 0de1893 | 2021-03-11 00:36:48 +0100 | [diff] [blame] | 857 | + "util/crc32c.c", |
| 858 | + "util/cutils.c", |
| 859 | + "util/drm.c", |
| 860 | + "util/envlist.c", |
| 861 | + "util/error.c", |
| 862 | + "util/event_notifier-posix.c", |
| 863 | + "util/fdmon-epoll.c", |
| 864 | + "util/fdmon-io_uring.c", |
| 865 | + "util/fdmon-poll.c", |
| 866 | + "util/fifo8.c", |
| 867 | + "util/filemonitor-inotify.c", |
| 868 | + "util/getauxval.c", |
| 869 | + "util/guest-random.c", |
| 870 | + "util/hbitmap.c", |
| 871 | + "util/hexdump.c", |
| 872 | + "util/host-utils.c", |
| 873 | + "util/id.c", |
| 874 | + "util/iov.c", |
| 875 | + "util/iova-tree.c", |
| 876 | + "util/keyval.c", |
| 877 | + "util/lockcnt.c", |
| 878 | + "util/log.c", |
| 879 | + "util/main-loop.c", |
| 880 | + "util/memfd.c", |
| 881 | + "util/mmap-alloc.c", |
| 882 | + "util/module.c", |
| 883 | + "util/notify.c", |
| 884 | + "util/nvdimm-utils.c", |
| 885 | + "util/osdep.c", |
| 886 | + "util/oslib-posix.c", |
| 887 | + "util/pagesize.c", |
| 888 | + "util/path.c", |
| 889 | + "util/qdist.c", |
| 890 | + "util/qemu-co-shared-resource.c", |
| 891 | + "util/qemu-config.c", |
| 892 | + "util/qemu-coroutine-io.c", |
| 893 | + "util/qemu-coroutine-lock.c", |
| 894 | + "util/qemu-coroutine-sleep.c", |
| 895 | + "util/qemu-error.c", |
| 896 | + "util/qemu-openpty.c", |
| 897 | + "util/qemu-option.c", |
| 898 | + "util/qemu-print.c", |
| 899 | + "util/qemu-progress.c", |
| 900 | + "util/qemu-sockets.c", |
| 901 | + "util/qemu-thread-posix.c", |
| 902 | + "util/qemu-timer-common.c", |
| 903 | + "util/qemu-timer.c", |
| 904 | + "util/qht.c", |
| 905 | + "util/qsp.c", |
| 906 | + "util/range.c", |
| 907 | + "util/rcu.c", |
| 908 | + "util/readline.c", |
| 909 | + "util/stats64.c", |
| 910 | + "util/sys_membarrier.c", |
| 911 | + "util/systemd.c", |
| 912 | + "util/thread-pool.c", |
| 913 | + "util/throttle.c", |
| 914 | + "util/timed-average.c", |
| 915 | + "util/unicode.c", |
| 916 | + "util/uri.c", |
| 917 | + "util/uuid.c", |
| 918 | + "util/vfio-helpers.c", |
| 919 | + "util/vhost-user-server.c", |
| 920 | + "util/qemu-coroutine.c", |
| 921 | + ] + [ |
| 922 | + "//qapi:opts-visitor.c", |
| 923 | + "//qapi:qapi-clone-visitor.c", |
| 924 | + "//qapi:qapi-dealloc-visitor.c", |
| 925 | + "//qapi:qapi-util.c", |
| 926 | + "//qapi:qapi-visit-core.c", |
| 927 | + "//qapi:qmp-dispatch.c", |
| 928 | + "//qapi:qmp-event.c", |
| 929 | + "//qapi:qmp-registry.c", |
| 930 | + "//qapi:qobject-input-visitor.c", |
| 931 | + "//qapi:qobject-output-visitor.c", |
| 932 | + "//qapi:string-input-visitor.c", |
| 933 | + "//qapi:string-output-visitor.c", |
| 934 | + "//trace:control.c", |
| 935 | + "//trace:qmp.c", |
| 936 | + ] + [ |
| 937 | + ":gen_hdrs", |
| 938 | + ":block-coroutine-gen", |
| 939 | + ], |
| 940 | + # QEMU relies on hacky two's complement representation interpretation of bitshifts |
| 941 | + copts = ["-fwrapv"], |
| 942 | + local_defines = [ |
| 943 | + "_GNU_SOURCE", |
| 944 | + "_FILE_OFFSET_BITS=64", |
| 945 | + "_LARGEFILE_SOURCE", |
| 946 | + ], |
| 947 | + deps = [ |
| 948 | + ":capstone", |
| 949 | + ":fdt", |
| 950 | + ":slirp", |
| 951 | + "@glib//glib", |
| 952 | + "@pixman//:pixman", |
| 953 | + "@seccomp", |
| 954 | + "@uring//:uring", |
| 955 | + "@zlib//:zlib", |
| 956 | + ], |
| 957 | + includes = ["include", "capstone/include/capstone"], |
| 958 | + alwayslink = True, # QEMU uses __attribute__((constructor)) functions |
| 959 | +) |
| 960 | + |
| 961 | +cc_binary( |
| 962 | + name = "qemu-x86_64-softmmu", |
| 963 | + srcs = [":all_headers"] + [ |
| 964 | + "//trace:control-target.c", |
| 965 | + "accel/dummy-cpus.c", |
| 966 | + "accel/kvm/kvm-all.c", |
| 967 | + "accel/kvm/kvm-cpus.c", |
| 968 | + "accel/qtest/qtest.c", |
| 969 | + "accel/stubs/hax-stub.c", |
| 970 | + "accel/stubs/tcg-stub.c", |
| 971 | + "accel/stubs/xen-stub.c", |
| 972 | + "cpu.c", |
| 973 | + "disas.c", |
| 974 | + "dump/dump.c", |
| 975 | + "dump/win_dump.c", |
| 976 | + "exec-vary.c", |
| 977 | + "gdbstub.c", |
| 978 | + "hw/block/dataplane/virtio-blk.c", |
| 979 | + "hw/block/virtio-blk.c", |
| 980 | + "hw/char/virtio-serial-bus.c", |
| 981 | + "hw/core/machine-qmp-cmds.c", |
| 982 | + "hw/core/numa.c", |
| 983 | + "hw/display/vga.c", |
| 984 | + "hw/hyperv/hyperv_testdev.c", |
| 985 | + "hw/hyperv/hyperv.c", |
| 986 | + "hw/hyperv/vmbus.c", |
| 987 | + "hw/i386/acpi-build.c", |
| 988 | + "hw/i386/acpi-common.c", |
| 989 | + "hw/i386/acpi-microvm.c", |
| 990 | + "hw/i386/amd_iommu.c", |
| 991 | + "hw/i386/e820_memory_layout.c", |
| 992 | + "hw/i386/fw_cfg.c", |
| 993 | + "hw/i386/generic_event_device_x86.c", |
| 994 | + "hw/i386/intel_iommu.c", |
| 995 | + "hw/i386/kvm/apic.c", |
| 996 | + "hw/i386/kvm/clock.c", |
| 997 | + "hw/i386/kvm/i8254.c", |
| 998 | + "hw/i386/kvm/i8259.c", |
| 999 | + "hw/i386/kvm/ioapic.c", |
| 1000 | + "hw/i386/kvmvapic.c", |
| 1001 | + "hw/i386/microvm.c", |
| 1002 | + "hw/i386/multiboot.c", |
| 1003 | + "hw/i386/pc_piix.c", |
| 1004 | + "hw/i386/pc_q35.c", |
| 1005 | + "hw/i386/pc_sysfw.c", |
| 1006 | + "hw/i386/pc.c", |
| 1007 | + "hw/i386/port92.c", |
| 1008 | + "hw/i386/vmmouse.c", |
| 1009 | + "hw/i386/vmport.c", |
| 1010 | + "hw/i386/x86-iommu.c", |
| 1011 | + "hw/i386/x86.c", |
| 1012 | + "hw/intc/apic_common.c", |
| 1013 | + "hw/intc/apic.c", |
| 1014 | + "hw/intc/ioapic.c", |
| 1015 | + "hw/isa/lpc_ich9.c", |
| 1016 | + "hw/net/virtio-net.c", |
| 1017 | + "hw/rtc/mc146818rtc.c", |
| 1018 | + "hw/scsi/virtio-scsi-dataplane.c", |
| 1019 | + "hw/scsi/virtio-scsi.c", |
| 1020 | + "hw/vfio/common.c", |
| 1021 | + "hw/vfio/display.c", |
| 1022 | + "hw/vfio/igd.c", |
| 1023 | + "hw/vfio/migration.c", |
| 1024 | + "hw/vfio/pci-quirks.c", |
| 1025 | + "hw/vfio/pci.c", |
| 1026 | + "hw/vfio/spapr.c", |
| 1027 | + "hw/virtio/vhost-backend.c", |
| 1028 | + "hw/virtio/vhost-vdpa.c", |
| 1029 | + "hw/virtio/vhost.c", |
| 1030 | + "hw/virtio/virtio-balloon-pci.c", |
| 1031 | + "hw/virtio/virtio-balloon.c", |
| 1032 | + "hw/virtio/virtio-blk-pci.c", |
| 1033 | + "hw/virtio/virtio-crypto-pci.c", |
| 1034 | + "hw/virtio/virtio-crypto.c", |
| 1035 | + "hw/virtio/virtio-input-host-pci.c", |
| 1036 | + "hw/virtio/virtio-input-pci.c", |
| 1037 | + "hw/virtio/virtio-iommu-pci.c", |
| 1038 | + "hw/virtio/virtio-iommu.c", |
| 1039 | + "hw/virtio/virtio-mem-pci.c", |
| 1040 | + "hw/virtio/virtio-mem.c", |
| 1041 | + "hw/virtio/virtio-net-pci.c", |
| 1042 | + "hw/virtio/virtio-pmem-pci.c", |
| 1043 | + "hw/virtio/virtio-pmem.c", |
| 1044 | + "hw/virtio/virtio-rng-pci.c", |
| 1045 | + "hw/virtio/virtio-rng.c", |
| 1046 | + "hw/virtio/virtio-scsi-pci.c", |
| 1047 | + "hw/virtio/virtio-serial-pci.c", |
| 1048 | + "hw/virtio/virtio.c", |
| 1049 | + "migration/dirtyrate.c", |
| 1050 | + "migration/ram.c", |
| 1051 | + "monitor/misc.c", |
| 1052 | + "softmmu/arch_init.c", |
| 1053 | + "softmmu/balloon.c", |
| 1054 | + "softmmu/cpu-throttle.c", |
| 1055 | + "softmmu/cpu-timers.c", |
| 1056 | + "softmmu/cpus.c", |
| 1057 | + "softmmu/ioport.c", |
| 1058 | + "softmmu/main.c", |
| 1059 | + "softmmu/memory_mapping.c", |
| 1060 | + "softmmu/memory.c", |
| 1061 | + "softmmu/physmem.c", |
| 1062 | + "softmmu/qtest.c", |
| 1063 | + "softmmu/vl.c", |
| 1064 | + "target/i386/arch_dump.c", |
| 1065 | + "target/i386/arch_memory_mapping.c", |
| 1066 | + "target/i386/cpu.c", |
| 1067 | + "target/i386/gdbstub.c", |
| 1068 | + "target/i386/helper.c", |
| 1069 | + "target/i386/kvm.c", |
| 1070 | + "target/i386/hyperv.c", |
| 1071 | + "target/i386/machine.c", |
| 1072 | + "target/i386/monitor.c", |
| 1073 | + "target/i386/tcg-stub.c", |
| 1074 | + "target/i386/sev.c", |
| 1075 | + "target/i386/xsave_helper.c", |
| 1076 | + ] + [ |
| 1077 | + ":gen_hdrs", |
| 1078 | + ":trace_c", |
| 1079 | + ":qapi_c", |
| 1080 | + ], |
| 1081 | + copts = ["-fwrapv"], # QEMU relies on hacky two's complement representations of bitshifts |
| 1082 | + linkopts = [ |
| 1083 | + "-pthread", |
| 1084 | + "-lutil", # Not actually a library but weird GLIBC shenanigans |
| 1085 | + ], |
| 1086 | + data = glob(["pc-bios/**"]), |
| 1087 | + local_defines = [ |
| 1088 | + "_GNU_SOURCE", |
| 1089 | + "_FILE_OFFSET_BITS=64", |
| 1090 | + "_LARGEFILE_SOURCE", |
| 1091 | + "NEED_CPU_H", |
| 1092 | + "CONFIG_TARGET=\\\"x86_64-softmmu-config-target.h\\\"", |
| 1093 | + "CONFIG_DEVICES=\\\"x86_64-softmmu-config-devices.h\\\"", |
| 1094 | + ], |
| 1095 | + deps = [ |
| 1096 | + ":fdt", |
| 1097 | + ":qemu", |
| 1098 | + ":slirp", |
| 1099 | + "@glib//glib", |
| 1100 | + "@pixman//:pixman", |
| 1101 | + "@zlib//:zlib", |
| 1102 | + ], |
| 1103 | + visibility = ["//visibility:public"], |
| 1104 | + includes = ["target/i386", "tcg/i386", "accel/tcg", "linux-headers"], |
| 1105 | +) |
| 1106 | + |
| 1107 | +genrule( |
| 1108 | + name = "cursor-hdrs", |
| 1109 | + srcs = [ |
| 1110 | + "ui/cursor_hidden.xpm", |
| 1111 | + "ui/cursor_left_ptr.xpm", |
| 1112 | + ], |
| 1113 | + outs = [ |
| 1114 | + "ui/cursor_hidden.h", |
| 1115 | + "ui/cursor_left_ptr.h", |
| 1116 | + ], |
| 1117 | + cmd = """ |
| 1118 | + cp $(location ui/cursor_hidden.xpm) $(location ui/cursor_hidden.h) |
| 1119 | + cp $(location ui/cursor_left_ptr.xpm) $(location ui/cursor_left_ptr.h) |
| 1120 | + """, |
| 1121 | +) |
| 1122 | + |
| 1123 | +genrule( |
| 1124 | + name = "module-block", |
| 1125 | + outs = ["block/module_block.h"], |
| 1126 | + cmd = "./$(location //scripts/modules:module_block) $(location block/module_block.h)", |
| 1127 | + tools = ["//scripts/modules:module_block"], |
| 1128 | +) |
| 1129 | + |
| 1130 | +genrule( |
| 1131 | + name = "hmp-commands", |
| 1132 | + srcs = [ |
| 1133 | + "hmp-commands.hx", |
| 1134 | + "hmp-commands-info.hx", |
| 1135 | + "qemu-options.hx", |
| 1136 | + "qemu-img-cmds.hx", |
| 1137 | + ], |
| 1138 | + outs = [ |
| 1139 | + "hmp-commands.h", |
| 1140 | + "hmp-commands-info.h", |
| 1141 | + "qemu-options-gen.h", |
| 1142 | + "qemu-img-cmds.h", |
| 1143 | + ], |
| 1144 | + cmd = """ |
| 1145 | + ./$(location //scripts:hxtool-sh) -h $(location hmp-commands.hx) > $(location hmp-commands.h) |
| 1146 | + ./$(location //scripts:hxtool-sh) -h $(location hmp-commands-info.hx) > $(location hmp-commands-info.h) |
| 1147 | + ./$(location //scripts:hxtool-sh) -h $(location qemu-options.hx) > $(location qemu-options-gen.h) |
| 1148 | + ./$(location //scripts:hxtool-sh) -h $(location qemu-img-cmds.hx) > $(location qemu-img-cmds.h) |
| 1149 | + """, |
| 1150 | + tools = ["//scripts:hxtool-sh"], |
| 1151 | +) |
| 1152 | + |
| 1153 | +cc_qemu_keymaps( |
| 1154 | + name = "keymaps-gen", |
| 1155 | + src = "ui/keycodemapdb/data/keymaps.csv", |
| 1156 | + maps = { |
| 1157 | + "atset1": ["qcode"], |
| 1158 | + "linux": ["qcode"], |
| 1159 | + "qcode": [ |
| 1160 | + "atset1", |
| 1161 | + "atset2", |
| 1162 | + "atset3", |
| 1163 | + "linux", |
| 1164 | + "qnum", |
| 1165 | + "sun", |
| 1166 | + ], |
| 1167 | + "qnum": ["qcode"], |
| 1168 | + "usb": ["qcode"], |
| 1169 | + "win32": ["qcode"], |
| 1170 | + "x11": ["qcode"], |
| 1171 | + "xorgevdev": ["qcode"], |
| 1172 | + "xorgkbd": ["qcode"], |
| 1173 | + "xorgxquartz": ["qcode"], |
| 1174 | + "xorgxwin": ["qcode"], |
| 1175 | + "osx": ["qcode"], |
| 1176 | + }, |
| 1177 | +) |
| 1178 | + |
| 1179 | + |
| 1180 | +genrule( |
| 1181 | + name = "renamed-keymap-gen", |
| 1182 | + srcs = ["ui/keycodemapdb/tools/keymap-gen"], |
| 1183 | + outs = ["keymap-gen.py"], |
| 1184 | + cmd = "cp $(location ui/keycodemapdb/tools/keymap-gen) $@", |
| 1185 | +) |
| 1186 | + |
| 1187 | +py_binary( |
| 1188 | + name = "keymap-gen", |
| 1189 | + srcs = [":renamed-keymap-gen"], |
| 1190 | + visibility = ["//visibility:public"], |
| 1191 | +) |
| 1192 | + |
| 1193 | +genrule( |
| 1194 | + name = "gdbstub-xml", |
| 1195 | + srcs = ["gdb-xml/i386-64bit.xml"], |
| 1196 | + outs = ["x86_64-softmmu-gdbstub-xml.c"], |
| 1197 | + cmd = "./$(location //scripts:feature_to_c) $(location gdb-xml/i386-64bit.xml) > $@", |
| 1198 | + tools = ["//scripts:feature_to_c"], |
| 1199 | +) |
| 1200 | + |
| 1201 | +# TODO: x86_64-softmmu-config-target.h, x86_64-softmmu-config-devices.h, include/qemu/config-host.h (probably copy) |
| 1202 | +# TODO: ui/input-keymap-*.c.inc (generate at top level with //ui/keycodemapdb/tools:keymap-gen) |
| 1203 | diff --git a/defs.bzl b/defs.bzl |
| 1204 | new file mode 100644 |
| 1205 | index 0000000000..3a8d50d429 |
| 1206 | --- /dev/null |
| 1207 | +++ b/defs.bzl |
| 1208 | @@ -0,0 +1,52 @@ |
| 1209 | +def _impl_filter_label_suffix(ctx): |
| 1210 | + return [DefaultInfo( |
| 1211 | + files = depset([f for f in ctx.files.srcs if f.path.endswith(ctx.attr.suffix) and f.basename not in ctx.attr.exclude]), |
| 1212 | + )] |
| 1213 | + |
| 1214 | +filter_label_suffix = rule( |
| 1215 | + implementation = _impl_filter_label_suffix, |
| 1216 | + attrs = { |
| 1217 | + "srcs": attr.label_list( |
| 1218 | + mandatory = True, |
| 1219 | + allow_files = True, |
| 1220 | + ), |
| 1221 | + "suffix": attr.string( |
| 1222 | + mandatory = True, |
| 1223 | + ), |
| 1224 | + "exclude": attr.string_list( |
| 1225 | + default = [], |
| 1226 | + ), |
| 1227 | + }, |
| 1228 | +) |
| 1229 | + |
| 1230 | +def _impl_cc_qemu_keymaps(ctx): |
| 1231 | + outs = [] |
| 1232 | + for _from in ctx.attr.maps: |
| 1233 | + for _to in ctx.attr.maps[_from]: |
| 1234 | + out = ctx.actions.declare_file("ui/input-keymap-{}-to-{}.c.inc".format(_from, _to)) |
| 1235 | + ctx.actions.run( |
| 1236 | + inputs = ctx.files.src + ctx.files._keymap_gen, |
| 1237 | + executable = ctx.executable._savestdout, |
| 1238 | + arguments = [out.path, ctx.files._keymap_gen[0].path, "--lang=glib2", "--varname=qemu_input_map_{}_to_{}".format(_from, _to), "code-map", ctx.files.src[0].path, _from, _to], |
| 1239 | + outputs = [out], |
| 1240 | + ) |
| 1241 | + outs.append(out) |
| 1242 | + return [DefaultInfo(files = depset(outs))] |
| 1243 | + |
| 1244 | +cc_qemu_keymaps = rule( |
| 1245 | + implementation = _impl_cc_qemu_keymaps, |
| 1246 | + attrs = { |
| 1247 | + "src": attr.label(allow_single_file = True), |
| 1248 | + "maps": attr.string_list_dict(), |
| 1249 | + "_keymap_gen": attr.label( |
| 1250 | + default = Label("//:keymap-gen"), |
| 1251 | + executable = True, |
| 1252 | + cfg = "exec", |
| 1253 | + ), |
| 1254 | + "_savestdout": attr.label( |
| 1255 | + default = Label("@dev_source_monogon//build/savestdout"), |
| 1256 | + executable = True, |
| 1257 | + cfg = "exec", |
| 1258 | + ), |
| 1259 | + }, |
| 1260 | +) |
| 1261 | diff --git a/qapi/BUILD b/qapi/BUILD |
| 1262 | new file mode 100644 |
| 1263 | index 0000000000..71ff5a7445 |
| 1264 | --- /dev/null |
| 1265 | +++ b/qapi/BUILD |
| 1266 | @@ -0,0 +1,25 @@ |
| 1267 | +load("//scripts/qapi:defs.bzl", "cc_qapi") |
| 1268 | + |
| 1269 | +cc_qapi( |
| 1270 | + name = "qapi_generated", |
| 1271 | + srcs = glob(["*.json"]), |
| 1272 | + main = "qapi-schema.json", |
| 1273 | + visibility = ["//visibility:public"], |
| 1274 | +) |
| 1275 | + |
| 1276 | +exports_files(glob([ |
| 1277 | + "*.c", |
| 1278 | + "*.h", |
| 1279 | +]) + ["trace-events"]) |
| 1280 | + |
| 1281 | +filegroup( |
| 1282 | + name = "extra_hdrs", |
| 1283 | + srcs = glob(["**/*.h"]), |
| 1284 | + visibility = ["//visibility:public"], |
| 1285 | +) |
| 1286 | + |
| 1287 | +filegroup( |
| 1288 | + name = "schema", |
| 1289 | + srcs = glob(["*.json"]), |
| 1290 | + visibility = ["//visibility:public"], |
| 1291 | +) |
| 1292 | diff --git a/qapi/defs.bzl b/qapi/defs.bzl |
| 1293 | new file mode 100644 |
| 1294 | index 0000000000..2d1f38fdfa |
| 1295 | --- /dev/null |
| 1296 | +++ b/qapi/defs.bzl |
| 1297 | @@ -0,0 +1,40 @@ |
| 1298 | +load("@rules_cc//cc:defs.bzl", "cc_library") |
| 1299 | + |
| 1300 | +# The actual rule which does the filtering. |
| 1301 | +def _do_filter_impl(ctx): |
| 1302 | + return [DefaultInfo( |
| 1303 | + files = depset([f for f in ctx.files.srcs if f.path.endswith(ctx.attr.suffix)]), |
| 1304 | + )] |
| 1305 | + |
| 1306 | +_do_filter = rule( |
| 1307 | + implementation = _do_filter_impl, |
| 1308 | + attrs = { |
| 1309 | + "srcs": attr.label_list( |
| 1310 | + mandatory = True, |
| 1311 | + allow_files = True, |
| 1312 | + ), |
| 1313 | + "suffix": attr.string( |
| 1314 | + mandatory = True, |
| 1315 | + ), |
| 1316 | + }, |
| 1317 | +) |
| 1318 | + |
| 1319 | +def filtered_cc_library(name, srcs, hdrs, **kwargs): |
| 1320 | + _do_filter( |
| 1321 | + name = "%s_hdrs" % name, |
| 1322 | + visibility = ["//visibility:private"], |
| 1323 | + srcs = hdrs, |
| 1324 | + suffix = ".h", |
| 1325 | + ) |
| 1326 | + _do_filter( |
| 1327 | + name = "%s_srcs" % name, |
| 1328 | + visibility = ["//visibility:private"], |
| 1329 | + srcs = srcs, |
| 1330 | + suffix = ".c", |
| 1331 | + ) |
| 1332 | + cc_library( |
| 1333 | + name = name, |
| 1334 | + srcs = [":%s_srcs" % name], |
| 1335 | + hdrs = [":%s_hdrs" % name], |
| 1336 | + **kwargs |
| 1337 | + ) |
| 1338 | diff --git a/scripts/BUILD b/scripts/BUILD |
| 1339 | new file mode 100644 |
| 1340 | index 0000000000..0b4fc8a248 |
| 1341 | --- /dev/null |
| 1342 | +++ b/scripts/BUILD |
| 1343 | @@ -0,0 +1,35 @@ |
| 1344 | +load("@rules_python//python:defs.bzl", "py_binary") |
| 1345 | + |
| 1346 | +py_binary( |
| 1347 | + name = "qapi-gen", |
| 1348 | + srcs = ["qapi-gen.py"], |
| 1349 | + visibility = ["//visibility:public"], |
| 1350 | + deps = ["//scripts/qapi"], |
| 1351 | +) |
| 1352 | + |
| 1353 | +py_binary( |
| 1354 | + # We cannot use tracetool as name as a directory with the same name exists |
| 1355 | + name = "tracetool-cli", |
| 1356 | + srcs = ["tracetool.py"], |
| 1357 | + main = "tracetool.py", |
| 1358 | + visibility = ["//visibility:public"], |
| 1359 | + deps = ["//scripts/tracetool"], |
| 1360 | +) |
| 1361 | + |
| 1362 | +py_binary( |
| 1363 | + name = "block-coroutine-wrapper", |
| 1364 | + srcs = ["block-coroutine-wrapper.py"], |
| 1365 | + visibility = ["//visibility:public"], |
| 1366 | +) |
| 1367 | + |
| 1368 | +sh_binary( |
| 1369 | + name = "hxtool-sh", |
| 1370 | + srcs = ["hxtool"], |
| 1371 | + visibility = ["//visibility:public"], |
| 1372 | +) |
| 1373 | + |
| 1374 | +sh_binary( |
| 1375 | + name = "feature_to_c", |
| 1376 | + srcs = ["feature_to_c.sh"], |
| 1377 | + visibility = ["//:__subpackages__"], |
| 1378 | +) |
| 1379 | diff --git a/scripts/modules/BUILD b/scripts/modules/BUILD |
| 1380 | new file mode 100644 |
| 1381 | index 0000000000..99a5ab2243 |
| 1382 | --- /dev/null |
| 1383 | +++ b/scripts/modules/BUILD |
| 1384 | @@ -0,0 +1,7 @@ |
| 1385 | +load("@rules_python//python:defs.bzl", "py_binary") |
| 1386 | + |
| 1387 | +py_binary( |
| 1388 | + name = "module_block", |
| 1389 | + srcs = ["module_block.py"], |
| 1390 | + visibility = ["//:__subpackages__"] |
| 1391 | +) |
| 1392 | diff --git a/scripts/qapi/BUILD b/scripts/qapi/BUILD |
| 1393 | new file mode 100644 |
| 1394 | index 0000000000..a7e8da9368 |
| 1395 | --- /dev/null |
| 1396 | +++ b/scripts/qapi/BUILD |
| 1397 | @@ -0,0 +1,7 @@ |
| 1398 | +load("@rules_python//python:defs.bzl", "py_library") |
| 1399 | + |
| 1400 | +py_library( |
| 1401 | + name = "qapi", |
| 1402 | + srcs = glob(["*.py"]), |
| 1403 | + visibility = ["//visibility:public"], |
| 1404 | +) |
| 1405 | diff --git a/scripts/qapi/defs.bzl b/scripts/qapi/defs.bzl |
| 1406 | new file mode 100644 |
| 1407 | index 0000000000..807f4b37d5 |
| 1408 | --- /dev/null |
| 1409 | +++ b/scripts/qapi/defs.bzl |
| 1410 | @@ -0,0 +1,52 @@ |
| 1411 | +def _impl_qapi_cc(ctx): |
| 1412 | + out = [] |
| 1413 | + out_types = ["types", "visit", "events", "commands"] |
| 1414 | + system_modules = ["builtin-types", "builtin-visit", "introspect", "init-commands", "emit-events", "types-error", "visit-error"] |
| 1415 | + for t in out_types: |
| 1416 | + out.append(ctx.actions.declare_file("qapi-{}.c".format(t))) |
| 1417 | + out.append(ctx.actions.declare_file("qapi-{}.h".format(t))) |
| 1418 | + for t in system_modules: |
| 1419 | + out.append(ctx.actions.declare_file("qapi-{}.c".format(t))) |
| 1420 | + out.append(ctx.actions.declare_file("qapi-{}.h".format(t))) |
| 1421 | + |
| 1422 | + input_dir = "" |
| 1423 | + main_file = ctx.files.main[0] |
| 1424 | + for src in ctx.files.srcs: |
| 1425 | + if src.path == main_file.path: |
| 1426 | + continue |
| 1427 | + extension = src.extension |
| 1428 | + basename = src.basename[:-len(extension) - 1] |
| 1429 | + if input_dir == "": |
| 1430 | + input_dir = src.dirname |
| 1431 | + elif input_dir != src.dirname: |
| 1432 | + fail("all cc_qapi sources need to be in the same folder") |
| 1433 | + |
| 1434 | + for t in out_types: |
| 1435 | + out.append(ctx.actions.declare_file("qapi-{}-{}.c".format(t, basename))) |
| 1436 | + out.append(ctx.actions.declare_file("qapi-{}-{}.h".format(t, basename))) |
| 1437 | + |
| 1438 | + ctx.actions.run( |
| 1439 | + inputs = ctx.files.srcs + ctx.files.main, |
| 1440 | + executable = ctx.executable._qapi_gen, |
| 1441 | + arguments = ["-o", out[0].dirname, "-b", main_file.path], |
| 1442 | + outputs = out, |
| 1443 | + ) |
| 1444 | + return [DefaultInfo(files = depset(out))] |
| 1445 | + |
| 1446 | +cc_qapi = rule( |
| 1447 | + implementation = _impl_qapi_cc, |
| 1448 | + attrs = { |
| 1449 | + "srcs": attr.label_list( |
| 1450 | + mandatory = True, |
| 1451 | + allow_files = True, |
| 1452 | + ), |
| 1453 | + "main": attr.label( |
| 1454 | + allow_single_file = True, |
| 1455 | + ), |
| 1456 | + "_qapi_gen": attr.label( |
| 1457 | + default = Label("//scripts:qapi-gen"), |
| 1458 | + executable = True, |
| 1459 | + cfg = "exec", |
| 1460 | + ), |
| 1461 | + }, |
| 1462 | +) |
| 1463 | diff --git a/scripts/tracetool/BUILD b/scripts/tracetool/BUILD |
| 1464 | new file mode 100644 |
| 1465 | index 0000000000..93ccf94480 |
| 1466 | --- /dev/null |
| 1467 | +++ b/scripts/tracetool/BUILD |
| 1468 | @@ -0,0 +1,11 @@ |
| 1469 | +load("@rules_python//python:defs.bzl", "py_library") |
| 1470 | + |
| 1471 | +py_library( |
| 1472 | + name = "tracetool", |
| 1473 | + srcs = glob(["*.py"]), |
| 1474 | + visibility = ["//visibility:public"], |
| 1475 | + deps = [ |
| 1476 | + "//scripts/tracetool/backend", |
| 1477 | + "//scripts/tracetool/format", |
| 1478 | + ], |
| 1479 | +) |
| 1480 | diff --git a/scripts/tracetool/backend/BUILD b/scripts/tracetool/backend/BUILD |
| 1481 | new file mode 100644 |
| 1482 | index 0000000000..6cc626682c |
| 1483 | --- /dev/null |
| 1484 | +++ b/scripts/tracetool/backend/BUILD |
| 1485 | @@ -0,0 +1,7 @@ |
| 1486 | +load("@rules_python//python:defs.bzl", "py_library") |
| 1487 | + |
| 1488 | +py_library( |
| 1489 | + name = "backend", |
| 1490 | + srcs = glob(["*.py"]), |
| 1491 | + visibility = ["//visibility:public"], |
| 1492 | +) |
| 1493 | diff --git a/scripts/tracetool/defs.bzl b/scripts/tracetool/defs.bzl |
| 1494 | new file mode 100644 |
| 1495 | index 0000000000..70ce080a62 |
| 1496 | --- /dev/null |
| 1497 | +++ b/scripts/tracetool/defs.bzl |
Serge Bazanski | 665b109 | 2023-02-23 09:36:17 +0000 | [diff] [blame] | 1498 | @@ -0,0 +1,67 @@ |
Lorenz Brun | 0de1893 | 2021-03-11 00:36:48 +0100 | [diff] [blame] | 1499 | +def _impl_cc_qemu_trace(ctx): |
| 1500 | + outs = [] |
| 1501 | + for src in ctx.files.srcs: |
| 1502 | + name = src.path.replace("external/qemu/", "").replace("/trace-events", "").replace("/", "_") |
| 1503 | + if name == "trace-events": |
| 1504 | + name = "root" |
| 1505 | + trace_h = ctx.actions.declare_file("trace-{}.h".format(name)) |
| 1506 | + trace_c = ctx.actions.declare_file("trace-{}.c".format(name)) |
| 1507 | + outs.append(trace_c) |
| 1508 | + outs.append(trace_h) |
| 1509 | + |
| 1510 | + ctx.actions.run( |
Serge Bazanski | 665b109 | 2023-02-23 09:36:17 +0000 | [diff] [blame] | 1511 | + inputs = [src], |
| 1512 | + tools = [ctx.executable._tracetool], |
Lorenz Brun | 0de1893 | 2021-03-11 00:36:48 +0100 | [diff] [blame] | 1513 | + executable = ctx.executable._savestdout, |
Serge Bazanski | 665b109 | 2023-02-23 09:36:17 +0000 | [diff] [blame] | 1514 | + arguments = [trace_h.path, ctx.executable._tracetool.path, "--backend", ctx.attr.backend, "--group", name, "--format=h", src.path], |
Lorenz Brun | 0de1893 | 2021-03-11 00:36:48 +0100 | [diff] [blame] | 1515 | + outputs = [trace_h], |
| 1516 | + ) |
| 1517 | + ctx.actions.run( |
Serge Bazanski | 665b109 | 2023-02-23 09:36:17 +0000 | [diff] [blame] | 1518 | + inputs = [src], |
| 1519 | + tools = [ctx.executable._tracetool], |
Lorenz Brun | 0de1893 | 2021-03-11 00:36:48 +0100 | [diff] [blame] | 1520 | + executable = ctx.executable._savestdout, |
Serge Bazanski | 665b109 | 2023-02-23 09:36:17 +0000 | [diff] [blame] | 1521 | + arguments = [trace_c.path, ctx.executable._tracetool.path, "--backend", ctx.attr.backend, "--group", name, "--format=c", src.path], |
Lorenz Brun | 0de1893 | 2021-03-11 00:36:48 +0100 | [diff] [blame] | 1522 | + outputs = [trace_c], |
| 1523 | + ) |
| 1524 | + return [DefaultInfo(files = depset(outs))] |
| 1525 | + |
| 1526 | +cc_qemu_trace = rule( |
| 1527 | + implementation = _impl_cc_qemu_trace, |
| 1528 | + attrs = { |
| 1529 | + "srcs": attr.label_list( |
| 1530 | + mandatory = True, |
| 1531 | + allow_files = True, |
| 1532 | + ), |
| 1533 | + "backend": attr.string( |
| 1534 | + default = "log", |
| 1535 | + ), |
| 1536 | + "_tracetool": attr.label( |
| 1537 | + default = Label("//scripts:tracetool-cli"), |
| 1538 | + executable = True, |
| 1539 | + cfg = "exec", |
| 1540 | + ), |
| 1541 | + "_savestdout": attr.label( |
| 1542 | + default = Label("@dev_source_monogon//build/savestdout"), |
| 1543 | + executable = True, |
| 1544 | + cfg = "exec", |
| 1545 | + ), |
| 1546 | + }, |
| 1547 | +) |
| 1548 | + |
| 1549 | +def _impl_cc_qemu_trace_single(ctx): |
| 1550 | + trace_h = ctx.actions.declare_file("trace-{}.h".format(ctx.attr.name)) |
| 1551 | + trace_c = ctx.actions.declare_file("trace-{}.c".format(ctx.attr.name)) |
| 1552 | + |
| 1553 | + ctx.actions.run( |
| 1554 | + inputs = ctx.files.src, |
| 1555 | + executable = ctx.executable._tracetool, |
| 1556 | + arguments = ["--backend", ctx.attr.backend, "--group", ctx.attr.name, "--format=h", ctx.files.src[0].path, trace_h.path], |
| 1557 | + outputs = [trace_h], |
| 1558 | + ) |
| 1559 | + ctx.actions.run( |
| 1560 | + inputs = ctx.files.src, |
| 1561 | + executable = ctx.executable._tracetool, |
| 1562 | + arguments = ["--backend", ctx.attr.backend, "--group", ctx.attr.name, "--format=c", ctx.files.src[0].path, trace_c.path], |
| 1563 | + outputs = [trace_c], |
| 1564 | + ) |
| 1565 | + return [DefaultInfo(files = depset([trace_c, trace_h]))] |
| 1566 | diff --git a/scripts/tracetool/format/BUILD b/scripts/tracetool/format/BUILD |
| 1567 | new file mode 100644 |
| 1568 | index 0000000000..1b2dc209e1 |
| 1569 | --- /dev/null |
| 1570 | +++ b/scripts/tracetool/format/BUILD |
| 1571 | @@ -0,0 +1,7 @@ |
| 1572 | +load("@rules_python//python:defs.bzl", "py_library") |
| 1573 | + |
| 1574 | +py_library( |
| 1575 | + name = "format", |
| 1576 | + srcs = glob(["*.py"]), |
| 1577 | + visibility = ["//visibility:public"], |
| 1578 | +) |
| 1579 | diff --git a/trace/BUILD b/trace/BUILD |
| 1580 | new file mode 100644 |
| 1581 | index 0000000000..2f2e71d81a |
| 1582 | --- /dev/null |
| 1583 | +++ b/trace/BUILD |
| 1584 | @@ -0,0 +1,18 @@ |
| 1585 | +load("//scripts/tracetool:defs.bzl", "cc_qemu_trace") |
| 1586 | + |
| 1587 | +cc_qemu_trace( |
| 1588 | + name = "trace", |
| 1589 | + srcs = ["//:trace-files"], |
| 1590 | + visibility = ["//visibility:public"], |
| 1591 | +) |
| 1592 | + |
| 1593 | +exports_files(glob([ |
| 1594 | + "*.c", |
| 1595 | + "*.h", |
| 1596 | +])) |
| 1597 | + |
| 1598 | +filegroup( |
| 1599 | + name = "extra_hdrs", |
| 1600 | + srcs = glob(["**/*.h"]), |
| 1601 | + visibility = ["//visibility:public"], |
| 1602 | +) |
| 1603 | -- |
| 1604 | 2.25.1 |
| 1605 | |