2020-09-09 14:27:41 +03:00
|
|
|
# -*- Mode: makefile -*-
|
|
|
|
#
|
|
|
|
# This Makefile example is fairly independent from the main makefile
|
|
|
|
# so users can take and adapt it for their build. We only really
|
|
|
|
# include config-host.mak so we don't have to repeat probing for
|
2022-10-12 12:31:32 +03:00
|
|
|
# programs that the main configure has already done for us.
|
2020-09-09 14:27:41 +03:00
|
|
|
#
|
|
|
|
|
2023-09-07 13:54:42 +03:00
|
|
|
include config-host.mak
|
2020-09-09 14:27:41 +03:00
|
|
|
|
2023-09-07 13:54:42 +03:00
|
|
|
TOP_SRC_PATH = $(SRC_PATH)/../..
|
2020-09-09 14:27:41 +03:00
|
|
|
|
2023-09-07 13:54:42 +03:00
|
|
|
VPATH += $(SRC_PATH)
|
2020-09-09 14:27:41 +03:00
|
|
|
|
|
|
|
NAMES :=
|
2021-07-09 17:29:59 +03:00
|
|
|
NAMES += execlog
|
2020-09-09 14:27:41 +03:00
|
|
|
NAMES += hotblocks
|
|
|
|
NAMES += hotpages
|
|
|
|
NAMES += howvec
|
2023-11-06 21:51:05 +03:00
|
|
|
|
|
|
|
# The lockstep example communicates using unix sockets,
|
|
|
|
# and can't be easily made to work on windows.
|
|
|
|
ifneq ($(CONFIG_WIN32),y)
|
2020-09-09 14:27:41 +03:00
|
|
|
NAMES += lockstep
|
2023-11-06 21:51:05 +03:00
|
|
|
endif
|
|
|
|
|
plugins: new hwprofile plugin
This is a plugin intended to help with profiling access to various
bits of system hardware. It only really makes sense for system
emulation.
It takes advantage of the recently exposed helper API that allows us
to see the device name (memory region name) associated with a device.
You can specify arg=read or arg=write to limit the tracking to just
reads or writes (by default it does both).
The pattern option:
-plugin ./tests/plugin/libhwprofile.so,arg=pattern
will allow you to see the access pattern to devices, eg:
gic_cpu @ 0xffffffc010040000
off:00000000, 8, 1, 8, 1
off:00000000, 4, 1, 4, 1
off:00000000, 2, 1, 2, 1
off:00000000, 1, 1, 1, 1
The source option:
-plugin ./tests/plugin/libhwprofile.so,arg=source
will track the virtual source address of the instruction making the
access:
pl011 @ 0xffffffc010031000
pc:ffffffc0104c785c, 1, 4, 0, 0
pc:ffffffc0104c7898, 1, 4, 0, 0
pc:ffffffc010512bcc, 2, 1867, 0, 0
You cannot mix source and pattern.
Finally the match option allow you to limit the tracking to just the
devices you care about.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Robert Foley <robert.foley@linaro.org>
Reviewed-by: Robert Foley <robert.foley@linaro.org>
Message-Id: <20210213130325.14781-4-alex.bennee@linaro.org>
2021-02-13 16:03:05 +03:00
|
|
|
NAMES += hwprofile
|
2021-07-09 17:30:01 +03:00
|
|
|
NAMES += cache
|
2022-02-04 23:43:31 +03:00
|
|
|
NAMES += drcov
|
2020-09-09 14:27:41 +03:00
|
|
|
|
2023-11-06 21:51:04 +03:00
|
|
|
ifeq ($(CONFIG_WIN32),y)
|
|
|
|
SO_SUFFIX := .dll
|
|
|
|
LDLIBS += $(shell $(PKG_CONFIG) --libs glib-2.0)
|
|
|
|
else
|
|
|
|
SO_SUFFIX := .so
|
|
|
|
endif
|
|
|
|
|
|
|
|
SONAMES := $(addsuffix $(SO_SUFFIX),$(addprefix lib,$(NAMES)))
|
2020-09-09 14:27:41 +03:00
|
|
|
|
|
|
|
# The main QEMU uses Glib extensively so it's perfectly fine to use it
|
|
|
|
# in plugins (which many example do).
|
2023-09-07 13:54:42 +03:00
|
|
|
PLUGIN_CFLAGS := $(shell $(PKG_CONFIG) --cflags glib-2.0)
|
|
|
|
PLUGIN_CFLAGS += -fPIC -Wall
|
|
|
|
PLUGIN_CFLAGS += -I$(TOP_SRC_PATH)/include/qemu
|
2020-09-09 14:27:41 +03:00
|
|
|
|
|
|
|
all: $(SONAMES)
|
|
|
|
|
|
|
|
%.o: %.c
|
2023-09-07 13:54:42 +03:00
|
|
|
$(CC) $(CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<
|
2020-09-09 14:27:41 +03:00
|
|
|
|
2023-11-06 21:51:04 +03:00
|
|
|
ifeq ($(CONFIG_WIN32),y)
|
2023-11-20 18:08:23 +03:00
|
|
|
lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/libqemu_plugin_api.a
|
2023-11-06 21:51:04 +03:00
|
|
|
$(CC) -shared -o $@ $^ $(LDLIBS)
|
|
|
|
else ifeq ($(CONFIG_DARWIN),y)
|
|
|
|
lib%$(SO_SUFFIX): %.o
|
2023-09-07 13:38:39 +03:00
|
|
|
$(CC) -bundle -Wl,-undefined,dynamic_lookup -o $@ $^ $(LDLIBS)
|
|
|
|
else
|
2023-11-06 21:51:04 +03:00
|
|
|
lib%$(SO_SUFFIX): %.o
|
contrib/plugins: remove -soname argument
-soname is not needed for runtime-loaded modules. For example, Meson says:
if not isinstance(target, build.SharedModule) or target.force_soname:
# Add -Wl,-soname arguments on Linux, -install_name on OS X
commands += linker.get_soname_args(
self.environment, target.prefix, target.name, target.suffix,
target.soversion, target.darwin_versions)
(force_soname is set is shared modules are linked into a build target, which is not
the case here.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-09-07 13:17:54 +03:00
|
|
|
$(CC) -shared -o $@ $^ $(LDLIBS)
|
2023-09-07 13:38:39 +03:00
|
|
|
endif
|
2020-09-09 14:27:41 +03:00
|
|
|
|
2023-11-06 21:51:04 +03:00
|
|
|
|
2020-09-09 14:27:41 +03:00
|
|
|
clean:
|
2023-11-06 21:51:04 +03:00
|
|
|
rm -f *.o *$(SO_SUFFIX) *.d
|
2020-09-09 14:27:41 +03:00
|
|
|
rm -Rf .libs
|
|
|
|
|
|
|
|
.PHONY: all clean
|
2023-09-07 13:54:42 +03:00
|
|
|
.SECONDARY:
|