[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins
From: |
Emilio G. Cota |
Subject: |
Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins |
Date: |
Tue, 27 Nov 2018 18:13:57 -0500 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
On Tue, Nov 27, 2018 at 15:43:52 +0300, Roman Bolshakov wrote:
> ld64 on macOS has similar -exported_symbols_list option. Here's the reference:
>
> -exported_symbols_list filename
> The specified filename contains a list of global symbol names
> that will remain as global symbols in the output file. All other
> global symbols will be treated as if they were marked as
> __private_extern__ (aka visibility=hidden) and will not be global in
> the output file. The symbol names listed in filename must be one per
> line. Leading and trailing white space are not part of the symbol
> name. Lines starting with # are ignored, as are lines with only white
> space. Some wildcards (similar to shell file matching) are supported.
> The * matches zero or more characters. The ? matches one character.
> [abc] matches one character which must be an 'a', 'b', or 'c'.
> [a-z] matches any single lower case letter from 'a' to 'z'.
>
>
> I can try your branch if you add support of the linker flag or send required
> changes via GitHub.
Can you please try this branch? I added a commit with the appended.
https://github.com/cota/qemu/tree/plugin-v2
You can inspect the symbols in the final binary with
`readelf --dyn-syms' or `nm -D'.
Thanks,
Emilio
---
diff --git a/configure b/configure
index fe9707d951..3dc9c9697b 100755
--- a/configure
+++ b/configure
@@ -5176,15 +5176,31 @@ int main(void)
}
EOF
+ld_dynamic_list="no"
if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then
ld_dynamic_list="yes"
-else
- if test "$plugins" = "yes" ; then
- error_exit \
- "Plugin support requires specifying a set of symbols that " \
- "are exported to plugins. Unfortunately your linker doesn't " \
- "support the flag (--dynamic-list) used for this purpose."
- fi
+fi
+
+#########################################
+# See if -exported_symbols_list is supported by the linker
+
+cat > $TMPTXT <<EOF
+ foo
+EOF
+
+ld_exported_symbols_list="no"
+if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then
+ ld_exported_symbols_list="yes"
+fi
+
+if test "$plugins" = "yes" &&
+ test "$ld_dynamic_list" = "no" &&
+ test "$ld_exported_symbols_list" = "no" ; then
+ error_exit \
+ "Plugin support requires specifying a set of symbols that " \
+ "are exported to plugins. Unfortunately your linker doesn't " \
+ "support the flag (--dynamic-list or -exported_symbols_list) used " \
+ "for this purpose."
fi
########################################
@@ -6827,7 +6843,18 @@ fi
if test "$plugins" = "yes" ; then
echo "CONFIG_PLUGINS=y" >> $config_host_mak
LIBS="-ldl $LIBS"
- LDFLAGS="-Wl,--dynamic-list=\$(SRC_PATH)/qemu-plugins.symbols $LDFLAGS"
+ if test "$ld_dynamic_list" = "yes" ; then
+ LDFLAGS="-Wl,--dynamic-list=\$(SRC_PATH)/qemu-plugins.symbols $LDFLAGS"
+ elif test "$ld_exported_symbols_list" = "yes" ; then
+ ld64_symbols=qemu-plugins-ld64.symbols
+ echo "# Automatically generated by configure - do not modify" >
$ld64_symbols
+ cat "$source_path/qemu-plugins.symbols" | grep qemu_ | sed 's/;//g' >>
$ld64_symbols
+ LDFLAGS="-Wl,-exported_symbols_list,\$(BUILD_DIR)/$ld64_symbols
$LDFLAGS"
+ else
+ error_exit \
+ "If \$plugins=yes, either \$ld_dynamic_list or " \
+ "\$ld_exported_symbols_list should have been set to 'yes'."
+ fi
fi
if test "$tcg_interpreter" = "yes"; then
- Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins, Alex Bennée, 2018/11/27
- Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins, Roman Bolshakov, 2018/11/27
- Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins,
Emilio G. Cota <=
- Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins, Roman Bolshakov, 2018/11/28
- Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins, Emilio G. Cota, 2018/11/28
- Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins, Roman Bolshakov, 2018/11/29
- Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins, Emilio G. Cota, 2018/11/29
- Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins, Emilio G. Cota, 2018/11/29
- Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins, Roman Bolshakov, 2018/11/29