aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-08-29 22:07:01 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-08-21 06:30:17 -0400
commit3154fee4db6d14e72050c7efc6a6f4eb06d01d4a (patch)
tree245f3721fd5c120265d65a17446f2b37d9a4b17d /scripts
parent2becc36a3e53dc9b8ed01c5288e21a2463f1f640 (diff)
downloadqemu-3154fee4db6d14e72050c7efc6a6f4eb06d01d4a.zip
qemu-3154fee4db6d14e72050c7efc6a6f4eb06d01d4a.tar.gz
qemu-3154fee4db6d14e72050c7efc6a6f4eb06d01d4a.tar.bz2
meson: add modules infrastructure
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/undefsym.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/undefsym.sh b/scripts/undefsym.sh
new file mode 100755
index 0000000..b9ec332
--- /dev/null
+++ b/scripts/undefsym.sh
@@ -0,0 +1,20 @@
+#! /usr/bin/env bash
+
+# Before a shared module's DSO is produced, a static library is built for it
+# and passed to this script. The script generates -Wl,-u options to force
+# the inclusion of symbol from libqemuutil.a if the shared modules need them,
+# This is necessary because the modules may use functions not needed by the
+# executable itself, which would cause the function to not be linked in.
+# Then the DSO loading would fail because of the missing symbol.
+
+if test $# -le 2; then
+ exit 0
+fi
+
+NM=$1
+staticlib=$2
+shift 2
+# Find symbols defined in static libraries and undefined in shared modules
+comm -12 \
+ <( $NM -P -g $staticlib | awk '$2!="U"{print "-Wl,-u," $1}' | sort -u) \
+ <( $NM -P -g "$@" | awk '$2=="U"{print "-Wl,-u," $1}' | sort -u)