From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRmc4-0006tw-Ad for qemu-devel@nongnu.org; Tue, 27 Nov 2018 18:17:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRmYM-0000T6-Ai for qemu-devel@nongnu.org; Tue, 27 Nov 2018 18:14:05 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:52295) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRmYL-0000Op-Uv for qemu-devel@nongnu.org; Tue, 27 Nov 2018 18:14:02 -0500 Date: Tue, 27 Nov 2018 18:13:57 -0500 From: "Emilio G. Cota" Message-ID: <20181127231357.GA19764@flamenco> References: <20181025172057.20414-1-cota@braap.org> <20181025172057.20414-42-cota@braap.org> <20181127124352.ll6quqc5xedvdqht@MacBook-Pro-Roman.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181127124352.ll6quqc5xedvdqht@MacBook-Pro-Roman.local> Subject: Re: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roman Bolshakov Cc: qemu-devel@nongnu.org, Peter Maydell , Alex =?iso-8859-1?Q?Benn=E9e?= , =?iso-8859-1?Q?Llu=EDs?= Vilanova , Pavel Dovgalyuk , Stefan Hajnoczi 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 <> $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