diff options
author | Fam Zheng <famz@redhat.com> | 2014-09-01 18:35:10 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-09-09 13:13:05 +0200 |
commit | c261d774fb9093d00e0938a19f502fb220f62718 (patch) | |
tree | 181d3cb60edf8feba7ec792e2fcbfd2335999774 /hw/i386/pc_sysfw.c | |
parent | 2ceee4b0521241eb8595a5501b54bb3534ebb99a (diff) | |
download | hqemu-c261d774fb9093d00e0938a19f502fb220f62718.zip hqemu-c261d774fb9093d00e0938a19f502fb220f62718.tar.gz |
rules.mak: Fix DSO build by pulling in archive symbols
This fixes an issue with module build system. block/iscsi.so is
currently broken:
$ ~/build/last/qemu-img
Failed to open module: /home/fam/build/master/block-iscsi.so:
undefined symbol: qmp_query_uuid
qemu-img: Not enough arguments
Try 'qemu-img --help' for more information
To fix this, we should (at least) let qemu-img link qmp_query_uuid from
libqemustub.a. (There are a few other symbols missing, as well.)
This patch changes the linking rules to:
1) Build ".mo" with "ld -r -o $@ $^" for each ".so", and later build .so
with it.
2) Always build all the .mo before linking the executables. This is
achieved by adding those .mo files to the executables' "-y"
variables.
3) When linking an executable, those .mo files in its "-y" variables are
filtered out, and replaced by one or more -Wl,-u,$symbol flags. This
is done in the added macro "process-archive-undefs".
These "-Wl,-u,$symbol" flags will force ld to pull in the function
definition from the archives when linking.
Note that the .mo objects, that are actually meant to be linked in
the executables, are already expanded in unnest-vars, before the
linking command. So we are safe to simply filter out .mo for the
purpose of pulling undefined symbols.
process-archive-undefs works as this: For each ".mo", find all the
undefined symbols in it, filter ones that are defined in the
archives. For each of these symbols, generate a "-Wl,-u,$symbol" in
the link command, and put them before archive names in the command
line.
Suggested-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i386/pc_sysfw.c')
0 files changed, 0 insertions, 0 deletions