diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-02-24 15:37:59 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-02-24 15:38:00 +0000 |
commit | 6dedf0522c3fdeb10fe27d4aef35f4c57f3d0806 (patch) | |
tree | e1177c7fd43a8165c8f697ff0aa5a5e6fcdd7766 /include | |
parent | 98b21dcdb331798709edafcd65b5b7a1e07302db (diff) | |
parent | f966f9ddd175bdf82f12650c3b7b5a93cc421d88 (diff) |
Merge remote-tracking branch 'remotes/bonzini/configure' into staging
* remotes/bonzini/configure:
build: softmmu targets do not have a "main.o" file
configure: Disable libtool if -fPIE does not work with it (bug #1257099)
block: convert block drivers linked with libs to modules
Makefile: introduce common-obj-m and block-obj-m for DSO
Makefile: install modules with "make install"
module: implement module loading
rules.mak: introduce DSO rules
darwin: do not use -mdynamic-no-pic
block: use per-object cflags and libs
rules.mak: allow per object cflags and libs
rules.mak: fix $(obj) to a real relative path
util: Split out exec_dir from os_find_datadir
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu-common.h | 2 | ||||
-rw-r--r-- | include/qemu/module.h | 23 | ||||
-rw-r--r-- | include/qemu/osdep.h | 9 |
3 files changed, 32 insertions, 2 deletions
diff --git a/include/qemu-common.h b/include/qemu-common.h index b0e34b2e15..46c2beacd2 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -352,7 +352,7 @@ char *qemu_find_file(int type, const char *name); /* OS specific functions */ void os_setup_early_signal_handling(void); -char *os_find_datadir(const char *argv0); +char *os_find_datadir(void); void os_parse_cmd_args(int index, const char *optarg); void os_pidfile_error(void); diff --git a/include/qemu/module.h b/include/qemu/module.h index c4ccd57166..72d94984a2 100644 --- a/include/qemu/module.h +++ b/include/qemu/module.h @@ -14,11 +14,31 @@ #ifndef QEMU_MODULE_H #define QEMU_MODULE_H +#include "qemu/osdep.h" + +#define DSO_STAMP_FUN glue(qemu_stamp, CONFIG_STAMP) +#define DSO_STAMP_FUN_STR stringify(DSO_STAMP_FUN) + +#ifdef BUILD_DSO +void DSO_STAMP_FUN(void); +/* This is a dummy symbol to identify a loaded DSO as a QEMU module, so we can + * distinguish "version mismatch" from "not a QEMU module", when the stamp + * check fails during module loading */ +void qemu_module_dummy(void); + +#define module_init(function, type) \ +static void __attribute__((constructor)) do_qemu_init_ ## function(void) \ +{ \ + register_dso_module_init(function, type); \ +} +#else /* This should not be used directly. Use block_init etc. instead. */ #define module_init(function, type) \ -static void __attribute__((constructor)) do_qemu_init_ ## function(void) { \ +static void __attribute__((constructor)) do_qemu_init_ ## function(void) \ +{ \ register_module_init(function, type); \ } +#endif typedef enum { MODULE_INIT_BLOCK, @@ -34,6 +54,7 @@ typedef enum { #define type_init(function) module_init(function, MODULE_INIT_QOM) void register_module_init(void (*fn)(void), module_init_type type); +void register_dso_module_init(void (*fn)(void), module_init_type type); void module_call_init(module_init_type type); diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index eac7172bcb..ffb296692d 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -215,6 +215,15 @@ bool fips_get_state(void); */ char *qemu_get_local_state_pathname(const char *relative_pathname); +/* Find program directory, and save it for later usage with + * qemu_get_exec_dir(). + * Try OS specific API first, if not working, parse from argv0. */ +void qemu_init_exec_dir(const char *argv0); + +/* Get the saved exec dir. + * Caller needs to release the returned string by g_free() */ +char *qemu_get_exec_dir(void); + /** * qemu_getauxval: * @type: the auxiliary vector key to lookup |