Richard W.M. Jones
2020-Mar-26 18:25 UTC
[Libguestfs] [PATCH nbdkit 0/9] Create libnbdkit.so
This creates libnbdkit.so as discussed in the following thread: https://www.redhat.com/archives/libguestfs/2020-March/thread.html#00203 test-delay-shutdown.sh fails for unclear reasons. This series starts by reverting "tests: Don't strand hung nbdkit processes" which is because several other tests fail randomly unless I revert this patch. I didn't investigate this yet so it could be caused by this patch series. libtool on Linux doesn't appear to care about -undefined/-no-undefined. See comments in commit messages. The patch is kind of ugly TBH. Personally I don't have a problem with plugins having undefined references that are later resolved to the main binary, but I understand that Windows is broken in this regard. Rich.
Richard W.M. Jones
2020-Mar-26 18:25 UTC
[Libguestfs] [PATCH nbdkit 1/9] Revert "tests: Don't strand hung nbdkit processes"
This reverts commit d6ee94d1e0da9f7eef4d78eb5b94b4cbc88eccf5. --- tests/functions.sh.in | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/tests/functions.sh.in b/tests/functions.sh.in index e2ef9701..8406fcf9 100644 --- a/tests/functions.sh.in +++ b/tests/functions.sh.in @@ -85,8 +85,8 @@ requires_ipv6_loopback () # instead. It's very unlikely that port 1 is open. if LANG=C qemu-img info "nbd:[::1]:1" |& \ grep -sq "Address family for hostname not supported"; then - echo "$0: IPv6 loopback is not available, skipping this test" - exit 77 + echo "$0: IPv6 loopback is not available, skipping this test" + exit 77 fi } @@ -139,32 +139,7 @@ start_nbdkit () fi # Kill nbdkit on exit. - cleanup_fn kill_nbdkit "$(cat "$pidfile")" -} - -# kill_nbdkit pid -# -# End the nbkdit process with the given pid. Exit this script with an -# error if nbdkit does not gracefully shutdown in a timely manner. -kill_nbdkit () -{ - local pid=$1 i - - # Start with SIGTERM, and wait for graceful exit - kill $pid - for i in {1..60}; do - if ! kill -0 $pid 2>/dev/null; then - break - fi - sleep 1 - done - # If nbdkit has not exited, try SIGKILL and fail the test - if test $i = 60; then - echo "error: nbdkit pid $pid failed to respond to SIGTERM" - kill -9 $pid - # Append our failure after other cleanups - cleanup_fn exit 1 - fi + cleanup_fn kill "$(cat "$pidfile")" } # foreach_plugin f [args] -- 2.25.0
Richard W.M. Jones
2020-Mar-26 18:25 UTC
[Libguestfs] [PATCH nbdkit 2/9] server: Rename replacement vfprintf function.
As this symbol is never exported from the server, don't call it "nbdkit_vfprintf". Also move it to a new file to make forthcoming changes easier. Fixes commit 1c230358462c349533062eda9e4072054fda0e21. --- server/Makefile.am | 1 + server/internal.h | 14 +++++----- server/log.c | 24 ----------------- server/vfprintf.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 30 deletions(-) diff --git a/server/Makefile.am b/server/Makefile.am index 9351fefc..4c789934 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -64,6 +64,7 @@ nbdkit_SOURCES = \ sockets.c \ threadlocal.c \ usergroup.c \ + vfprintf.c \ $(top_srcdir)/include/nbdkit-plugin.h \ $(top_srcdir)/include/nbdkit-filter.h \ $(NULL) diff --git a/server/internal.h b/server/internal.h index e39db8a8..e5c7f514 100644 --- a/server/internal.h +++ b/server/internal.h @@ -298,16 +298,18 @@ extern void apply_debug_flags (void *dl, const char *name); extern void free_debug_flags (void); /* log-*.c */ +extern void log_stderr_verror (const char *fs, va_list args) + __attribute__((__format__ (printf, 1, 0))); +extern void log_syslog_verror (const char *fs, va_list args) + __attribute__((__format__ (printf, 1, 0))); + +/* vfprintf.c */ #if !HAVE_VFPRINTF_PERCENT_M #include <stdio.h> -#define vfprintf nbdkit_vfprintf -extern int nbdkit_vfprintf (FILE *f, const char *fmt, va_list args) +#define vfprintf replace_vfprintf +extern int replace_vfprintf (FILE *f, const char *fmt, va_list args) __attribute__((__format__ (printf, 2, 0))); #endif -extern void log_stderr_verror (const char *fs, va_list args) - __attribute__((__format__ (printf, 1, 0))); -extern void log_syslog_verror (const char *fs, va_list args) - __attribute__((__format__ (printf, 1, 0))); /* backend.c */ struct backend { diff --git a/server/log.c b/server/log.c index a801aa2e..73493563 100644 --- a/server/log.c +++ b/server/log.c @@ -77,27 +77,3 @@ nbdkit_error (const char *fs, ...) nbdkit_verror (fs, args); va_end (args); } - -#if !HAVE_VFPRINTF_PERCENT_M -/* Work around lack of %m in BSD */ -#undef vfprintf - -/* Call the real vfprintf after first changing %m into strerror(errno). */ -int -nbdkit_vfprintf(FILE *f, const char *fmt, va_list args) -{ - char *repl = NULL; - char *p = strstr (fmt, "%m"); /* assume strstr doesn't touch errno */ - int ret; - - /* We only handle the first %m; if a user passes more than one, they - * deserve broken output. - */ - if (p && asprintf (&repl, "%.*s%s%s", (int) (p - fmt), fmt, strerror (errno), - p + 2) > 0) - fmt = repl; - ret = vfprintf (f, fmt, args); - free (repl); - return ret; -} -#endif diff --git a/server/vfprintf.c b/server/vfprintf.c new file mode 100644 index 00000000..2d51456d --- /dev/null +++ b/server/vfprintf.c @@ -0,0 +1,65 @@ +/* nbdkit + * Copyright (C) 2013-2018 Red Hat Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <errno.h> + +#include "internal.h" + +#if !HAVE_VFPRINTF_PERCENT_M +/* Work around lack of %m in BSD */ +#undef vfprintf + +/* Call the real vfprintf after first changing %m into strerror(errno). */ +int +replace_vfprintf (FILE *f, const char *fmt, va_list args) +{ + char *repl = NULL; + char *p = strstr (fmt, "%m"); /* assume strstr doesn't touch errno */ + int ret; + + /* We only handle the first %m; if a user passes more than one, they + * deserve broken output. + */ + if (p && asprintf (&repl, "%.*s%s%s", (int) (p - fmt), fmt, strerror (errno), + p + 2) > 0) + fmt = repl; + ret = vfprintf (f, fmt, args); + free (repl); + return ret; +} +#endif -- 2.25.0
Richard W.M. Jones
2020-Mar-26 18:25 UTC
[Libguestfs] [PATCH nbdkit 3/9] server: Add log_verror function.
Apart from removing a slightly misleading comment, this small refactoring makes subsequent commits simpler but otherwise doesn't change anything. --- server/internal.h | 3 +++ server/log.c | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/server/internal.h b/server/internal.h index e5c7f514..b43798ff 100644 --- a/server/internal.h +++ b/server/internal.h @@ -297,6 +297,9 @@ extern void add_debug_flag (const char *arg); extern void apply_debug_flags (void *dl, const char *name); extern void free_debug_flags (void); +/* log.c */ +extern void log_verror (const char *fs, va_list args); + /* log-*.c */ extern void log_stderr_verror (const char *fs, va_list args) __attribute__((__format__ (printf, 1, 0))); diff --git a/server/log.c b/server/log.c index 73493563..37de3dd2 100644 --- a/server/log.c +++ b/server/log.c @@ -40,11 +40,11 @@ #include "internal.h" -/* Call the right nbdkit_verror function depending on log_sink. +/* Call the right log_*_verror function depending on log_sink. * Note: preserves the previous value of errno. */ void -nbdkit_verror (const char *fs, va_list args) +log_verror (const char *fs, va_list args) { switch (log_to) { case LOG_TO_DEFAULT: @@ -65,9 +65,14 @@ nbdkit_verror (const char *fs, va_list args) } } -/* Wrapper around nbdkit_verror. - * Note: preserves the previous value of errno. - */ +/* Note: preserves the previous value of errno. */ +void +nbdkit_verror (const char *fs, va_list args) +{ + log_verror (fs, args); +} + +/* Note: preserves the previous value of errno. */ void nbdkit_error (const char *fs, ...) { -- 2.25.0
Richard W.M. Jones
2020-Mar-26 18:25 UTC
[Libguestfs] [PATCH nbdkit 4/9] vddk: Compile dummy libvixDiskLib.so with -no-undefined on all platforms.
The dummy library can be compiled this way on all platforms since it doesn't rely on external undefined symbols. Reverts commit ba000b469c24ad69604137de975b255bbe70d056. --- configure.ac | 9 --------- tests/Makefile.am | 6 +----- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 0a0ac60a..92e0d4e3 100644 --- a/configure.ac +++ b/configure.ac @@ -412,15 +412,6 @@ AS_CASE([$host_os], AC_MSG_RESULT([$SHARED_LDFLAGS]) AC_SUBST([SHARED_LDFLAGS]) -AC_MSG_CHECKING([if we are on a windows platform]) -AS_CASE([$host_os], - [mingw*|msys*|cygwin*], [is_windows=yes], - [is_windows=no] -) -AC_MSG_RESULT([$is_windows]) -AM_CONDITIONAL([WINDOWS], - [test "x$is_windows" = "xyes"]) - AC_SEARCH_LIBS([getaddrinfo], [network socket]) dnl Check for SELinux socket labelling (optional). diff --git a/tests/Makefile.am b/tests/Makefile.am index 562558d0..f9c6b8ad 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -833,13 +833,9 @@ libvixDiskLib_la_CXXFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html libvixDiskLib_la_LDFLAGS = \ - -shared -version-number 6:0:0 -rpath /nowhere \ + -shared -version-number 6:0:0 -no-undefined -rpath /nowhere \ $(NULL) -if WINDOWS -libvixDiskLib_la_LDFLAGS += -no-undefined -endif - endif HAVE_VDDK # zero plugin test. -- 2.25.0
Richard W.M. Jones
2020-Mar-26 18:25 UTC
[Libguestfs] [PATCH nbdkit 5/9] Create new library libnbdkit.so, so plugins can be compiled with -no-undefined.
Traditionally nbdkit plugins have been built as shared libraries with undefined symbols: $ ldd -r /usr/lib64/nbdkit/plugins/nbdkit-file-plugin.so linux-vdso.so.1 (0x00007ffc361a5000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fad9e07d000) libc.so.6 => /lib64/libc.so.6 (0x00007fad9deb3000) /lib64/ld-linux-x86-64.so.2 (0x00007fad9e0c8000) undefined symbol: nbdkit_extents_free (/usr/lib64/nbdkit/plugins/nbdkit-file-plugin.so) undefined symbol: nbdkit_add_extent (/usr/lib64/nbdkit/plugins/nbdkit-file-plugin.so) undefined symbol: nbdkit_realpath (/usr/lib64/nbdkit/plugins/nbdkit-file-plugin.so) undefined symbol: nbdkit_error (/usr/lib64/nbdkit/plugins/nbdkit-file-plugin.so) undefined symbol: nbdkit_debug (/usr/lib64/nbdkit/plugins/nbdkit-file-plugin.so) These symbols are resolved when the plugin is loaded by the server because the symbols are provided by the server binary itself. Unfortunately on Windows you cannot create a DLL that has undefined symbols (or at least not using MinGW). This patch changes linking so that you can now do this instead: gcc -shared plugin.c -o plugin.so -lnbdkit Now the nbdkit_* symbols are provided by a new library called libnbdkit.so. nbdkit itself also links to it. The result is that the plugin does not have any undefined symbols. Note this change is *opt-in*. On POSIX platforms it is possible to compile the plugins in the old way or the new way. (For Windows the new way must be used, but Windows is a new platform so this is not an API break.) nbdkit and libnbdkit.so must be shipped together at all times. There is a "secret" private ABI between them which is not stable. (This does not affect plugin ABI stability or guarantees.) Thanks: Eric Blake, Frank Gu About the implementation: When nbdkit starts up it must now initialize the library by calling libnbdkit_private_init. It checks that the server and library have identical versions, and passes pointers to certain internal server functions as described below. Some of the functions are self-contained, eg the parsing functions. These can be moved straight to the library and do not need to call into the server to do their work. Some of the functions are slow path and not self-contained, eg nbdkit_error. These continue to be implemented by the server, but I have renamed the server function from ‘nbdkit_*’ to ‘do_nbdkit_*’, and the library contains ‘nbdkit_*’ wrapper which simply bounces to the ‘do_nbdkit_*’ function. Some of the functions are fast path and not self-contained, eg nbdkit_debug. These are handled most awkwardly by exposing selected server functions that they need (eg. threadlocal_get_name) to the library. --- configure.ac | 1 + Makefile.am | 1 + lib/Makefile.am | 102 ++++++++ server/Makefile.am | 26 +- server/internal.h | 39 +-- server/log.c | 20 +- server/main.c | 12 + server/nbdkit.syms | 37 +-- server/plugins.c | 2 +- server/public.c | 480 +--------------------------------- server/quit.c | 2 +- lib/lib.h | 102 ++++++++ {server => lib}/debug.c | 6 +- {server => lib}/extents.c | 4 +- lib/init.c | 83 ++++++ lib/log.c | 59 +++++ lib/parse.c | 341 ++++++++++++++++++++++++ lib/password.c | 152 +++++++++++ lib/path.c | 97 +++++++ lib/slow.c | 78 ++++++ {server => lib}/test-public.c | 3 +- lib/vfprintf.c | 65 +++++ wrapper.c | 18 +- .gitignore | 2 +- lib/libnbdkit.syms | 76 ++++++ 25 files changed, 1224 insertions(+), 584 deletions(-) diff --git a/configure.ac b/configure.ac index 92e0d4e3..bf720cec 100644 --- a/configure.ac +++ b/configure.ac @@ -1057,6 +1057,7 @@ AC_CONFIG_FILES([Makefile filters/truncate/Makefile filters/xz/Makefile fuzzing/Makefile + lib/Makefile server/Makefile server/nbdkit.pc tests/functions.sh diff --git a/Makefile.am b/Makefile.am index ec8ae05d..3e6091f7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -75,6 +75,7 @@ SUBDIRS = \ common/include \ common/protocol \ common/utils \ + lib \ server \ $(NULL) diff --git a/lib/Makefile.am b/lib/Makefile.am new file mode 100644 index 00000000..4fca7c9d --- /dev/null +++ b/lib/Makefile.am @@ -0,0 +1,102 @@ +# nbdkit +# Copyright (C) 2013-2020 Red Hat Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat nor the names of its contributors may be +# used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +include $(top_srcdir)/common-rules.mk + +EXTRA_DIST = libnbdkit.syms + +# Note this library always has soname “libnbdkit.so.0” because plugins +# which may link to this library must forever have a stable soname. +# However the library only works with the corresponding nbdkit server +# binary compiled at the same time. The two must be shipped together. + +lib_LTLIBRARIES = libnbdkit.la +libnbdkit_la_SOURCES = \ + debug.c \ + extents.c \ + init.c \ + lib.h \ + log.c \ + parse.c \ + password.c \ + path.c \ + slow.c \ + vfprintf.c \ + $(NULL) + +libnbdkit_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + -DIN_NBDKIT_LIB=1 \ + $(NULL) +libnbdkit_la_CFLAGS = \ + $(PTHREAD_CFLAGS) \ + $(WARNINGS_CFLAGS) \ + $(NULL) +libnbdkit_la_LDFLAGS = \ + $(PTHREAD_LIBS) \ + $(NULL) +libnbdkit_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(NULL) + +if USE_LINKER_SCRIPT_FOR_SERVER +# We have to disable the linker script for libFuzzer because Clang +# adds loads of fuzzer and ASAN-related symbols that are required by +# the plugins but which our linker script tries to hide. +if !ENABLE_LIBFUZZER +libnbdkit_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libnbdkit.syms +endif +endif + +# Unit testing + +TESTS = test-public + +check_PROGRAMS = test-public + +test_public_SOURCES = \ + test-public.c \ + extents.c \ + parse.c \ + password.c \ + $(NULL) +test_public_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/protocol \ + -I$(top_srcdir)/common/utils \ + $(NULL) +test_public_CFLAGS = $(WARNINGS_CFLAGS) $(VALGRIND_CFLAGS) +test_public_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(NULL) diff --git a/server/Makefile.am b/server/Makefile.am index 4c789934..8d9ba0f0 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -41,9 +41,7 @@ nbdkit_SOURCES = \ captive.c \ connections.c \ crypto.c \ - debug.c \ debug-flags.c \ - extents.c \ filters.c \ internal.h \ locks.c \ @@ -80,6 +78,7 @@ nbdkit_CPPFLAGS = \ -Dfilterdir=\"$(filterdir)\" \ -Dsbindir=\"$(sbindir)\" \ -Dsysconfdir=\"$(sysconfdir)\" \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/include \ -I$(top_srcdir)/common/include \ -I$(top_srcdir)/common/protocol \ @@ -93,6 +92,7 @@ nbdkit_CFLAGS = \ $(VALGRIND_CFLAGS) \ $(NULL) nbdkit_LDADD = \ + ../lib/libnbdkit.la \ $(GNUTLS_LIBS) \ $(LIBSELINUX_LIBS) \ $(DL_LIBS) \ @@ -129,25 +129,3 @@ synopsis.c: $(top_srcdir)/docs/synopsis.txt pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = nbdkit.pc - -# Unit testing - -TESTS = test-public - -check_PROGRAMS = test-public - -test_public_SOURCES = \ - test-public.c \ - public.c \ - extents.c \ - $(NULL) -test_public_CPPFLAGS = \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/common/include \ - -I$(top_srcdir)/common/protocol \ - -I$(top_srcdir)/common/utils \ - $(NULL) -test_public_CFLAGS = $(WARNINGS_CFLAGS) $(VALGRIND_CFLAGS) -test_public_LDADD = \ - $(top_builddir)/common/utils/libutils.la \ - $(NULL) diff --git a/server/internal.h b/server/internal.h index b43798ff..9ef0b066 100644 --- a/server/internal.h +++ b/server/internal.h @@ -43,6 +43,7 @@ #define NBDKIT_INTERNAL #include "nbdkit-plugin.h" #include "nbdkit-filter.h" +#include "lib.h" #include "cleanup.h" #include "nbd-protocol.h" @@ -79,11 +80,25 @@ # define DO_DLCLOSE 1 #endif +/* Declare program_name. */ +#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME == 1 +#include <errno.h> +#define program_name program_invocation_short_name +#else +#define program_name "nbdkit" +#endif + #define container_of(ptr, type, member) ({ \ const typeof (((type *) 0)->member) *__mptr = (ptr); \ (type *) ((char *) __mptr - offsetof(type, member)); \ }) +#define debug(fs, ...) \ + do { \ + if_verbose \ + nbdkit_debug ((fs), ##__VA_ARGS__); \ + } while (0) + /* Maximum read or write request that we will handle. */ #define MAX_REQUEST_SIZE (64 * 1024 * 1024) @@ -138,6 +153,7 @@ extern int quit_fd; extern void set_up_quit_pipe (void); extern void close_quit_pipe (void); extern void handle_quit (int sig); +extern void do_nbdkit_shutdown (void); /* signals.c */ extern void set_up_signals (void); @@ -285,20 +301,13 @@ extern void crypto_init (bool tls_set_on_cli); extern void crypto_free (void); extern int crypto_negotiate_tls (int sockin, int sockout); -/* debug.c */ -#define debug(fs, ...) \ - do { \ - if_verbose \ - nbdkit_debug ((fs), ##__VA_ARGS__); \ - } while (0) - /* debug-flags.c */ extern void add_debug_flag (const char *arg); extern void apply_debug_flags (void *dl, const char *name); extern void free_debug_flags (void); /* log.c */ -extern void log_verror (const char *fs, va_list args); +extern void do_nbdkit_verror (const char *fs, va_list args); /* log-*.c */ extern void log_stderr_verror (const char *fs, va_list args) @@ -465,6 +474,7 @@ extern int backend_cache (struct backend *b, extern struct backend *plugin_register (size_t index, const char *filename, void *dl, struct nbdkit_plugin *(*plugin_init) (void)) __attribute__((__nonnull__ (2, 3, 4))); +extern void do_nbdkit_set_error (int err); /* filters.c */ extern struct backend *filter_register (struct backend *next, size_t index, @@ -507,6 +517,11 @@ extern void *threadlocal_buffer (size_t size); extern void threadlocal_set_conn (struct connection *conn); extern struct connection *threadlocal_get_conn (void); +/* public.c */ +extern int do_nbdkit_nanosleep (unsigned sec, unsigned nsec); +extern const char *do_nbdkit_export_name (void); +extern int do_nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen); + /* Macro which sets local variable struct connection *conn from * thread-local storage, asserting that it is non-NULL. If you want * to check if conn could be NULL (eg. outside a connection context) @@ -516,12 +531,4 @@ extern struct connection *threadlocal_get_conn (void); struct connection *conn = threadlocal_get_conn (); \ assert (conn != NULL) -/* Declare program_name. */ -#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME == 1 -#include <errno.h> -#define program_name program_invocation_short_name -#else -#define program_name "nbdkit" -#endif - #endif /* NBDKIT_INTERNAL_H */ diff --git a/server/log.c b/server/log.c index 37de3dd2..3588c7cc 100644 --- a/server/log.c +++ b/server/log.c @@ -44,7 +44,7 @@ * Note: preserves the previous value of errno. */ void -log_verror (const char *fs, va_list args) +do_nbdkit_verror (const char *fs, va_list args) { switch (log_to) { case LOG_TO_DEFAULT: @@ -64,21 +64,3 @@ log_verror (const char *fs, va_list args) break; } } - -/* Note: preserves the previous value of errno. */ -void -nbdkit_verror (const char *fs, va_list args) -{ - log_verror (fs, args); -} - -/* Note: preserves the previous value of errno. */ -void -nbdkit_error (const char *fs, ...) -{ - va_list args; - - va_start (args, fs); - nbdkit_verror (fs, args); - va_end (args); -} diff --git a/server/main.c b/server/main.c index b303146c..156d85bd 100644 --- a/server/main.c +++ b/server/main.c @@ -168,6 +168,18 @@ main (int argc, char *argv[]) size_t i; const char *magic_config_key; + /* Initialize libnbdkit.so. This must be done very early. */ + libnbdkit_private_init (PACKAGE_VERSION, + &verbose, + do_nbdkit_export_name, + do_nbdkit_nanosleep, + do_nbdkit_peer_name, + do_nbdkit_set_error, + do_nbdkit_shutdown, + do_nbdkit_verror, + threadlocal_get_name, + threadlocal_get_instance_num); + /* Refuse to run if stdin/out/err are closed, whether or not -s is used. */ if (fcntl (STDERR_FILENO, F_GETFL) == -1) { /* Nowhere we can report the error. Oh well. */ diff --git a/server/nbdkit.syms b/server/nbdkit.syms index 111223f2..5b665f85 100644 --- a/server/nbdkit.syms +++ b/server/nbdkit.syms @@ -30,44 +30,11 @@ # SUCH DAMAGE. # This linker script controls the visibility of symbols in the final -# nbdkit binary. We want to export some symbols to plugins, but at -# the same time we don't want plugins to be able to call arbitrary -# functions from nbdkit, so this script lists only the symbols we want -# to export. +# nbdkit binary. { - # The functions we want plugins and filters to call. global: - nbdkit_absolute_path; - nbdkit_add_extent; - nbdkit_debug; - nbdkit_error; - nbdkit_export_name; - nbdkit_extents_count; - nbdkit_extents_free; - nbdkit_extents_new; - nbdkit_get_extent; - nbdkit_nanosleep; - nbdkit_parse_bool; - nbdkit_parse_int8_t; - nbdkit_parse_int16_t; - nbdkit_parse_int32_t; - nbdkit_parse_int64_t; - nbdkit_parse_int; - nbdkit_parse_size; - nbdkit_parse_uint8_t; - nbdkit_parse_uint16_t; - nbdkit_parse_uint32_t; - nbdkit_parse_uint64_t; - nbdkit_parse_unsigned; - nbdkit_peer_name; - nbdkit_read_password; - nbdkit_realpath; - nbdkit_set_error; - nbdkit_shutdown; - nbdkit_vdebug; - nbdkit_verror; - + # -D server.* flags must be visible to nbdkit itself. nbdkit_debug_*; # Everything else is hidden. diff --git a/server/plugins.c b/server/plugins.c index fa572a6a..444ba63e 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -460,7 +460,7 @@ plugin_can_cache (struct backend *b, void *handle) * where !errno_is_preserved. */ void -nbdkit_set_error (int err) +do_nbdkit_set_error (int err) { threadlocal_set_error (err); } diff --git a/server/public.c b/server/public.c index 3fd11253..56302bb4 100644 --- a/server/public.c +++ b/server/public.c @@ -30,491 +30,21 @@ * SUCH DAMAGE. */ -/* This file contains the public utility APIs to be exported by nbdkit - * for use by filters and plugins, declared in nbdkit-common.h. - */ - #include <config.h> -#include <fcntl.h> #include <stdio.h> #include <stdlib.h> -#include <stdbool.h> -#include <stdint.h> -#include <inttypes.h> -#include <string.h> #include <unistd.h> +#include <fcntl.h> #include <limits.h> -#include <ctype.h> -#include <termios.h> -#include <errno.h> -#include <poll.h> +#include <time.h> #include <signal.h> #include <sys/socket.h> -#include "get-current-dir-name.h" - #include "internal.h" -char * -nbdkit_absolute_path (const char *path) -{ - CLEANUP_FREE char *pwd = NULL; - char *ret; - - if (path == NULL || *path == '\0') { - nbdkit_error ("cannot convert null or empty path to an absolute path"); - return NULL; - } - - if (*path == '/') { - ret = strdup (path); - if (!ret) { - nbdkit_error ("strdup: %m"); - return NULL; - } - return ret; - } - - pwd = get_current_dir_name (); - if (pwd == NULL) { - nbdkit_error ("get_current_dir_name: %m"); - return NULL; - } - - if (asprintf (&ret, "%s/%s", pwd, path) == -1) { - nbdkit_error ("asprintf: %m"); - return NULL; - } - - return ret; -} - -char * -nbdkit_realpath (const char *path) -{ - char *ret; - - if (path == NULL || *path == '\0') { - nbdkit_error ("cannot resolve a null or empty path"); - return NULL; - } - - ret = realpath (path, NULL); - if (ret == NULL) { - nbdkit_error ("realpath: %s: %m", path); - return NULL; - } - - return ret; -} - -/* Common code for parsing integers. */ -#define PARSE_COMMON_TAIL \ - if (errno != 0) { \ - nbdkit_error ("%s: could not parse number: \"%s\": %m", \ - what, str); \ - return -1; \ - } \ - if (end == str) { \ - nbdkit_error ("%s: empty string where we expected a number", \ - what); \ - return -1; \ - } \ - if (*end) { \ - nbdkit_error ("%s: could not parse number: \"%s\": trailing garbage", \ - what, str); \ - return -1; \ - } \ - \ - if (rp) \ - *rp = r; \ - return 0 - -/* Functions for parsing signed integers. */ int -nbdkit_parse_int (const char *what, const char *str, int *rp) -{ - long r; - char *end; - - errno = 0; - r = strtol (str, &end, 0); -#if INT_MAX != LONG_MAX - if (r < INT_MIN || r > INT_MAX) - errno = ERANGE; -#endif - PARSE_COMMON_TAIL; -} - -int -nbdkit_parse_int8_t (const char *what, const char *str, int8_t *rp) -{ - long r; - char *end; - - errno = 0; - r = strtol (str, &end, 0); - if (r < INT8_MIN || r > INT8_MAX) - errno = ERANGE; - PARSE_COMMON_TAIL; -} - -int -nbdkit_parse_int16_t (const char *what, const char *str, int16_t *rp) -{ - long r; - char *end; - - errno = 0; - r = strtol (str, &end, 0); - if (r < INT16_MIN || r > INT16_MAX) - errno = ERANGE; - PARSE_COMMON_TAIL; -} - -int -nbdkit_parse_int32_t (const char *what, const char *str, int32_t *rp) -{ - long r; - char *end; - - errno = 0; - r = strtol (str, &end, 0); -#if INT32_MAX != LONG_MAX - if (r < INT32_MIN || r > INT32_MAX) - errno = ERANGE; -#endif - PARSE_COMMON_TAIL; -} - -int -nbdkit_parse_int64_t (const char *what, const char *str, int64_t *rp) -{ - long long r; - char *end; - - errno = 0; - r = strtoll (str, &end, 0); -#if INT64_MAX != LONGLONG_MAX - if (r < INT64_MIN || r > INT64_MAX) - errno = ERANGE; -#endif - PARSE_COMMON_TAIL; -} - -/* Functions for parsing unsigned integers. */ - -/* strtou* functions have surprising behaviour if the first character - * (after whitespace) is '-', so reject this early. - */ -#define PARSE_ERROR_IF_NEGATIVE \ - do { \ - while (isspace (*str)) \ - str++; \ - if (*str == '-') { \ - nbdkit_error ("%s: negative numbers are not allowed", what); \ - return -1; \ - } \ - } while (0) - -int -nbdkit_parse_unsigned (const char *what, const char *str, unsigned *rp) -{ - unsigned long r; - char *end; - - PARSE_ERROR_IF_NEGATIVE; - errno = 0; - r = strtoul (str, &end, 0); -#if UINT_MAX != ULONG_MAX - if (r > UINT_MAX) - errno = ERANGE; -#endif - PARSE_COMMON_TAIL; -} - -int -nbdkit_parse_uint8_t (const char *what, const char *str, uint8_t *rp) -{ - unsigned long r; - char *end; - - PARSE_ERROR_IF_NEGATIVE; - errno = 0; - r = strtoul (str, &end, 0); - if (r > UINT8_MAX) - errno = ERANGE; - PARSE_COMMON_TAIL; -} - -int -nbdkit_parse_uint16_t (const char *what, const char *str, uint16_t *rp) -{ - unsigned long r; - char *end; - - PARSE_ERROR_IF_NEGATIVE; - errno = 0; - r = strtoul (str, &end, 0); - if (r > UINT16_MAX) - errno = ERANGE; - PARSE_COMMON_TAIL; -} - -int -nbdkit_parse_uint32_t (const char *what, const char *str, uint32_t *rp) -{ - unsigned long r; - char *end; - - PARSE_ERROR_IF_NEGATIVE; - errno = 0; - r = strtoul (str, &end, 0); -#if UINT32_MAX != ULONG_MAX - if (r > UINT32_MAX) - errno = ERANGE; -#endif - PARSE_COMMON_TAIL; -} - -int -nbdkit_parse_uint64_t (const char *what, const char *str, uint64_t *rp) -{ - unsigned long long r; - char *end; - - PARSE_ERROR_IF_NEGATIVE; - errno = 0; - r = strtoull (str, &end, 0); -#if UINT64_MAX != ULONGLONG_MAX - if (r > UINT64_MAX) - errno = ERANGE; -#endif - PARSE_COMMON_TAIL; -} - -/* Parse a string as a size with possible scaling suffix, or return -1 - * after reporting the error. - */ -int64_t -nbdkit_parse_size (const char *str) -{ - int64_t size; - char *end; - uint64_t scale = 1; - - /* Disk sizes cannot usefully exceed off_t (which is signed) and - * cannot be negative. */ - /* XXX Should we also parse things like '1.5M'? */ - /* XXX Should we allow hex? If so, hex cannot use scaling suffixes, - * because some of them are valid hex digits */ - errno = 0; - size = strtoimax (str, &end, 10); - if (str == end) { - nbdkit_error ("could not parse size string (%s)", str); - return -1; - } - if (size < 0) { - nbdkit_error ("size cannot be negative (%s)", str); - return -1; - } - if (errno) { - nbdkit_error ("size (%s) exceeds maximum value", str); - return -1; - } - - switch (*end) { - /* No suffix */ - case '\0': - end--; /* Safe, since we already filtered out empty string */ - break; - - /* Powers of 1024 */ - case 'e': case 'E': - scale *= 1024; - /* fallthru */ - case 'p': case 'P': - scale *= 1024; - /* fallthru */ - case 't': case 'T': - scale *= 1024; - /* fallthru */ - case 'g': case 'G': - scale *= 1024; - /* fallthru */ - case 'm': case 'M': - scale *= 1024; - /* fallthru */ - case 'k': case 'K': - scale *= 1024; - /* fallthru */ - case 'b': case 'B': - break; - - /* "sectors", ie. units of 512 bytes, even if that's not the real - * sector size */ - case 's': case 'S': - scale = 512; - break; - - default: - nbdkit_error ("could not parse size: unknown suffix '%s'", end); - return -1; - } - - /* XXX Maybe we should support 'MiB' as a synonym for 'M'; and 'MB' - * for powers of 1000, for similarity to GNU tools. But for now, - * anything beyond 'M' is dropped. */ - if (end[1]) { - nbdkit_error ("could not parse size: unknown suffix '%s'", end); - return -1; - } - - if (INT64_MAX / scale < size) { - nbdkit_error ("overflow computing size (%s)", str); - return -1; - } - - return size * scale; -} - -/* Parse a string as a boolean, or return -1 after reporting the error. - */ -int -nbdkit_parse_bool (const char *str) -{ - if (!strcmp (str, "1") || - !strcasecmp (str, "true") || - !strcasecmp (str, "t") || - !strcasecmp (str, "yes") || - !strcasecmp (str, "y") || - !strcasecmp (str, "on")) - return 1; - - if (!strcmp (str, "0") || - !strcasecmp (str, "false") || - !strcasecmp (str, "f") || - !strcasecmp (str, "no") || - !strcasecmp (str, "n") || - !strcasecmp (str, "off")) - return 0; - - nbdkit_error ("could not decipher boolean (%s)", str); - return -1; -} - -/* Read a password from configuration value. */ -static int read_password_from_fd (const char *what, int fd, char **password); - -int -nbdkit_read_password (const char *value, char **password) -{ - int tty, err; - struct termios orig, temp; - ssize_t r; - size_t n; - - *password = NULL; - - /* Read from stdin. */ - if (strcmp (value, "-") == 0) { - printf ("password: "); - - /* Set no echo. */ - tty = isatty (0); - if (tty) { - tcgetattr (0, &orig); - temp = orig; - temp.c_lflag &= ~ECHO; - tcsetattr (0, TCSAFLUSH, &temp); - } - - r = getline (password, &n, stdin); - err = errno; - - /* Restore echo. */ - if (tty) - tcsetattr (0, TCSAFLUSH, &orig); - - /* Complete the printf above. */ - printf ("\n"); - - if (r == -1) { - errno = err; - nbdkit_error ("could not read password from stdin: %m"); - return -1; - } - if (*password && r > 0 && (*password)[r-1] == '\n') - (*password)[r-1] = '\0'; - } - - /* Read from numbered file descriptor. */ - else if (value[0] == '-') { - int fd; - - if (nbdkit_parse_int ("password file descriptor", &value[1], &fd) == -1) - return -1; - if (read_password_from_fd (&value[1], fd, password) == -1) - return -1; - } - - /* Read password from a file. */ - else if (value[0] == '+') { - int fd; - - fd = open (&value[1], O_CLOEXEC | O_RDONLY); - if (fd == -1) { - nbdkit_error ("open %s: %m", &value[1]); - return -1; - } - if (read_password_from_fd (&value[1], fd, password) == -1) - return -1; - } - - /* Parameter is the password. */ - else { - *password = strdup (value); - if (*password == NULL) { - nbdkit_error ("strdup: %m"); - return -1; - } - } - - return 0; -} - -static int -read_password_from_fd (const char *what, int fd, char **password) -{ - FILE *fp; - size_t n; - ssize_t r; - int err; - - fp = fdopen (fd, "r"); - if (fp == NULL) { - nbdkit_error ("fdopen %s: %m", what); - close (fd); - return -1; - } - r = getline (password, &n, fp); - err = errno; - fclose (fp); - if (r == -1) { - errno = err; - nbdkit_error ("could not read password from %s: %m", what); - return -1; - } - - if (*password && r > 0 && (*password)[r-1] == '\n') - (*password)[r-1] = '\0'; - - return 0; -} - -int -nbdkit_nanosleep (unsigned sec, unsigned nsec) +do_nbdkit_nanosleep (unsigned sec, unsigned nsec) { struct timespec ts; @@ -593,7 +123,7 @@ nbdkit_nanosleep (unsigned sec, unsigned nsec) } const char * -nbdkit_export_name (void) +do_nbdkit_export_name (void) { struct connection *conn = threadlocal_get_conn (); @@ -606,7 +136,7 @@ nbdkit_export_name (void) } int -nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen) +do_nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen) { struct connection *conn = threadlocal_get_conn (); int s; diff --git a/server/quit.c b/server/quit.c index 13fef437..9b96d33a 100644 --- a/server/quit.c +++ b/server/quit.c @@ -106,7 +106,7 @@ handle_quit (int sig) } void -nbdkit_shutdown (void) +do_nbdkit_shutdown (void) { set_quit (); } diff --git a/lib/lib.h b/lib/lib.h new file mode 100644 index 00000000..317602ef --- /dev/null +++ b/lib/lib.h @@ -0,0 +1,102 @@ +/* nbdkit + * Copyright (C) 2013-2020 Red Hat Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef NBDKIT_LIB_H +#define NBDKIT_LIB_H + +#include <stdarg.h> +#include <stdbool.h> +#include <sys/types.h> +#include <sys/socket.h> + +typedef const char *(*do_nbdkit_export_name_t) (void); +typedef int (*do_nbdkit_nanosleep_t) (unsigned sec, unsigned nsec); +typedef int (*do_nbdkit_peer_name_t) (struct sockaddr *addr, socklen_t *addrlen); +typedef void (*do_nbdkit_set_error_t) (int err); +typedef void (*do_nbdkit_shutdown_t) (void); +typedef void (*do_nbdkit_verror_t) (const char *fs, va_list args); +typedef const char *(*threadlocal_get_name_t) (void); +typedef size_t (*threadlocal_get_instance_num_t) (void); + +#ifdef IN_NBDKIT_LIB + +/* After nbdkit_private_init is called, these global function pointers + * are set up to point back to the corresponding functions in the + * server. + */ +extern do_nbdkit_export_name_t do_nbdkit_export_name; +extern do_nbdkit_nanosleep_t do_nbdkit_nanosleep; +extern do_nbdkit_peer_name_t do_nbdkit_peer_name; +extern do_nbdkit_set_error_t do_nbdkit_set_error; +extern do_nbdkit_shutdown_t do_nbdkit_shutdown; +extern do_nbdkit_verror_t do_nbdkit_verror; +extern threadlocal_get_name_t threadlocal_get_name; +extern threadlocal_get_instance_num_t threadlocal_get_instance_num; + +/* And a pointer to the verbose flag. */ +extern bool *verbose; + +/* Replacement vfprintf. Awkwardly this is duplicated in server/ too. */ +#if !HAVE_VFPRINTF_PERCENT_M +#include <stdio.h> +#define vfprintf replace_vfprintf +extern int replace_vfprintf (FILE *f, const char *fmt, va_list args) + __attribute__((__format__ (printf, 2, 0))); +#endif + +/* Declare program_name. */ +#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME == 1 +#include <errno.h> +#define program_name program_invocation_short_name +#else +#define program_name "nbdkit" +#endif + +#endif /* IN_NBDKIT_LIB */ + +/* Defines the private function which is used by the server to + * initialize libnbdkit.so at runtime. This ABI may change at any + * time, which is why nbdkit and the corresponding libnbdkit.so must + * always be shipped together. + */ +extern void libnbdkit_private_init (const char *expected_version, + bool *verbose, + do_nbdkit_export_name_t do_nbdkit_export_name, + do_nbdkit_nanosleep_t do_nbdkit_nanosleep, + do_nbdkit_peer_name_t do_nbdkit_peer_name, + do_nbdkit_set_error_t do_nbdkit_set_error, + do_nbdkit_shutdown_t do_nbdkit_shutdown, + do_nbdkit_verror_t do_nbdkit_verror, + threadlocal_get_name_t threadlocal_get_name, + threadlocal_get_instance_num_t threadlocal_get_instance_num); + +#endif /* NBDKIT_LIB_H */ diff --git a/server/debug.c b/lib/debug.c similarity index 98% rename from server/debug.c rename to lib/debug.c index cf511945..261bd712 100644 --- a/server/debug.c +++ b/lib/debug.c @@ -38,7 +38,7 @@ #include <string.h> #include <errno.h> -#include "internal.h" +#include "lib.h" /* Called with flockfile (stderr) taken. */ static void @@ -65,7 +65,7 @@ nbdkit_vdebug (const char *fs, va_list args) { int err = errno; - if (!verbose) + if (!*verbose) return; flockfile (stderr); prologue (); @@ -85,7 +85,7 @@ nbdkit_debug (const char *fs, ...) va_list args; int err = errno; - if (!verbose) + if (!*verbose) return; flockfile (stderr); diff --git a/server/extents.c b/lib/extents.c similarity index 99% rename from server/extents.c rename to lib/extents.c index 2d609652..8e3c8632 100644 --- a/server/extents.c +++ b/lib/extents.c @@ -41,10 +41,10 @@ #include <errno.h> #include <assert.h> +#include "nbdkit-filter.h" + #include "minmax.h" -#include "internal.h" - /* Cap nr_extents to avoid sending over-large replies to the client, * and to avoid a plugin with frequent alternations consuming too much * memory. diff --git a/lib/init.c b/lib/init.c new file mode 100644 index 00000000..ee70607e --- /dev/null +++ b/lib/init.c @@ -0,0 +1,83 @@ +/* nbdkit + * Copyright (C) 2013-2020 Red Hat Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <string.h> + +#include "lib.h" + +bool *verbose; + +do_nbdkit_export_name_t do_nbdkit_export_name; +do_nbdkit_nanosleep_t do_nbdkit_nanosleep; +do_nbdkit_peer_name_t do_nbdkit_peer_name; +do_nbdkit_set_error_t do_nbdkit_set_error; +do_nbdkit_shutdown_t do_nbdkit_shutdown; +do_nbdkit_verror_t do_nbdkit_verror; +threadlocal_get_name_t threadlocal_get_name; +threadlocal_get_instance_num_t threadlocal_get_instance_num; + +void +libnbdkit_private_init (const char *expected_version, + bool *_verbose, + do_nbdkit_export_name_t _do_nbdkit_export_name, + do_nbdkit_nanosleep_t _do_nbdkit_nanosleep, + do_nbdkit_peer_name_t _do_nbdkit_peer_name, + do_nbdkit_set_error_t _do_nbdkit_set_error, + do_nbdkit_shutdown_t _do_nbdkit_shutdown, + do_nbdkit_verror_t _do_nbdkit_verror, + threadlocal_get_name_t _threadlocal_get_name, + threadlocal_get_instance_num_t _threadlocal_get_instance_num) +{ + if (strcmp (expected_version, PACKAGE_VERSION) != 0) { + fprintf (stderr, + "packaging error: " + "nbdkit and libnbdkit.so versions do not match\n"); + abort (); + } + + verbose = _verbose; + + do_nbdkit_export_name = _do_nbdkit_export_name; + do_nbdkit_nanosleep = _do_nbdkit_nanosleep; + do_nbdkit_peer_name = _do_nbdkit_peer_name; + do_nbdkit_set_error = _do_nbdkit_set_error; + do_nbdkit_shutdown = _do_nbdkit_shutdown; + do_nbdkit_verror = _do_nbdkit_verror; + + threadlocal_get_name = _threadlocal_get_name; + threadlocal_get_instance_num = _threadlocal_get_instance_num; +} diff --git a/lib/log.c b/lib/log.c new file mode 100644 index 00000000..f3955c0b --- /dev/null +++ b/lib/log.c @@ -0,0 +1,59 @@ +/* nbdkit + * Copyright (C) 2013-2020 Red Hat Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <errno.h> + +#include "lib.h" + +/* Note: preserves the previous value of errno. */ +void +nbdkit_verror (const char *fs, va_list args) +{ + do_nbdkit_verror (fs, args); +} + +/* Note: preserves the previous value of errno. */ +void +nbdkit_error (const char *fs, ...) +{ + va_list args; + + va_start (args, fs); + nbdkit_verror (fs, args); + va_end (args); +} diff --git a/lib/parse.c b/lib/parse.c new file mode 100644 index 00000000..cd3c88ac --- /dev/null +++ b/lib/parse.c @@ -0,0 +1,341 @@ +/* nbdkit + * Copyright (C) 2013-2019 Red Hat Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <stdint.h> +#include <inttypes.h> +#include <limits.h> +#include <string.h> +#include <ctype.h> + +#include "nbdkit-plugin.h" + +#include "cleanup.h" + +/* Common code for parsing integers. */ +#define PARSE_COMMON_TAIL \ + if (errno != 0) { \ + nbdkit_error ("%s: could not parse number: \"%s\": %m", \ + what, str); \ + return -1; \ + } \ + if (end == str) { \ + nbdkit_error ("%s: empty string where we expected a number", \ + what); \ + return -1; \ + } \ + if (*end) { \ + nbdkit_error ("%s: could not parse number: \"%s\": trailing garbage", \ + what, str); \ + return -1; \ + } \ + \ + if (rp) \ + *rp = r; \ + return 0 + +/* Functions for parsing signed integers. */ +int +nbdkit_parse_int (const char *what, const char *str, int *rp) +{ + long r; + char *end; + + errno = 0; + r = strtol (str, &end, 0); +#if INT_MAX != LONG_MAX + if (r < INT_MIN || r > INT_MAX) + errno = ERANGE; +#endif + PARSE_COMMON_TAIL; +} + +int +nbdkit_parse_int8_t (const char *what, const char *str, int8_t *rp) +{ + long r; + char *end; + + errno = 0; + r = strtol (str, &end, 0); + if (r < INT8_MIN || r > INT8_MAX) + errno = ERANGE; + PARSE_COMMON_TAIL; +} + +int +nbdkit_parse_int16_t (const char *what, const char *str, int16_t *rp) +{ + long r; + char *end; + + errno = 0; + r = strtol (str, &end, 0); + if (r < INT16_MIN || r > INT16_MAX) + errno = ERANGE; + PARSE_COMMON_TAIL; +} + +int +nbdkit_parse_int32_t (const char *what, const char *str, int32_t *rp) +{ + long r; + char *end; + + errno = 0; + r = strtol (str, &end, 0); +#if INT32_MAX != LONG_MAX + if (r < INT32_MIN || r > INT32_MAX) + errno = ERANGE; +#endif + PARSE_COMMON_TAIL; +} + +int +nbdkit_parse_int64_t (const char *what, const char *str, int64_t *rp) +{ + long long r; + char *end; + + errno = 0; + r = strtoll (str, &end, 0); +#if INT64_MAX != LONGLONG_MAX + if (r < INT64_MIN || r > INT64_MAX) + errno = ERANGE; +#endif + PARSE_COMMON_TAIL; +} + +/* Functions for parsing unsigned integers. */ + +/* strtou* functions have surprising behaviour if the first character + * (after whitespace) is '-', so reject this early. + */ +#define PARSE_ERROR_IF_NEGATIVE \ + do { \ + while (isspace (*str)) \ + str++; \ + if (*str == '-') { \ + nbdkit_error ("%s: negative numbers are not allowed", what); \ + return -1; \ + } \ + } while (0) + +int +nbdkit_parse_unsigned (const char *what, const char *str, unsigned *rp) +{ + unsigned long r; + char *end; + + PARSE_ERROR_IF_NEGATIVE; + errno = 0; + r = strtoul (str, &end, 0); +#if UINT_MAX != ULONG_MAX + if (r > UINT_MAX) + errno = ERANGE; +#endif + PARSE_COMMON_TAIL; +} + +int +nbdkit_parse_uint8_t (const char *what, const char *str, uint8_t *rp) +{ + unsigned long r; + char *end; + + PARSE_ERROR_IF_NEGATIVE; + errno = 0; + r = strtoul (str, &end, 0); + if (r > UINT8_MAX) + errno = ERANGE; + PARSE_COMMON_TAIL; +} + +int +nbdkit_parse_uint16_t (const char *what, const char *str, uint16_t *rp) +{ + unsigned long r; + char *end; + + PARSE_ERROR_IF_NEGATIVE; + errno = 0; + r = strtoul (str, &end, 0); + if (r > UINT16_MAX) + errno = ERANGE; + PARSE_COMMON_TAIL; +} + +int +nbdkit_parse_uint32_t (const char *what, const char *str, uint32_t *rp) +{ + unsigned long r; + char *end; + + PARSE_ERROR_IF_NEGATIVE; + errno = 0; + r = strtoul (str, &end, 0); +#if UINT32_MAX != ULONG_MAX + if (r > UINT32_MAX) + errno = ERANGE; +#endif + PARSE_COMMON_TAIL; +} + +int +nbdkit_parse_uint64_t (const char *what, const char *str, uint64_t *rp) +{ + unsigned long long r; + char *end; + + PARSE_ERROR_IF_NEGATIVE; + errno = 0; + r = strtoull (str, &end, 0); +#if UINT64_MAX != ULONGLONG_MAX + if (r > UINT64_MAX) + errno = ERANGE; +#endif + PARSE_COMMON_TAIL; +} + +/* Parse a string as a size with possible scaling suffix, or return -1 + * after reporting the error. + */ +int64_t +nbdkit_parse_size (const char *str) +{ + int64_t size; + char *end; + uint64_t scale = 1; + + /* Disk sizes cannot usefully exceed off_t (which is signed) and + * cannot be negative. */ + /* XXX Should we also parse things like '1.5M'? */ + /* XXX Should we allow hex? If so, hex cannot use scaling suffixes, + * because some of them are valid hex digits */ + errno = 0; + size = strtoimax (str, &end, 10); + if (str == end) { + nbdkit_error ("could not parse size string (%s)", str); + return -1; + } + if (size < 0) { + nbdkit_error ("size cannot be negative (%s)", str); + return -1; + } + if (errno) { + nbdkit_error ("size (%s) exceeds maximum value", str); + return -1; + } + + switch (*end) { + /* No suffix */ + case '\0': + end--; /* Safe, since we already filtered out empty string */ + break; + + /* Powers of 1024 */ + case 'e': case 'E': + scale *= 1024; + /* fallthru */ + case 'p': case 'P': + scale *= 1024; + /* fallthru */ + case 't': case 'T': + scale *= 1024; + /* fallthru */ + case 'g': case 'G': + scale *= 1024; + /* fallthru */ + case 'm': case 'M': + scale *= 1024; + /* fallthru */ + case 'k': case 'K': + scale *= 1024; + /* fallthru */ + case 'b': case 'B': + break; + + /* "sectors", ie. units of 512 bytes, even if that's not the real + * sector size */ + case 's': case 'S': + scale = 512; + break; + + default: + nbdkit_error ("could not parse size: unknown suffix '%s'", end); + return -1; + } + + /* XXX Maybe we should support 'MiB' as a synonym for 'M'; and 'MB' + * for powers of 1000, for similarity to GNU tools. But for now, + * anything beyond 'M' is dropped. */ + if (end[1]) { + nbdkit_error ("could not parse size: unknown suffix '%s'", end); + return -1; + } + + if (INT64_MAX / scale < size) { + nbdkit_error ("overflow computing size (%s)", str); + return -1; + } + + return size * scale; +} + +/* Parse a string as a boolean, or return -1 after reporting the error. + */ +int +nbdkit_parse_bool (const char *str) +{ + if (!strcmp (str, "1") || + !strcasecmp (str, "true") || + !strcasecmp (str, "t") || + !strcasecmp (str, "yes") || + !strcasecmp (str, "y") || + !strcasecmp (str, "on")) + return 1; + + if (!strcmp (str, "0") || + !strcasecmp (str, "false") || + !strcasecmp (str, "f") || + !strcasecmp (str, "no") || + !strcasecmp (str, "n") || + !strcasecmp (str, "off")) + return 0; + + nbdkit_error ("could not decipher boolean (%s)", str); + return -1; +} diff --git a/lib/password.c b/lib/password.c new file mode 100644 index 00000000..8452c153 --- /dev/null +++ b/lib/password.c @@ -0,0 +1,152 @@ +/* nbdkit + * Copyright (C) 2013-2019 Red Hat Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <fcntl.h> +#include <termios.h> + +#include "nbdkit-plugin.h" + +/* Read a password from configuration value. */ + +static int read_password_from_fd (const char *what, int fd, char **password); + +int +nbdkit_read_password (const char *value, char **password) +{ + int tty, err; + struct termios orig, temp; + ssize_t r; + size_t n; + + *password = NULL; + + /* Read from stdin. */ + if (strcmp (value, "-") == 0) { + printf ("password: "); + + /* Set no echo. */ + tty = isatty (0); + if (tty) { + tcgetattr (0, &orig); + temp = orig; + temp.c_lflag &= ~ECHO; + tcsetattr (0, TCSAFLUSH, &temp); + } + + r = getline (password, &n, stdin); + err = errno; + + /* Restore echo. */ + if (tty) + tcsetattr (0, TCSAFLUSH, &orig); + + /* Complete the printf above. */ + printf ("\n"); + + if (r == -1) { + errno = err; + nbdkit_error ("could not read password from stdin: %m"); + return -1; + } + if (*password && r > 0 && (*password)[r-1] == '\n') + (*password)[r-1] = '\0'; + } + + /* Read from numbered file descriptor. */ + else if (value[0] == '-') { + int fd; + + if (nbdkit_parse_int ("password file descriptor", &value[1], &fd) == -1) + return -1; + if (read_password_from_fd (&value[1], fd, password) == -1) + return -1; + } + + /* Read password from a file. */ + else if (value[0] == '+') { + int fd; + + fd = open (&value[1], O_CLOEXEC | O_RDONLY); + if (fd == -1) { + nbdkit_error ("open %s: %m", &value[1]); + return -1; + } + if (read_password_from_fd (&value[1], fd, password) == -1) + return -1; + } + + /* Parameter is the password. */ + else { + *password = strdup (value); + if (*password == NULL) { + nbdkit_error ("strdup: %m"); + return -1; + } + } + + return 0; +} + +static int +read_password_from_fd (const char *what, int fd, char **password) +{ + FILE *fp; + size_t n; + ssize_t r; + int err; + + fp = fdopen (fd, "r"); + if (fp == NULL) { + nbdkit_error ("fdopen %s: %m", what); + close (fd); + return -1; + } + r = getline (password, &n, fp); + err = errno; + fclose (fp); + if (r == -1) { + errno = err; + nbdkit_error ("could not read password from %s: %m", what); + return -1; + } + + if (*password && r > 0 && (*password)[r-1] == '\n') + (*password)[r-1] = '\0'; + + return 0; +} diff --git a/lib/path.c b/lib/path.c new file mode 100644 index 00000000..244c2b0a --- /dev/null +++ b/lib/path.c @@ -0,0 +1,97 @@ +/* nbdkit + * Copyright (C) 2013-2019 Red Hat Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <limits.h> + +#include "nbdkit-plugin.h" + +#include "cleanup.h" +#include "get-current-dir-name.h" + +char * +nbdkit_absolute_path (const char *path) +{ + CLEANUP_FREE char *pwd = NULL; + char *ret; + + if (path == NULL || *path == '\0') { + nbdkit_error ("cannot convert null or empty path to an absolute path"); + return NULL; + } + + if (*path == '/') { + ret = strdup (path); + if (!ret) { + nbdkit_error ("strdup: %m"); + return NULL; + } + return ret; + } + + pwd = get_current_dir_name (); + if (pwd == NULL) { + nbdkit_error ("get_current_dir_name: %m"); + return NULL; + } + + if (asprintf (&ret, "%s/%s", pwd, path) == -1) { + nbdkit_error ("asprintf: %m"); + return NULL; + } + + return ret; +} + +char * +nbdkit_realpath (const char *path) +{ + char *ret; + + if (path == NULL || *path == '\0') { + nbdkit_error ("cannot resolve a null or empty path"); + return NULL; + } + + ret = realpath (path, NULL); + if (ret == NULL) { + nbdkit_error ("realpath: %s: %m", path); + return NULL; + } + + return ret; +} diff --git a/lib/slow.c b/lib/slow.c new file mode 100644 index 00000000..af9ce3ec --- /dev/null +++ b/lib/slow.c @@ -0,0 +1,78 @@ +/* nbdkit + * Copyright (C) 2013-2019 Red Hat Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/socket.h> + +#include "nbdkit-plugin.h" + +#include "lib.h" + +/* Slow functions whose implementation depends on server internals are + * simply bounced into the server. + */ + +const char * +nbdkit_export_name (void) +{ + return do_nbdkit_export_name (); +} + +int +nbdkit_nanosleep (unsigned sec, unsigned nsec) +{ + return do_nbdkit_nanosleep (sec, nsec); +} + +int +nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen) +{ + return do_nbdkit_peer_name (addr, addrlen); +} + +void +nbdkit_set_error (int err) +{ + do_nbdkit_set_error (err); +} + +void +nbdkit_shutdown (void) +{ + do_nbdkit_shutdown (); +} diff --git a/server/test-public.c b/lib/test-public.c similarity index 99% rename from server/test-public.c rename to lib/test-public.c index fe347d44..d680e7ad 100644 --- a/server/test-public.c +++ b/lib/test-public.c @@ -41,7 +41,8 @@ #include <string.h> #include <unistd.h> -#include "internal.h" +#include "nbdkit-plugin.h" +#include "nbdkit-filter.h" static bool error_flagged; diff --git a/lib/vfprintf.c b/lib/vfprintf.c new file mode 100644 index 00000000..6e330a41 --- /dev/null +++ b/lib/vfprintf.c @@ -0,0 +1,65 @@ +/* nbdkit + * Copyright (C) 2013-2018 Red Hat Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <errno.h> + +#include "lib.h" + +#if !HAVE_VFPRINTF_PERCENT_M +/* Work around lack of %m in BSD */ +#undef vfprintf + +/* Call the real vfprintf after first changing %m into strerror(errno). */ +int +replace_vfprintf (FILE *f, const char *fmt, va_list args) +{ + char *repl = NULL; + char *p = strstr (fmt, "%m"); /* assume strstr doesn't touch errno */ + int ret; + + /* We only handle the first %m; if a user passes more than one, they + * deserve broken output. + */ + if (p && asprintf (&repl, "%.*s%s%s", (int) (p - fmt), fmt, strerror (errno), + p + 2) > 0) + fmt = repl; + ret = vfprintf (f, fmt, args); + free (repl); + return ret; +} +#endif diff --git a/wrapper.c b/wrapper.c index 6aef81a1..eb0ba8ba 100644 --- a/wrapper.c +++ b/wrapper.c @@ -168,12 +168,16 @@ main (int argc, char *argv[]) } } - /* Needed for plugins written in OCaml. */ + /* Use libnbdkit.so from lib/. The plugins/ocaml/.libs path is + * needed for plugins written in OCaml. + */ s = getenv ("LD_LIBRARY_PATH"); if (s) - r = asprintf (&s, "%s/plugins/ocaml/.libs:%s", builddir, s); + r = asprintf (&s, "%s/lib/.libs:%s/plugins/ocaml/.libs:%s", + builddir, builddir, s); else - r = asprintf (&s, "%s/plugins/ocaml/.libs", builddir); + r = asprintf (&s, "%s/lib/.libs:%s/plugins/ocaml/.libs", + builddir, builddir); if (r < 0) { perror ("asprintf"); exit (EXIT_FAILURE); @@ -182,9 +186,11 @@ main (int argc, char *argv[]) free (s); s = getenv ("LIBRARY_PATH"); if (s) - r = asprintf (&s, "%s/plugins/ocaml/.libs:%s", builddir, s); + r = asprintf (&s, "%s/lib/.libs:%s/plugins/ocaml/.libs:%s", + builddir, builddir, s); else - r = asprintf (&s, "%s/plugins/ocaml/.libs", builddir); + r = asprintf (&s, "%s/lib/.libs:%s/plugins/ocaml/.libs", + builddir, builddir); if (r < 0) { perror ("asprintf"); exit (EXIT_FAILURE); @@ -193,7 +199,7 @@ main (int argc, char *argv[]) free (s); /* Absolute path of the real nbdkit command. */ - passthru_format ("%s/server/nbdkit", builddir); + passthru_format ("%s/server/.libs/nbdkit", builddir); /* Option parsing. We don't really parse options here. We are only * interested in which options have arguments and which need diff --git a/.gitignore b/.gitignore index 4bb035e1..2f9d45a9 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,7 @@ plugins/*/*.3 /include/nbdkit-version.h /INSTALL /install-sh +/lib/test-public /libtool /ltmain.sh /missing @@ -80,7 +81,6 @@ plugins/*/*.3 /server/nbdkit /server/nbdkit.pc /server/synopsis.c -/server/test-public /stamp-h1 /tests/__pycache__/ /tests/disk diff --git a/lib/libnbdkit.syms b/lib/libnbdkit.syms new file mode 100644 index 00000000..a8a0cb74 --- /dev/null +++ b/lib/libnbdkit.syms @@ -0,0 +1,76 @@ +# nbdkit +# Copyright (C) 2018-2020 Red Hat Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat nor the names of its contributors may be +# used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# This linker script controls the visibility of symbols in the +# libnbdkit.so library. We want to export some symbols to plugins, +# but at the same time we don't want plugins to be able to call +# arbitrary functions from nbdkit, so this script lists only the +# symbols we want to export. + +{ + # The functions we want plugins and filters to call. + global: + nbdkit_absolute_path; + nbdkit_add_extent; + nbdkit_debug; + nbdkit_error; + nbdkit_export_name; + nbdkit_extents_count; + nbdkit_extents_free; + nbdkit_extents_new; + nbdkit_get_extent; + nbdkit_nanosleep; + nbdkit_parse_bool; + nbdkit_parse_int16_t; + nbdkit_parse_int32_t; + nbdkit_parse_int64_t; + nbdkit_parse_int8_t; + nbdkit_parse_int; + nbdkit_parse_size; + nbdkit_parse_uint16_t; + nbdkit_parse_uint32_t; + nbdkit_parse_uint64_t; + nbdkit_parse_uint8_t; + nbdkit_parse_unsigned; + nbdkit_peer_name; + nbdkit_read_password; + nbdkit_realpath; + nbdkit_set_error; + nbdkit_shutdown; + nbdkit_vdebug; + nbdkit_verror; + + # Private function that must only be called by the server. + libnbdkit_private_init; + + # Everything else is hidden. + local: *; +}; -- 2.25.0
Richard W.M. Jones
2020-Mar-26 18:25 UTC
[Libguestfs] [PATCH nbdkit 6/9] tests: Add a regression test that we can still compile with -undefined.
Note that this probably isn't testing anything because at least on Linux the -undefined/-no-undefined flags appear to have no effect on linking. I'm using the -undefined flag here, but this is not actually a flag documented anywhere in the libtool documentation, but I assume it's fine because libtool doesn't complain. --- tests/Makefile.am | 28 ++++++++++++++ tests/test-undefined.sh | 36 ++++++++++++++++++ tests/test-undefined-plugin.c | 70 +++++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index f9c6b8ad..901dca7e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -208,6 +208,7 @@ EXTRA_DIST = \ test-truncate3.sh \ test-truncate4.sh \ test-truncate-extents.sh \ + test-undefined.sh \ test-vddk.sh \ test-vddk-real.sh \ test-version.sh \ @@ -351,6 +352,33 @@ test_just_filter_header_CPPFLAGS = \ $(NULL) test_just_filter_header_CFLAGS = $(WARNINGS_CFLAGS) +# Build a plugin with libtool -undefined flag. This is how plugins +# were built before libnbdkit.so existed. +TESTS += \ + test-undefined.sh \ + $(NULL) +# check_LTLIBRARIES won't build a shared library (see automake manual). +# So we have to do this and add a dependency. +noinst_LTLIBRARIES += test-undefined-plugin.la +test-undefined.sh: test-undefined-plugin.la + +test_undefined_plugin_la_SOURCES = \ + test-undefined-plugin.c \ + $(top_srcdir)/include/nbdkit-plugin.h \ + $(NULL) +test_undefined_plugin_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + $(NULL) +test_undefined_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) +# For use of the -rpath option, see: +# https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html +test_undefined_plugin_la_LDFLAGS = \ + -module -avoid-version -shared \ + -undefined \ + $(SHARED_LDFLAGS) \ + -rpath /nowhere \ + $(NULL) + if CAN_TEST_ANSI_C # This builds a plugin using an ANSI (ISO C90) compiler to ensure that # the header file is compatible. The plugin does nothing very diff --git a/tests/test-undefined.sh b/tests/test-undefined.sh new file mode 100755 index 00000000..db6c8eb8 --- /dev/null +++ b/tests/test-undefined.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# nbdkit +# Copyright (C) 2017-2020 Red Hat Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat nor the names of its contributors may be +# used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +source ./functions.sh +set -e + +nbdkit .libs/test-undefined-plugin.so --version diff --git a/tests/test-undefined-plugin.c b/tests/test-undefined-plugin.c new file mode 100644 index 00000000..42683047 --- /dev/null +++ b/tests/test-undefined-plugin.c @@ -0,0 +1,70 @@ +/* nbdkit + * Copyright (C) 2013-2020 Red Hat Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <nbdkit-plugin.h> + +static void * +undefined_open (int readonly) +{ + return NBDKIT_HANDLE_NOT_NEEDED; +} + +static int64_t +undefined_get_size (void *handle) +{ + return 0; +} + +#define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL + +static int +undefined_pread (void *handle, void *buf, uint32_t count, uint64_t offset) +{ + memset (buf, 0, count); + return 0; +} + +static struct nbdkit_plugin plugin = { + .name = "testundefined", + .version = PACKAGE_VERSION, + .open = undefined_open, + .get_size = undefined_get_size, + .pread = undefined_pread, +}; + +NBDKIT_REGISTER_PLUGIN(plugin) -- 2.25.0
Richard W.M. Jones
2020-Mar-26 18:25 UTC
[Libguestfs] [PATCH nbdkit 7/9] Revert "build: Add -no-undefined flag when linking plugins on mingw."
This reverts commit 6e088df4baa7737f120f854afbff5305e2dc1d6c. --- configure.ac | 9 --------- filters/blocksize/Makefile.am | 2 +- filters/cache/Makefile.am | 2 +- filters/cacheextents/Makefile.am | 2 +- filters/cow/Makefile.am | 2 +- filters/delay/Makefile.am | 2 +- filters/error/Makefile.am | 2 +- filters/exitlast/Makefile.am | 2 +- filters/ext2/Makefile.am | 2 +- filters/extentlist/Makefile.am | 2 +- filters/fua/Makefile.am | 2 +- filters/ip/Makefile.am | 2 +- filters/limit/Makefile.am | 2 +- filters/log/Makefile.am | 2 +- filters/nocache/Makefile.am | 2 +- filters/noextents/Makefile.am | 2 +- filters/nofilter/Makefile.am | 2 +- filters/noparallel/Makefile.am | 2 +- filters/nozero/Makefile.am | 2 +- filters/offset/Makefile.am | 2 +- filters/partition/Makefile.am | 2 +- filters/rate/Makefile.am | 2 +- filters/readahead/Makefile.am | 2 +- filters/retry/Makefile.am | 2 +- filters/stats/Makefile.am | 2 +- filters/truncate/Makefile.am | 2 +- filters/xz/Makefile.am | 2 +- plugins/curl/Makefile.am | 2 +- plugins/data/Makefile.am | 2 +- plugins/eval/Makefile.am | 2 +- plugins/example1/Makefile.am | 2 +- plugins/example2/Makefile.am | 2 +- plugins/example3/Makefile.am | 2 +- plugins/ext2/Makefile.am | 2 +- plugins/file/Makefile.am | 2 +- plugins/floppy/Makefile.am | 2 +- plugins/full/Makefile.am | 2 +- plugins/guestfs/Makefile.am | 2 +- plugins/gzip/Makefile.am | 2 +- plugins/info/Makefile.am | 2 +- plugins/iso/Makefile.am | 2 +- plugins/libvirt/Makefile.am | 2 +- plugins/linuxdisk/Makefile.am | 2 +- plugins/lua/Makefile.am | 2 +- plugins/memory/Makefile.am | 2 +- plugins/nbd/Makefile.am | 2 +- plugins/null/Makefile.am | 2 +- plugins/partitioning/Makefile.am | 2 +- plugins/pattern/Makefile.am | 2 +- plugins/perl/Makefile.am | 2 +- plugins/python/Makefile.am | 2 +- plugins/random/Makefile.am | 2 +- plugins/ruby/Makefile.am | 2 +- plugins/sh/Makefile.am | 2 +- plugins/split/Makefile.am | 2 +- plugins/ssh/Makefile.am | 2 +- plugins/streaming/Makefile.am | 2 +- plugins/tcl/Makefile.am | 2 +- plugins/tmpdisk/Makefile.am | 2 +- plugins/vddk/Makefile.am | 2 +- plugins/zero/Makefile.am | 2 +- tests/Makefile.am | 18 +++++++++--------- 62 files changed, 69 insertions(+), 78 deletions(-) diff --git a/configure.ac b/configure.ac index bf720cec..02cb0839 100644 --- a/configure.ac +++ b/configure.ac @@ -403,15 +403,6 @@ LIBS="$DL_LIBS $LIBS" AC_CHECK_FUNCS([dladdr]) LIBS="$old_LIBS" -dnl On mingw we should enable the -no-undefined flag. -AC_MSG_CHECKING([SHARED_LDFLAGS]) -AS_CASE([$host_os], - [mingw*|msys*|cygwin*], [SHARED_LDFLAGS="$SHARED_LDFLAGS -no-undefined"], - [] -) -AC_MSG_RESULT([$SHARED_LDFLAGS]) -AC_SUBST([SHARED_LDFLAGS]) - AC_SEARCH_LIBS([getaddrinfo], [network socket]) dnl Check for SELinux socket labelling (optional). diff --git a/filters/blocksize/Makefile.am b/filters/blocksize/Makefile.am index 54a09bdb..25d6513b 100644 --- a/filters/blocksize/Makefile.am +++ b/filters/blocksize/Makefile.am @@ -46,7 +46,7 @@ nbdkit_blocksize_filter_la_CPPFLAGS = \ $(NULL) nbdkit_blocksize_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_blocksize_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/cache/Makefile.am b/filters/cache/Makefile.am index 6aa1f7e3..6496df07 100644 --- a/filters/cache/Makefile.am +++ b/filters/cache/Makefile.am @@ -55,7 +55,7 @@ nbdkit_cache_filter_la_CPPFLAGS = \ $(NULL) nbdkit_cache_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_cache_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_cache_filter_la_LIBADD = \ diff --git a/filters/cacheextents/Makefile.am b/filters/cacheextents/Makefile.am index 10d9463d..bd0f47a8 100644 --- a/filters/cacheextents/Makefile.am +++ b/filters/cacheextents/Makefile.am @@ -47,7 +47,7 @@ nbdkit_cacheextents_filter_la_CPPFLAGS = \ $(NULL) nbdkit_cacheextents_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_cacheextents_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_cacheextents_filter_la_LIBADD = \ diff --git a/filters/cow/Makefile.am b/filters/cow/Makefile.am index 2a1fb51a..39532c82 100644 --- a/filters/cow/Makefile.am +++ b/filters/cow/Makefile.am @@ -50,7 +50,7 @@ nbdkit_cow_filter_la_CPPFLAGS = \ $(NULL) nbdkit_cow_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_cow_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_cow_filter_la_LIBADD = \ diff --git a/filters/delay/Makefile.am b/filters/delay/Makefile.am index 59bf64be..1b70b11e 100644 --- a/filters/delay/Makefile.am +++ b/filters/delay/Makefile.am @@ -45,7 +45,7 @@ nbdkit_delay_filter_la_CPPFLAGS = \ $(NULL) nbdkit_delay_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_delay_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/error/Makefile.am b/filters/error/Makefile.am index 6b13a693..3a5aecb5 100644 --- a/filters/error/Makefile.am +++ b/filters/error/Makefile.am @@ -47,7 +47,7 @@ nbdkit_error_filter_la_CPPFLAGS = \ $(NULL) nbdkit_error_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_error_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_error_filter_la_LIBADD = \ diff --git a/filters/exitlast/Makefile.am b/filters/exitlast/Makefile.am index 84f29502..690008f1 100644 --- a/filters/exitlast/Makefile.am +++ b/filters/exitlast/Makefile.am @@ -43,7 +43,7 @@ nbdkit_exitlast_filter_la_SOURCES = \ nbdkit_exitlast_filter_la_CPPFLAGS = -I$(top_srcdir)/include nbdkit_exitlast_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_exitlast_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/ext2/Makefile.am b/filters/ext2/Makefile.am index ff60a421..1fb7ede5 100644 --- a/filters/ext2/Makefile.am +++ b/filters/ext2/Makefile.am @@ -57,7 +57,7 @@ nbdkit_ext2_filter_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_ext2_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/extentlist/Makefile.am b/filters/extentlist/Makefile.am index dc52ee63..88a9afe1 100644 --- a/filters/extentlist/Makefile.am +++ b/filters/extentlist/Makefile.am @@ -47,7 +47,7 @@ nbdkit_extentlist_filter_la_CPPFLAGS = \ $(NULL) nbdkit_extentlist_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_extentlist_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_extentlist_filter_la_LIBADD = \ diff --git a/filters/fua/Makefile.am b/filters/fua/Makefile.am index fa478679..ef249efa 100644 --- a/filters/fua/Makefile.am +++ b/filters/fua/Makefile.am @@ -45,7 +45,7 @@ nbdkit_fua_filter_la_CPPFLAGS = \ $(NULL) nbdkit_fua_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_fua_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/ip/Makefile.am b/filters/ip/Makefile.am index 5f6aa2e8..81842a2e 100644 --- a/filters/ip/Makefile.am +++ b/filters/ip/Makefile.am @@ -47,7 +47,7 @@ nbdkit_ip_filter_la_CPPFLAGS = \ $(NULL) nbdkit_ip_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_ip_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_ip_filter_la_LIBADD = \ diff --git a/filters/limit/Makefile.am b/filters/limit/Makefile.am index 63e6b176..14d53ec4 100644 --- a/filters/limit/Makefile.am +++ b/filters/limit/Makefile.am @@ -46,7 +46,7 @@ nbdkit_limit_filter_la_CPPFLAGS = \ $(NULL) nbdkit_limit_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_limit_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_limit_filter_la_LIBADD = \ diff --git a/filters/log/Makefile.am b/filters/log/Makefile.am index 8c0c8da1..f0762cc0 100644 --- a/filters/log/Makefile.am +++ b/filters/log/Makefile.am @@ -46,7 +46,7 @@ nbdkit_log_filter_la_CPPFLAGS = \ $(NULL) nbdkit_log_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_log_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_log_filter_la_LIBADD = \ diff --git a/filters/nocache/Makefile.am b/filters/nocache/Makefile.am index 21cbb316..68fefdf4 100644 --- a/filters/nocache/Makefile.am +++ b/filters/nocache/Makefile.am @@ -46,7 +46,7 @@ nbdkit_nocache_filter_la_CPPFLAGS = \ $(NULL) nbdkit_nocache_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_nocache_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/noextents/Makefile.am b/filters/noextents/Makefile.am index 46a01861..8e4f905d 100644 --- a/filters/noextents/Makefile.am +++ b/filters/noextents/Makefile.am @@ -45,7 +45,7 @@ nbdkit_noextents_filter_la_CPPFLAGS = \ $(NULL) nbdkit_noextents_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_noextents_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/nofilter/Makefile.am b/filters/nofilter/Makefile.am index bf8ca907..8fb18ffd 100644 --- a/filters/nofilter/Makefile.am +++ b/filters/nofilter/Makefile.am @@ -46,7 +46,7 @@ nbdkit_nofilter_filter_la_CPPFLAGS = \ $(NULL) nbdkit_nofilter_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_nofilter_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/noparallel/Makefile.am b/filters/noparallel/Makefile.am index b246605f..ac15c609 100644 --- a/filters/noparallel/Makefile.am +++ b/filters/noparallel/Makefile.am @@ -46,7 +46,7 @@ nbdkit_noparallel_filter_la_CPPFLAGS = \ $(NULL) nbdkit_noparallel_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_noparallel_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/nozero/Makefile.am b/filters/nozero/Makefile.am index 45344a68..9b8fbeb1 100644 --- a/filters/nozero/Makefile.am +++ b/filters/nozero/Makefile.am @@ -46,7 +46,7 @@ nbdkit_nozero_filter_la_CPPFLAGS = \ $(NULL) nbdkit_nozero_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_nozero_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/offset/Makefile.am b/filters/offset/Makefile.am index 987cd497..70d89c98 100644 --- a/filters/offset/Makefile.am +++ b/filters/offset/Makefile.am @@ -46,7 +46,7 @@ nbdkit_offset_filter_la_CPPFLAGS = \ $(NULL) nbdkit_offset_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_offset_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_offset_filter_la_LIBADD = \ diff --git a/filters/partition/Makefile.am b/filters/partition/Makefile.am index 774608b7..0f95d429 100644 --- a/filters/partition/Makefile.am +++ b/filters/partition/Makefile.am @@ -51,7 +51,7 @@ nbdkit_partition_filter_la_CPPFLAGS = \ $(NULL) nbdkit_partition_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_partition_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_partition_filter_la_LIBADD = \ diff --git a/filters/rate/Makefile.am b/filters/rate/Makefile.am index b392279f..4e749de4 100644 --- a/filters/rate/Makefile.am +++ b/filters/rate/Makefile.am @@ -52,7 +52,7 @@ nbdkit_rate_filter_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_rate_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/readahead/Makefile.am b/filters/readahead/Makefile.am index 491a349d..96fc822c 100644 --- a/filters/readahead/Makefile.am +++ b/filters/readahead/Makefile.am @@ -47,7 +47,7 @@ nbdkit_readahead_filter_la_CPPFLAGS = \ $(NULL) nbdkit_readahead_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_readahead_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_readahead_filter_la_LIBADD = \ diff --git a/filters/retry/Makefile.am b/filters/retry/Makefile.am index 13af1026..86011bb9 100644 --- a/filters/retry/Makefile.am +++ b/filters/retry/Makefile.am @@ -47,7 +47,7 @@ nbdkit_retry_filter_la_CPPFLAGS = \ $(NULL) nbdkit_retry_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_retry_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_retry_filter_la_LIBADD = \ diff --git a/filters/stats/Makefile.am b/filters/stats/Makefile.am index 520b41f3..0c16ded6 100644 --- a/filters/stats/Makefile.am +++ b/filters/stats/Makefile.am @@ -47,7 +47,7 @@ nbdkit_stats_filter_la_CPPFLAGS = \ $(NULL) nbdkit_stats_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_stats_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_stats_filter_la_LIBADD = \ diff --git a/filters/truncate/Makefile.am b/filters/truncate/Makefile.am index d79c2306..38e2047c 100644 --- a/filters/truncate/Makefile.am +++ b/filters/truncate/Makefile.am @@ -47,7 +47,7 @@ nbdkit_truncate_filter_la_CPPFLAGS = \ $(NULL) nbdkit_truncate_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_truncate_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_truncate_filter_la_LIBADD = \ diff --git a/filters/xz/Makefile.am b/filters/xz/Makefile.am index 7391d0a3..3ba9765d 100644 --- a/filters/xz/Makefile.am +++ b/filters/xz/Makefile.am @@ -59,7 +59,7 @@ nbdkit_xz_filter_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_xz_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/plugins/curl/Makefile.am b/plugins/curl/Makefile.am index d9d7d440..6595eb95 100644 --- a/plugins/curl/Makefile.am +++ b/plugins/curl/Makefile.am @@ -53,7 +53,7 @@ nbdkit_curl_plugin_la_LIBADD = \ $(CURL_LIBS) \ $(NULL) nbdkit_curl_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/data/Makefile.am b/plugins/data/Makefile.am index 5fa45ae3..45121bac 100644 --- a/plugins/data/Makefile.am +++ b/plugins/data/Makefile.am @@ -56,7 +56,7 @@ nbdkit_data_plugin_la_CFLAGS = \ $(GNUTLS_CFLAGS) \ $(NULL) nbdkit_data_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_data_plugin_la_LIBADD = \ diff --git a/plugins/eval/Makefile.am b/plugins/eval/Makefile.am index bc5eec64..cfe5541c 100644 --- a/plugins/eval/Makefile.am +++ b/plugins/eval/Makefile.am @@ -67,7 +67,7 @@ nbdkit_eval_plugin_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_eval_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/example1/Makefile.am b/plugins/example1/Makefile.am index c09808b8..c557d3c8 100644 --- a/plugins/example1/Makefile.am +++ b/plugins/example1/Makefile.am @@ -45,7 +45,7 @@ nbdkit_example1_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_example1_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_example1_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/example2/Makefile.am b/plugins/example2/Makefile.am index 908e7625..ebd95377 100644 --- a/plugins/example2/Makefile.am +++ b/plugins/example2/Makefile.am @@ -45,7 +45,7 @@ nbdkit_example2_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_example2_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_example2_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/example3/Makefile.am b/plugins/example3/Makefile.am index b9bc6bc2..bdf6db3c 100644 --- a/plugins/example3/Makefile.am +++ b/plugins/example3/Makefile.am @@ -45,7 +45,7 @@ nbdkit_example3_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_example3_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_example3_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/ext2/Makefile.am b/plugins/ext2/Makefile.am index 8e8616ce..bb799af0 100644 --- a/plugins/ext2/Makefile.am +++ b/plugins/ext2/Makefile.am @@ -53,7 +53,7 @@ nbdkit_ext2_plugin_la_LIBADD = \ $(EXT2FS_LIBS) $(COM_ERR_LIBS) \ $(NULL) nbdkit_ext2_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/file/Makefile.am b/plugins/file/Makefile.am index 7fc40cf4..d0372b3c 100644 --- a/plugins/file/Makefile.am +++ b/plugins/file/Makefile.am @@ -47,7 +47,7 @@ nbdkit_file_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_file_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_file_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_file_plugin_la_LIBADD = \ diff --git a/plugins/floppy/Makefile.am b/plugins/floppy/Makefile.am index 6865e8ee..4ae12e75 100644 --- a/plugins/floppy/Makefile.am +++ b/plugins/floppy/Makefile.am @@ -54,7 +54,7 @@ nbdkit_floppy_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_floppy_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_floppy_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_floppy_plugin_la_LIBADD = \ diff --git a/plugins/full/Makefile.am b/plugins/full/Makefile.am index b4e76bfc..b168439e 100644 --- a/plugins/full/Makefile.am +++ b/plugins/full/Makefile.am @@ -45,7 +45,7 @@ nbdkit_full_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_full_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_full_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/guestfs/Makefile.am b/plugins/guestfs/Makefile.am index 70d627cd..f07db5d2 100644 --- a/plugins/guestfs/Makefile.am +++ b/plugins/guestfs/Makefile.am @@ -55,7 +55,7 @@ nbdkit_guestfs_plugin_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_guestfs_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/gzip/Makefile.am b/plugins/gzip/Makefile.am index 4577f17d..18c3d16b 100644 --- a/plugins/gzip/Makefile.am +++ b/plugins/gzip/Makefile.am @@ -53,7 +53,7 @@ nbdkit_gzip_plugin_la_LIBADD = \ $(ZLIB_LIBS) \ $(NULL) nbdkit_gzip_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/info/Makefile.am b/plugins/info/Makefile.am index f12e8465..442753be 100644 --- a/plugins/info/Makefile.am +++ b/plugins/info/Makefile.am @@ -46,7 +46,7 @@ nbdkit_info_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_info_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_info_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_info_plugin_la_LIBADD = \ diff --git a/plugins/iso/Makefile.am b/plugins/iso/Makefile.am index a0fd337a..69f452c6 100644 --- a/plugins/iso/Makefile.am +++ b/plugins/iso/Makefile.am @@ -49,7 +49,7 @@ nbdkit_iso_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_iso_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_iso_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_iso_plugin_la_LIBADD = \ diff --git a/plugins/libvirt/Makefile.am b/plugins/libvirt/Makefile.am index 719c3bce..a7a78875 100644 --- a/plugins/libvirt/Makefile.am +++ b/plugins/libvirt/Makefile.am @@ -53,7 +53,7 @@ nbdkit_libvirt_plugin_la_LIBADD = \ $(LIBVIRT_LIBS) \ $(NULL) nbdkit_libvirt_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/linuxdisk/Makefile.am b/plugins/linuxdisk/Makefile.am index efe2bc2f..c05a92ad 100644 --- a/plugins/linuxdisk/Makefile.am +++ b/plugins/linuxdisk/Makefile.am @@ -60,7 +60,7 @@ nbdkit_linuxdisk_plugin_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_linuxdisk_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/lua/Makefile.am b/plugins/lua/Makefile.am index a54d1edf..99b32beb 100644 --- a/plugins/lua/Makefile.am +++ b/plugins/lua/Makefile.am @@ -53,7 +53,7 @@ nbdkit_lua_plugin_la_CFLAGS = \ $(LUA_CFLAGS) \ $(NULL) nbdkit_lua_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(LUA_LIBS) \ $(NULL) diff --git a/plugins/memory/Makefile.am b/plugins/memory/Makefile.am index 701c7f2f..029f3f84 100644 --- a/plugins/memory/Makefile.am +++ b/plugins/memory/Makefile.am @@ -47,7 +47,7 @@ nbdkit_memory_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_memory_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_memory_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_memory_plugin_la_LIBADD = \ diff --git a/plugins/nbd/Makefile.am b/plugins/nbd/Makefile.am index 45b3ad88..4f6def32 100644 --- a/plugins/nbd/Makefile.am +++ b/plugins/nbd/Makefile.am @@ -53,7 +53,7 @@ nbdkit_nbd_plugin_la_CFLAGS = \ $(LIBNBD_CFLAGS) \ $(NULL) nbdkit_nbd_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_nbd_plugin_la_LIBADD = \ diff --git a/plugins/null/Makefile.am b/plugins/null/Makefile.am index 9788912b..a75fbb9f 100644 --- a/plugins/null/Makefile.am +++ b/plugins/null/Makefile.am @@ -45,7 +45,7 @@ nbdkit_null_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_null_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_null_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/partitioning/Makefile.am b/plugins/partitioning/Makefile.am index 93211382..c6c32671 100644 --- a/plugins/partitioning/Makefile.am +++ b/plugins/partitioning/Makefile.am @@ -53,7 +53,7 @@ nbdkit_partitioning_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_partitioning_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_partitioning_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_partitioning_plugin_la_LIBADD = \ diff --git a/plugins/pattern/Makefile.am b/plugins/pattern/Makefile.am index d4e55cfb..600861e3 100644 --- a/plugins/pattern/Makefile.am +++ b/plugins/pattern/Makefile.am @@ -46,7 +46,7 @@ nbdkit_pattern_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_pattern_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_pattern_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/perl/Makefile.am b/plugins/perl/Makefile.am index e8918440..a9a07de0 100644 --- a/plugins/perl/Makefile.am +++ b/plugins/perl/Makefile.am @@ -58,7 +58,7 @@ nbdkit_perl_plugin_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_perl_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(PERL_LDOPTS) \ $(NULL) diff --git a/plugins/python/Makefile.am b/plugins/python/Makefile.am index bd400822..b99c5912 100644 --- a/plugins/python/Makefile.am +++ b/plugins/python/Makefile.am @@ -59,7 +59,7 @@ nbdkit_python_plugin_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_python_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(PYTHON_LDFLAGS) \ $(NULL) diff --git a/plugins/random/Makefile.am b/plugins/random/Makefile.am index f414e416..4371e197 100644 --- a/plugins/random/Makefile.am +++ b/plugins/random/Makefile.am @@ -46,7 +46,7 @@ nbdkit_random_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_random_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_random_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/ruby/Makefile.am b/plugins/ruby/Makefile.am index 3ee3cf4d..bf519cbc 100644 --- a/plugins/ruby/Makefile.am +++ b/plugins/ruby/Makefile.am @@ -56,7 +56,7 @@ nbdkit_ruby_plugin_la_LIBADD = \ $(RUBY_LIBS) \ $(NULL) nbdkit_ruby_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(RUBY_LDFLAGS) \ $(NULL) diff --git a/plugins/sh/Makefile.am b/plugins/sh/Makefile.am index 712c491e..5963e3f6 100644 --- a/plugins/sh/Makefile.am +++ b/plugins/sh/Makefile.am @@ -57,7 +57,7 @@ nbdkit_sh_plugin_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_sh_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/split/Makefile.am b/plugins/split/Makefile.am index d8218b9a..ceff3494 100644 --- a/plugins/split/Makefile.am +++ b/plugins/split/Makefile.am @@ -46,7 +46,7 @@ nbdkit_split_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_split_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_split_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_split_plugin_la_LIBADD = \ diff --git a/plugins/ssh/Makefile.am b/plugins/ssh/Makefile.am index f217154c..0b0f140d 100644 --- a/plugins/ssh/Makefile.am +++ b/plugins/ssh/Makefile.am @@ -54,7 +54,7 @@ nbdkit_ssh_plugin_la_LIBADD = \ $(SSH_LIBS) \ $(NULL) nbdkit_ssh_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/streaming/Makefile.am b/plugins/streaming/Makefile.am index 275bca43..eece24c3 100644 --- a/plugins/streaming/Makefile.am +++ b/plugins/streaming/Makefile.am @@ -45,7 +45,7 @@ nbdkit_streaming_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_streaming_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_streaming_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/tcl/Makefile.am b/plugins/tcl/Makefile.am index 8b8489db..3b057245 100644 --- a/plugins/tcl/Makefile.am +++ b/plugins/tcl/Makefile.am @@ -53,7 +53,7 @@ nbdkit_tcl_plugin_la_CFLAGS = \ $(TCL_CFLAGS) \ $(NULL) nbdkit_tcl_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(TCL_LIBS) \ $(NULL) diff --git a/plugins/tmpdisk/Makefile.am b/plugins/tmpdisk/Makefile.am index 34061771..2e487e92 100644 --- a/plugins/tmpdisk/Makefile.am +++ b/plugins/tmpdisk/Makefile.am @@ -46,7 +46,7 @@ nbdkit_tmpdisk_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_tmpdisk_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_tmpdisk_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_tmpdisk_plugin_la_LIBADD = \ diff --git a/plugins/vddk/Makefile.am b/plugins/vddk/Makefile.am index 4785e96c..b806a7d9 100644 --- a/plugins/vddk/Makefile.am +++ b/plugins/vddk/Makefile.am @@ -59,7 +59,7 @@ nbdkit_vddk_plugin_la_LIBADD = \ $(DL_LIBS) \ $(NULL) nbdkit_vddk_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/zero/Makefile.am b/plugins/zero/Makefile.am index 5480a473..38cb270c 100644 --- a/plugins/zero/Makefile.am +++ b/plugins/zero/Makefile.am @@ -44,7 +44,7 @@ nbdkit_zero_plugin_la_CPPFLAGS = \ -I$(top_srcdir)/include nbdkit_zero_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_zero_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) \ + -module -avoid-version -shared \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/tests/Makefile.am b/tests/Makefile.am index 901dca7e..8622440c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -302,7 +302,7 @@ test_flush_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_flush_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) -rpath /nowhere \ + -module -avoid-version -shared -rpath /nowhere \ $(NULL) # check_LTLIBRARIES won't build a shared library (see automake manual). @@ -321,7 +321,7 @@ test_shutdown_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_shutdown_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) -rpath /nowhere \ + -module -avoid-version -shared -rpath /nowhere \ $(NULL) endif HAVE_PLUGINS @@ -403,7 +403,7 @@ test_ansi_c_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_ansi_c_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) -rpath /nowhere \ + -module -avoid-version -shared -rpath /nowhere \ $(NULL) endif CAN_TEST_ANSI_C @@ -429,7 +429,7 @@ test_cxx_plugin_la_CXXFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_cxx_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) -rpath /nowhere \ + -module -avoid-version -shared -rpath /nowhere \ $(NULL) test_cxx_filter_la_SOURCES = \ @@ -443,7 +443,7 @@ test_cxx_filter_la_CXXFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_cxx_filter_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) -rpath /nowhere \ + -module -avoid-version -shared -rpath /nowhere \ $(NULL) endif HAVE_CXX @@ -1054,7 +1054,7 @@ test_layers_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_layers_plugin_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) -rpath /nowhere \ + -module -avoid-version -shared -rpath /nowhere \ $(NULL) test_layers_filter1_la_SOURCES = \ @@ -1066,7 +1066,7 @@ test_layers_filter1_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter1"' # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_layers_filter1_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) -rpath /nowhere \ + -module -avoid-version -shared -rpath /nowhere \ $(NULL) test_layers_filter2_la_SOURCES = \ @@ -1078,7 +1078,7 @@ test_layers_filter2_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter2"' # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_layers_filter2_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) -rpath /nowhere \ + -module -avoid-version -shared -rpath /nowhere \ $(NULL) test_layers_filter3_la_SOURCES = \ @@ -1090,7 +1090,7 @@ test_layers_filter3_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter3"' # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_layers_filter3_la_LDFLAGS = \ - -module -avoid-version -shared $(SHARED_LDFLAGS) -rpath /nowhere \ + -module -avoid-version -shared -rpath /nowhere \ $(NULL) # blocksize filter test. -- 2.25.0
Richard W.M. Jones
2020-Mar-26 18:25 UTC
[Libguestfs] [PATCH nbdkit 8/9] Add -no-undefined when compiling all internal plugins, filters and tests.
(Except for the -undefined test added previously.) We also add -lnbdkit as that is now required when linking using this new method. Note that on Linux at least libtool appears to ignore -no-undefined so actually -lnbdkit is not really required. --- filters/blocksize/Makefile.am | 5 +++- filters/cache/Makefile.am | 3 ++- filters/cacheextents/Makefile.am | 3 ++- filters/cow/Makefile.am | 3 ++- filters/delay/Makefile.am | 5 +++- filters/error/Makefile.am | 3 ++- filters/exitlast/Makefile.am | 5 +++- filters/ext2/Makefile.am | 3 ++- filters/extentlist/Makefile.am | 3 ++- filters/fua/Makefile.am | 5 +++- filters/ip/Makefile.am | 3 ++- filters/limit/Makefile.am | 3 ++- filters/log/Makefile.am | 3 ++- filters/nocache/Makefile.am | 5 +++- filters/noextents/Makefile.am | 5 +++- filters/nofilter/Makefile.am | 5 +++- filters/noparallel/Makefile.am | 5 +++- filters/nozero/Makefile.am | 5 +++- filters/offset/Makefile.am | 3 ++- filters/partition/Makefile.am | 3 ++- filters/rate/Makefile.am | 3 ++- filters/readahead/Makefile.am | 3 ++- filters/retry/Makefile.am | 3 ++- filters/stats/Makefile.am | 3 ++- filters/truncate/Makefile.am | 3 ++- filters/xz/Makefile.am | 3 ++- plugins/curl/Makefile.am | 3 ++- plugins/data/Makefile.am | 3 ++- plugins/eval/Makefile.am | 3 ++- plugins/example1/Makefile.am | 5 +++- plugins/example2/Makefile.am | 5 +++- plugins/example3/Makefile.am | 5 +++- plugins/ext2/Makefile.am | 3 ++- plugins/file/Makefile.am | 3 ++- plugins/floppy/Makefile.am | 3 ++- plugins/full/Makefile.am | 5 +++- plugins/guestfs/Makefile.am | 3 ++- plugins/gzip/Makefile.am | 3 ++- plugins/info/Makefile.am | 3 ++- plugins/iso/Makefile.am | 3 ++- plugins/libvirt/Makefile.am | 3 ++- plugins/linuxdisk/Makefile.am | 3 ++- plugins/lua/Makefile.am | 5 +++- plugins/memory/Makefile.am | 3 ++- plugins/nbd/Makefile.am | 3 ++- plugins/null/Makefile.am | 5 +++- plugins/ocaml/Makefile.am | 4 +++ plugins/partitioning/Makefile.am | 3 ++- plugins/pattern/Makefile.am | 5 +++- plugins/perl/Makefile.am | 3 ++- plugins/python/Makefile.am | 3 ++- plugins/random/Makefile.am | 5 +++- plugins/ruby/Makefile.am | 3 ++- plugins/sh/Makefile.am | 3 ++- plugins/split/Makefile.am | 3 ++- plugins/ssh/Makefile.am | 3 ++- plugins/streaming/Makefile.am | 5 +++- plugins/tcl/Makefile.am | 5 +++- plugins/tmpdisk/Makefile.am | 3 ++- plugins/vddk/Makefile.am | 3 ++- plugins/zero/Makefile.am | 5 +++- tests/Makefile.am | 45 +++++++++++++++++++++++++------- 62 files changed, 200 insertions(+), 69 deletions(-) diff --git a/filters/blocksize/Makefile.am b/filters/blocksize/Makefile.am index 25d6513b..29f3b5c5 100644 --- a/filters/blocksize/Makefile.am +++ b/filters/blocksize/Makefile.am @@ -46,9 +46,12 @@ nbdkit_blocksize_filter_la_CPPFLAGS = \ $(NULL) nbdkit_blocksize_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_blocksize_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) +nbdkit_blocksize_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/filters/cache/Makefile.am b/filters/cache/Makefile.am index 6496df07..5720da18 100644 --- a/filters/cache/Makefile.am +++ b/filters/cache/Makefile.am @@ -55,10 +55,11 @@ nbdkit_cache_filter_la_CPPFLAGS = \ $(NULL) nbdkit_cache_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_cache_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_cache_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/bitmap/libbitmap.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/cacheextents/Makefile.am b/filters/cacheextents/Makefile.am index bd0f47a8..12c584b2 100644 --- a/filters/cacheextents/Makefile.am +++ b/filters/cacheextents/Makefile.am @@ -47,10 +47,11 @@ nbdkit_cacheextents_filter_la_CPPFLAGS = \ $(NULL) nbdkit_cacheextents_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_cacheextents_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_cacheextents_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/cow/Makefile.am b/filters/cow/Makefile.am index 39532c82..ba14a9f6 100644 --- a/filters/cow/Makefile.am +++ b/filters/cow/Makefile.am @@ -50,10 +50,11 @@ nbdkit_cow_filter_la_CPPFLAGS = \ $(NULL) nbdkit_cow_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_cow_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_cow_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/bitmap/libbitmap.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/delay/Makefile.am b/filters/delay/Makefile.am index 1b70b11e..197b0bc1 100644 --- a/filters/delay/Makefile.am +++ b/filters/delay/Makefile.am @@ -45,9 +45,12 @@ nbdkit_delay_filter_la_CPPFLAGS = \ $(NULL) nbdkit_delay_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_delay_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) +nbdkit_delay_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/filters/error/Makefile.am b/filters/error/Makefile.am index 3a5aecb5..b8940dcc 100644 --- a/filters/error/Makefile.am +++ b/filters/error/Makefile.am @@ -47,10 +47,11 @@ nbdkit_error_filter_la_CPPFLAGS = \ $(NULL) nbdkit_error_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_error_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_error_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/exitlast/Makefile.am b/filters/exitlast/Makefile.am index 690008f1..f6e4d1db 100644 --- a/filters/exitlast/Makefile.am +++ b/filters/exitlast/Makefile.am @@ -43,9 +43,12 @@ nbdkit_exitlast_filter_la_SOURCES = \ nbdkit_exitlast_filter_la_CPPFLAGS = -I$(top_srcdir)/include nbdkit_exitlast_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_exitlast_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) +nbdkit_exitlast_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/filters/ext2/Makefile.am b/filters/ext2/Makefile.am index 1fb7ede5..975bd4e0 100644 --- a/filters/ext2/Makefile.am +++ b/filters/ext2/Makefile.am @@ -53,11 +53,12 @@ nbdkit_ext2_filter_la_CFLAGS = \ $(EXT2FS_CFLAGS) $(COM_ERR_CFLAGS) \ $(NULL) nbdkit_ext2_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(EXT2FS_LIBS) $(COM_ERR_LIBS) \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_ext2_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/extentlist/Makefile.am b/filters/extentlist/Makefile.am index 88a9afe1..7edd8ae3 100644 --- a/filters/extentlist/Makefile.am +++ b/filters/extentlist/Makefile.am @@ -47,10 +47,11 @@ nbdkit_extentlist_filter_la_CPPFLAGS = \ $(NULL) nbdkit_extentlist_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_extentlist_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_extentlist_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/fua/Makefile.am b/filters/fua/Makefile.am index ef249efa..c34e1047 100644 --- a/filters/fua/Makefile.am +++ b/filters/fua/Makefile.am @@ -45,9 +45,12 @@ nbdkit_fua_filter_la_CPPFLAGS = \ $(NULL) nbdkit_fua_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_fua_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) +nbdkit_fua_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/filters/ip/Makefile.am b/filters/ip/Makefile.am index 81842a2e..dd6ef58c 100644 --- a/filters/ip/Makefile.am +++ b/filters/ip/Makefile.am @@ -47,10 +47,11 @@ nbdkit_ip_filter_la_CPPFLAGS = \ $(NULL) nbdkit_ip_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_ip_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_ip_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/limit/Makefile.am b/filters/limit/Makefile.am index 14d53ec4..7068f83e 100644 --- a/filters/limit/Makefile.am +++ b/filters/limit/Makefile.am @@ -46,10 +46,11 @@ nbdkit_limit_filter_la_CPPFLAGS = \ $(NULL) nbdkit_limit_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_limit_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_limit_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/log/Makefile.am b/filters/log/Makefile.am index f0762cc0..c66453b9 100644 --- a/filters/log/Makefile.am +++ b/filters/log/Makefile.am @@ -46,10 +46,11 @@ nbdkit_log_filter_la_CPPFLAGS = \ $(NULL) nbdkit_log_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_log_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_log_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/nocache/Makefile.am b/filters/nocache/Makefile.am index 68fefdf4..c0f69e16 100644 --- a/filters/nocache/Makefile.am +++ b/filters/nocache/Makefile.am @@ -46,9 +46,12 @@ nbdkit_nocache_filter_la_CPPFLAGS = \ $(NULL) nbdkit_nocache_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_nocache_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) +nbdkit_nocache_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/filters/noextents/Makefile.am b/filters/noextents/Makefile.am index 8e4f905d..bd8435a1 100644 --- a/filters/noextents/Makefile.am +++ b/filters/noextents/Makefile.am @@ -45,9 +45,12 @@ nbdkit_noextents_filter_la_CPPFLAGS = \ $(NULL) nbdkit_noextents_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_noextents_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) +nbdkit_noextents_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/filters/nofilter/Makefile.am b/filters/nofilter/Makefile.am index 8fb18ffd..fe1dd344 100644 --- a/filters/nofilter/Makefile.am +++ b/filters/nofilter/Makefile.am @@ -46,9 +46,12 @@ nbdkit_nofilter_filter_la_CPPFLAGS = \ $(NULL) nbdkit_nofilter_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_nofilter_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) +nbdkit_nofilter_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/filters/noparallel/Makefile.am b/filters/noparallel/Makefile.am index ac15c609..96855e7e 100644 --- a/filters/noparallel/Makefile.am +++ b/filters/noparallel/Makefile.am @@ -46,9 +46,12 @@ nbdkit_noparallel_filter_la_CPPFLAGS = \ $(NULL) nbdkit_noparallel_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_noparallel_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) +nbdkit_noparallel_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/filters/nozero/Makefile.am b/filters/nozero/Makefile.am index 9b8fbeb1..f9deb561 100644 --- a/filters/nozero/Makefile.am +++ b/filters/nozero/Makefile.am @@ -46,9 +46,12 @@ nbdkit_nozero_filter_la_CPPFLAGS = \ $(NULL) nbdkit_nozero_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_nozero_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) +nbdkit_nozero_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/filters/offset/Makefile.am b/filters/offset/Makefile.am index 70d89c98..cd6b7932 100644 --- a/filters/offset/Makefile.am +++ b/filters/offset/Makefile.am @@ -46,10 +46,11 @@ nbdkit_offset_filter_la_CPPFLAGS = \ $(NULL) nbdkit_offset_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_offset_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_offset_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/partition/Makefile.am b/filters/partition/Makefile.am index 0f95d429..a7612d13 100644 --- a/filters/partition/Makefile.am +++ b/filters/partition/Makefile.am @@ -51,10 +51,11 @@ nbdkit_partition_filter_la_CPPFLAGS = \ $(NULL) nbdkit_partition_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_partition_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_partition_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/rate/Makefile.am b/filters/rate/Makefile.am index 4e749de4..b02df48f 100644 --- a/filters/rate/Makefile.am +++ b/filters/rate/Makefile.am @@ -49,10 +49,11 @@ nbdkit_rate_filter_la_CPPFLAGS = \ $(NULL) nbdkit_rate_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_rate_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_rate_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/filters/readahead/Makefile.am b/filters/readahead/Makefile.am index 96fc822c..190d034c 100644 --- a/filters/readahead/Makefile.am +++ b/filters/readahead/Makefile.am @@ -47,10 +47,11 @@ nbdkit_readahead_filter_la_CPPFLAGS = \ $(NULL) nbdkit_readahead_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_readahead_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_readahead_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/retry/Makefile.am b/filters/retry/Makefile.am index 86011bb9..0fab3242 100644 --- a/filters/retry/Makefile.am +++ b/filters/retry/Makefile.am @@ -47,10 +47,11 @@ nbdkit_retry_filter_la_CPPFLAGS = \ $(NULL) nbdkit_retry_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_retry_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_retry_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/stats/Makefile.am b/filters/stats/Makefile.am index 0c16ded6..3fdb5404 100644 --- a/filters/stats/Makefile.am +++ b/filters/stats/Makefile.am @@ -47,10 +47,11 @@ nbdkit_stats_filter_la_CPPFLAGS = \ $(NULL) nbdkit_stats_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_stats_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_stats_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/truncate/Makefile.am b/filters/truncate/Makefile.am index 38e2047c..de4e13ce 100644 --- a/filters/truncate/Makefile.am +++ b/filters/truncate/Makefile.am @@ -47,10 +47,11 @@ nbdkit_truncate_filter_la_CPPFLAGS = \ $(NULL) nbdkit_truncate_filter_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_truncate_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) nbdkit_truncate_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/filters/xz/Makefile.am b/filters/xz/Makefile.am index 3ba9765d..a48cee6b 100644 --- a/filters/xz/Makefile.am +++ b/filters/xz/Makefile.am @@ -55,11 +55,12 @@ nbdkit_xz_filter_la_CFLAGS = \ $(LIBLZMA_CFLAGS) \ $(NULL) nbdkit_xz_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(LIBLZMA_LIBS) \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_xz_filter_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ $(NULL) diff --git a/plugins/curl/Makefile.am b/plugins/curl/Makefile.am index 6595eb95..221d72f6 100644 --- a/plugins/curl/Makefile.am +++ b/plugins/curl/Makefile.am @@ -50,10 +50,11 @@ nbdkit_curl_plugin_la_CFLAGS = \ $(CURL_CFLAGS) \ $(NULL) nbdkit_curl_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(CURL_LIBS) \ $(NULL) nbdkit_curl_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/data/Makefile.am b/plugins/data/Makefile.am index 45121bac..f2177ebe 100644 --- a/plugins/data/Makefile.am +++ b/plugins/data/Makefile.am @@ -56,10 +56,11 @@ nbdkit_data_plugin_la_CFLAGS = \ $(GNUTLS_CFLAGS) \ $(NULL) nbdkit_data_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_data_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/sparse/libsparse.la \ $(top_builddir)/common/utils/libutils.la \ $(GNUTLS_LIBS) \ diff --git a/plugins/eval/Makefile.am b/plugins/eval/Makefile.am index cfe5541c..2f62be2e 100644 --- a/plugins/eval/Makefile.am +++ b/plugins/eval/Makefile.am @@ -64,10 +64,11 @@ nbdkit_eval_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_eval_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_eval_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_eval_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/example1/Makefile.am b/plugins/example1/Makefile.am index c557d3c8..b3b019c6 100644 --- a/plugins/example1/Makefile.am +++ b/plugins/example1/Makefile.am @@ -45,9 +45,12 @@ nbdkit_example1_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_example1_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_example1_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) +nbdkit_example1_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/plugins/example2/Makefile.am b/plugins/example2/Makefile.am index ebd95377..851b5e88 100644 --- a/plugins/example2/Makefile.am +++ b/plugins/example2/Makefile.am @@ -45,9 +45,12 @@ nbdkit_example2_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_example2_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_example2_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) +nbdkit_example2_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/plugins/example3/Makefile.am b/plugins/example3/Makefile.am index bdf6db3c..d0f776c5 100644 --- a/plugins/example3/Makefile.am +++ b/plugins/example3/Makefile.am @@ -45,9 +45,12 @@ nbdkit_example3_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_example3_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_example3_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) +nbdkit_example3_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/plugins/ext2/Makefile.am b/plugins/ext2/Makefile.am index bb799af0..4b81e773 100644 --- a/plugins/ext2/Makefile.am +++ b/plugins/ext2/Makefile.am @@ -50,10 +50,11 @@ nbdkit_ext2_plugin_la_CFLAGS = \ $(EXT2FS_CFLAGS) $(COM_ERR_CFLAGS) \ $(NULL) nbdkit_ext2_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(EXT2FS_LIBS) $(COM_ERR_LIBS) \ $(NULL) nbdkit_ext2_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/file/Makefile.am b/plugins/file/Makefile.am index d0372b3c..e925e09e 100644 --- a/plugins/file/Makefile.am +++ b/plugins/file/Makefile.am @@ -47,10 +47,11 @@ nbdkit_file_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_file_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_file_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_file_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/plugins/floppy/Makefile.am b/plugins/floppy/Makefile.am index 4ae12e75..72afa4ff 100644 --- a/plugins/floppy/Makefile.am +++ b/plugins/floppy/Makefile.am @@ -54,10 +54,11 @@ nbdkit_floppy_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_floppy_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_floppy_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_floppy_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/regions/libregions.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/plugins/full/Makefile.am b/plugins/full/Makefile.am index b168439e..e172e686 100644 --- a/plugins/full/Makefile.am +++ b/plugins/full/Makefile.am @@ -45,9 +45,12 @@ nbdkit_full_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_full_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_full_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) +nbdkit_full_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/plugins/guestfs/Makefile.am b/plugins/guestfs/Makefile.am index f07db5d2..d3c07b7b 100644 --- a/plugins/guestfs/Makefile.am +++ b/plugins/guestfs/Makefile.am @@ -51,11 +51,12 @@ nbdkit_guestfs_plugin_la_CFLAGS = \ $(LIBGUESTFS_CFLAGS) \ $(NULL) nbdkit_guestfs_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(LIBGUESTFS_LIBS) \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_guestfs_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/gzip/Makefile.am b/plugins/gzip/Makefile.am index 18c3d16b..1480fc6a 100644 --- a/plugins/gzip/Makefile.am +++ b/plugins/gzip/Makefile.am @@ -50,10 +50,11 @@ nbdkit_gzip_plugin_la_CFLAGS = \ $(ZLIB_CFLAGS) \ $(NULL) nbdkit_gzip_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(ZLIB_LIBS) \ $(NULL) nbdkit_gzip_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/info/Makefile.am b/plugins/info/Makefile.am index 442753be..141ef63a 100644 --- a/plugins/info/Makefile.am +++ b/plugins/info/Makefile.am @@ -46,10 +46,11 @@ nbdkit_info_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_info_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_info_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_info_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(NULL) if HAVE_POD diff --git a/plugins/iso/Makefile.am b/plugins/iso/Makefile.am index 69f452c6..2bfd1ea8 100644 --- a/plugins/iso/Makefile.am +++ b/plugins/iso/Makefile.am @@ -49,10 +49,11 @@ nbdkit_iso_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_iso_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_iso_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_iso_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/plugins/libvirt/Makefile.am b/plugins/libvirt/Makefile.am index a7a78875..e1002b68 100644 --- a/plugins/libvirt/Makefile.am +++ b/plugins/libvirt/Makefile.am @@ -50,10 +50,11 @@ nbdkit_libvirt_plugin_la_CFLAGS = \ $(LIBVIRT_CFLAGS) \ $(NULL) nbdkit_libvirt_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(LIBVIRT_LIBS) \ $(NULL) nbdkit_libvirt_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/linuxdisk/Makefile.am b/plugins/linuxdisk/Makefile.am index c05a92ad..c0dbd477 100644 --- a/plugins/linuxdisk/Makefile.am +++ b/plugins/linuxdisk/Makefile.am @@ -55,12 +55,13 @@ nbdkit_linuxdisk_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_linuxdisk_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_linuxdisk_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/gpt/libgpt.la \ $(top_builddir)/common/regions/libregions.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_linuxdisk_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/lua/Makefile.am b/plugins/lua/Makefile.am index 99b32beb..1004253b 100644 --- a/plugins/lua/Makefile.am +++ b/plugins/lua/Makefile.am @@ -53,10 +53,13 @@ nbdkit_lua_plugin_la_CFLAGS = \ $(LUA_CFLAGS) \ $(NULL) nbdkit_lua_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(LUA_LIBS) \ $(NULL) +nbdkit_lua_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/plugins/memory/Makefile.am b/plugins/memory/Makefile.am index 029f3f84..7ddc9a0e 100644 --- a/plugins/memory/Makefile.am +++ b/plugins/memory/Makefile.am @@ -47,10 +47,11 @@ nbdkit_memory_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_memory_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_memory_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_memory_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/sparse/libsparse.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/plugins/nbd/Makefile.am b/plugins/nbd/Makefile.am index 4f6def32..0c17e101 100644 --- a/plugins/nbd/Makefile.am +++ b/plugins/nbd/Makefile.am @@ -53,10 +53,11 @@ nbdkit_nbd_plugin_la_CFLAGS = \ $(LIBNBD_CFLAGS) \ $(NULL) nbdkit_nbd_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_nbd_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(LIBNBD_LIBS) \ $(NULL) diff --git a/plugins/null/Makefile.am b/plugins/null/Makefile.am index a75fbb9f..0fb18714 100644 --- a/plugins/null/Makefile.am +++ b/plugins/null/Makefile.am @@ -45,9 +45,12 @@ nbdkit_null_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_null_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_null_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) +nbdkit_null_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/plugins/ocaml/Makefile.am b/plugins/ocaml/Makefile.am index b9c70bd9..57a923f0 100644 --- a/plugins/ocaml/Makefile.am +++ b/plugins/ocaml/Makefile.am @@ -71,6 +71,10 @@ libnbdkitocaml_la_CFLAGS = \ -fPIC \ $(NULL) +libnbdkitocaml_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) + # The example plugin. noinst_SCRIPTS = nbdkit-ocamlexample-plugin.so nbdkit-ocamlexample-plugin.so: example.cmx libnbdkitocaml.la NBDKit.cmi NBDKit.cmx diff --git a/plugins/partitioning/Makefile.am b/plugins/partitioning/Makefile.am index c6c32671..eb62ce24 100644 --- a/plugins/partitioning/Makefile.am +++ b/plugins/partitioning/Makefile.am @@ -53,10 +53,11 @@ nbdkit_partitioning_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_partitioning_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_partitioning_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_partitioning_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/gpt/libgpt.la \ $(top_builddir)/common/regions/libregions.la \ $(NULL) diff --git a/plugins/pattern/Makefile.am b/plugins/pattern/Makefile.am index 600861e3..03f29a66 100644 --- a/plugins/pattern/Makefile.am +++ b/plugins/pattern/Makefile.am @@ -46,9 +46,12 @@ nbdkit_pattern_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_pattern_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_pattern_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) +nbdkit_pattern_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/plugins/perl/Makefile.am b/plugins/perl/Makefile.am index a9a07de0..f7a6039a 100644 --- a/plugins/perl/Makefile.am +++ b/plugins/perl/Makefile.am @@ -55,10 +55,11 @@ nbdkit_perl_plugin_la_CFLAGS = \ -I$(PERL_ARCHLIB)/CORE \ $(NULL) nbdkit_perl_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_perl_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(PERL_LDOPTS) \ $(NULL) diff --git a/plugins/python/Makefile.am b/plugins/python/Makefile.am index b99c5912..7fb1c440 100644 --- a/plugins/python/Makefile.am +++ b/plugins/python/Makefile.am @@ -55,11 +55,12 @@ nbdkit_python_plugin_la_CFLAGS = \ $(PYTHON_CFLAGS) \ $(NULL) nbdkit_python_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(PYTHON_LIBS) \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_python_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(PYTHON_LDFLAGS) \ $(NULL) diff --git a/plugins/random/Makefile.am b/plugins/random/Makefile.am index 4371e197..49d4bda5 100644 --- a/plugins/random/Makefile.am +++ b/plugins/random/Makefile.am @@ -46,9 +46,12 @@ nbdkit_random_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_random_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_random_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) +nbdkit_random_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/plugins/ruby/Makefile.am b/plugins/ruby/Makefile.am index bf519cbc..7b2bd9dd 100644 --- a/plugins/ruby/Makefile.am +++ b/plugins/ruby/Makefile.am @@ -53,10 +53,11 @@ nbdkit_ruby_plugin_la_CFLAGS = \ $(RUBY_CFLAGS) \ $(NULL) nbdkit_ruby_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(RUBY_LIBS) \ $(NULL) nbdkit_ruby_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(RUBY_LDFLAGS) \ $(NULL) diff --git a/plugins/sh/Makefile.am b/plugins/sh/Makefile.am index 5963e3f6..03086645 100644 --- a/plugins/sh/Makefile.am +++ b/plugins/sh/Makefile.am @@ -54,10 +54,11 @@ nbdkit_sh_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_sh_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_sh_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) nbdkit_sh_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/split/Makefile.am b/plugins/split/Makefile.am index ceff3494..b6747383 100644 --- a/plugins/split/Makefile.am +++ b/plugins/split/Makefile.am @@ -46,10 +46,11 @@ nbdkit_split_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_split_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_split_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_split_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/plugins/ssh/Makefile.am b/plugins/ssh/Makefile.am index 0b0f140d..accd50c8 100644 --- a/plugins/ssh/Makefile.am +++ b/plugins/ssh/Makefile.am @@ -51,10 +51,11 @@ nbdkit_ssh_plugin_la_CFLAGS = \ $(SSH_CFLAGS) \ $(NULL) nbdkit_ssh_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(SSH_LIBS) \ $(NULL) nbdkit_ssh_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/streaming/Makefile.am b/plugins/streaming/Makefile.am index eece24c3..881831ff 100644 --- a/plugins/streaming/Makefile.am +++ b/plugins/streaming/Makefile.am @@ -45,9 +45,12 @@ nbdkit_streaming_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_streaming_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_streaming_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) +nbdkit_streaming_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/plugins/tcl/Makefile.am b/plugins/tcl/Makefile.am index 3b057245..f9221f78 100644 --- a/plugins/tcl/Makefile.am +++ b/plugins/tcl/Makefile.am @@ -53,10 +53,13 @@ nbdkit_tcl_plugin_la_CFLAGS = \ $(TCL_CFLAGS) \ $(NULL) nbdkit_tcl_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(TCL_LIBS) \ $(NULL) +nbdkit_tcl_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/plugins/tmpdisk/Makefile.am b/plugins/tmpdisk/Makefile.am index 2e487e92..1422811e 100644 --- a/plugins/tmpdisk/Makefile.am +++ b/plugins/tmpdisk/Makefile.am @@ -46,10 +46,11 @@ nbdkit_tmpdisk_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_tmpdisk_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_tmpdisk_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) nbdkit_tmpdisk_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(NULL) diff --git a/plugins/vddk/Makefile.am b/plugins/vddk/Makefile.am index b806a7d9..b9ecc8a6 100644 --- a/plugins/vddk/Makefile.am +++ b/plugins/vddk/Makefile.am @@ -55,11 +55,12 @@ nbdkit_vddk_plugin_la_CPPFLAGS = \ $(NULL) nbdkit_vddk_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_vddk_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(top_builddir)/common/utils/libutils.la \ $(DL_LIBS) \ $(NULL) nbdkit_vddk_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) diff --git a/plugins/zero/Makefile.am b/plugins/zero/Makefile.am index 38cb270c..b7555116 100644 --- a/plugins/zero/Makefile.am +++ b/plugins/zero/Makefile.am @@ -44,9 +44,12 @@ nbdkit_zero_plugin_la_CPPFLAGS = \ -I$(top_srcdir)/include nbdkit_zero_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) nbdkit_zero_plugin_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -no-undefined \ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \ $(NULL) +nbdkit_zero_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ + $(NULL) if HAVE_POD diff --git a/tests/Makefile.am b/tests/Makefile.am index 8622440c..34375381 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -302,7 +302,10 @@ test_flush_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_flush_plugin_la_LDFLAGS = \ - -module -avoid-version -shared -rpath /nowhere \ + -module -avoid-version -shared -no-undefined -rpath /nowhere \ + $(NULL) +test_flush_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(NULL) # check_LTLIBRARIES won't build a shared library (see automake manual). @@ -321,7 +324,10 @@ test_shutdown_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_shutdown_plugin_la_LDFLAGS = \ - -module -avoid-version -shared -rpath /nowhere \ + -module -avoid-version -shared -no-undefined -rpath /nowhere \ + $(NULL) +test_shutdown_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(NULL) endif HAVE_PLUGINS @@ -403,7 +409,10 @@ test_ansi_c_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_ansi_c_plugin_la_LDFLAGS = \ - -module -avoid-version -shared -rpath /nowhere \ + -module -avoid-version -shared -no-undefined -rpath /nowhere \ + $(NULL) +test_ansi_c_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(NULL) endif CAN_TEST_ANSI_C @@ -429,7 +438,10 @@ test_cxx_plugin_la_CXXFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_cxx_plugin_la_LDFLAGS = \ - -module -avoid-version -shared -rpath /nowhere \ + -module -avoid-version -shared -no-undefined -rpath /nowhere \ + $(NULL) +test_cxx_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(NULL) test_cxx_filter_la_SOURCES = \ @@ -443,7 +455,10 @@ test_cxx_filter_la_CXXFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_cxx_filter_la_LDFLAGS = \ - -module -avoid-version -shared -rpath /nowhere \ + -module -avoid-version -shared -no-undefined -rpath /nowhere \ + $(NULL) +test_cxx_filter_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(NULL) endif HAVE_CXX @@ -1054,7 +1069,10 @@ test_layers_plugin_la_CFLAGS = $(WARNINGS_CFLAGS) # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_layers_plugin_la_LDFLAGS = \ - -module -avoid-version -shared -rpath /nowhere \ + -module -avoid-version -shared -no-undefined -rpath /nowhere \ + $(NULL) +test_layers_plugin_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(NULL) test_layers_filter1_la_SOURCES = \ @@ -1066,7 +1084,10 @@ test_layers_filter1_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter1"' # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_layers_filter1_la_LDFLAGS = \ - -module -avoid-version -shared -rpath /nowhere \ + -module -avoid-version -shared -no-undefined -rpath /nowhere \ + $(NULL) +test_layers_filter1_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(NULL) test_layers_filter2_la_SOURCES = \ @@ -1078,7 +1099,10 @@ test_layers_filter2_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter2"' # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_layers_filter2_la_LDFLAGS = \ - -module -avoid-version -shared -rpath /nowhere \ + -module -avoid-version -shared -no-undefined -rpath /nowhere \ + $(NULL) +test_layers_filter2_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(NULL) test_layers_filter3_la_SOURCES = \ @@ -1090,7 +1114,10 @@ test_layers_filter3_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter3"' # For use of the -rpath option, see: # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html test_layers_filter3_la_LDFLAGS = \ - -module -avoid-version -shared -rpath /nowhere \ + -module -avoid-version -shared -no-undefined -rpath /nowhere \ + $(NULL) +test_layers_filter3_la_LIBADD = \ + $(top_builddir)/lib/libnbdkit.la \ $(NULL) # blocksize filter test. -- 2.25.0
Richard W.M. Jones
2020-Mar-26 18:25 UTC
[Libguestfs] [PATCH nbdkit 9/9] tests/old-plugins: Add plugin from nbdkit 1.18.2.
This is significant because it's a plugin which was from the last stable release containing undefined symbols (in the internal plugins). $ ldd -r tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so linux-vdso.so.1 (0x00007ffe86cdd000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f551b3e5000) libc.so.6 => /lib64/libc.so.6 (0x00007f551b21b000) /lib64/ld-linux-x86-64.so.2 (0x00007f551b431000) undefined symbol: nbdkit_extents_free (tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so) undefined symbol: nbdkit_add_extent (tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so) undefined symbol: nbdkit_realpath (tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so) undefined symbol: nbdkit_error (tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so) undefined symbol: nbdkit_debug (tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so) --- tests/Makefile.am | 1 + .../x86_64/Linux/v1.18.2/nbdkit-file-plugin.so | Bin 0 -> 28064 bytes 2 files changed, 1 insertion(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index 34375381..f1095be9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1285,6 +1285,7 @@ TESTS += \ test-old-plugins-x86_64-Linux-v1.2.8.sh \ test-old-plugins-x86_64-Linux-v1.8.4.sh \ test-old-plugins-x86_64-Linux-v1.12.8.sh \ + test-old-plugins-x86_64-Linux-v1.18.2.sh \ $(NULL) test-old-plugins-%.sh: diff --git a/tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so b/tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so new file mode 100755 index 0000000000000000000000000000000000000000..b0d93bc4c262cfbd1cf5de4cb9421422730c82c4 GIT binary patch literal 28064 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 Z!C;?1q{qg>I41?Uz-ZZ!khh`Ae*hP%_Hh6J literal 0 HcmV?d00001 -- 2.25.0
On 3/26/20 1:25 PM, Richard W.M. Jones wrote:> This creates libnbdkit.so as discussed in the following thread: > https://www.redhat.com/archives/libguestfs/2020-March/thread.html#00203 > > test-delay-shutdown.sh fails for unclear reasons. > > This series starts by reverting "tests: Don't strand hung nbdkit > processes" which is because several other tests fail randomly unless I > revert this patch. I didn't investigate this yet so it could be > caused by this patch series.Given a log that you showed me, you hit a case where test-nbd-tls-psk.sh hung; with my patch reverted, that hung process just results in an unreaped orphan process left on your machine (so that you could get back to stable testing of the rest of your series), with my patch in place, that hang now turns into a testsuite failure. The fact that the hang is intermittent is still what I'm trying to fix in libnbd/nbdkit (I'm hoping to post patches soon that add the use of gnutls_bye in more places).> > libtool on Linux doesn't appear to care about -undefined/-no-undefined. > See comments in commit messages. > > The patch is kind of ugly TBH. Personally I don't have a problem with > plugins having undefined references that are later resolved to the > main binary, but I understand that Windows is broken in this regard. > > Rich. > >-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Eric Blake
2020-Mar-26 18:39 UTC
Re: [Libguestfs] [PATCH nbdkit 2/9] server: Rename replacement vfprintf function.
On 3/26/20 1:25 PM, Richard W.M. Jones wrote:> As this symbol is never exported from the server, don't call it > "nbdkit_vfprintf". Also move it to a new file to make forthcoming > changes easier. > > Fixes commit 1c230358462c349533062eda9e4072054fda0e21. > --- > server/Makefile.am | 1 + > server/internal.h | 14 +++++----- > server/log.c | 24 ----------------- > server/vfprintf.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 74 insertions(+), 30 deletions(-)Cleanups like this are fine even while the rest of the series is still being polished. ACK. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Eric Blake
2020-Mar-26 18:45 UTC
Re: [Libguestfs] [PATCH nbdkit 3/9] server: Add log_verror function.
On 3/26/20 1:25 PM, Richard W.M. Jones wrote:> Apart from removing a slightly misleading comment, this small > refactoring makes subsequent commits simpler but otherwise doesn't > change anything. > --- > server/internal.h | 3 +++ > server/log.c | 15 ++++++++++----- > 2 files changed, 13 insertions(+), 5 deletions(-) >ACK -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Eric Blake
2020-Mar-26 18:46 UTC
Re: [Libguestfs] [PATCH nbdkit 4/9] vddk: Compile dummy libvixDiskLib.so with -no-undefined on all platforms.
On 3/26/20 1:25 PM, Richard W.M. Jones wrote:> The dummy library can be compiled this way on all platforms since it > doesn't rely on external undefined symbols. > > Reverts commit ba000b469c24ad69604137de975b255bbe70d056. > --- > configure.ac | 9 --------- > tests/Makefile.am | 6 +----- > 2 files changed, 1 insertion(+), 14 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 0a0ac60a..92e0d4e3 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -412,15 +412,6 @@ AS_CASE([$host_os], > AC_MSG_RESULT([$SHARED_LDFLAGS]) > AC_SUBST([SHARED_LDFLAGS]) > > -AC_MSG_CHECKING([if we are on a windows platform]) > -AS_CASE([$host_os], > - [mingw*|msys*|cygwin*], [is_windows=yes], > - [is_windows=no] > -) > -AC_MSG_RESULT([$is_windows])We may end up adding that in later (but here's hoping we don't have to).> -AM_CONDITIONAL([WINDOWS], > - [test "x$is_windows" = "xyes"]) > - > AC_SEARCH_LIBS([getaddrinfo], [network socket]) > > dnl Check for SELinux socket labelling (optional). > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 562558d0..f9c6b8ad 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -833,13 +833,9 @@ libvixDiskLib_la_CXXFLAGS = $(WARNINGS_CFLAGS) > # For use of the -rpath option, see: > # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html > libvixDiskLib_la_LDFLAGS = \ > - -shared -version-number 6:0:0 -rpath /nowhere \ > + -shared -version-number 6:0:0 -no-undefined -rpath /nowhere \ > $(NULL) > > -if WINDOWS > -libvixDiskLib_la_LDFLAGS += -no-undefined > -endif > -ACK. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Eric Blake
2020-Mar-26 19:05 UTC
Re: [Libguestfs] [PATCH nbdkit 6/9] tests: Add a regression test that we can still compile with -undefined.
On 3/26/20 1:25 PM, Richard W.M. Jones wrote:> Note that this probably isn't testing anything because at least on > Linux the -undefined/-no-undefined flags appear to have no effect on > linking. >[skipping review of 5/9 for now, due to its size. I don't know how easy or hard it would be to split it into bisectable pieces: first introducing the library with just the parsing symbols that can be done locally, then adding more symbols, before finally getting to where -no-undefined actually works for plugins. But as you said on IRC, it gets tricky to have to get a half-finished library to still work correctly, so it may be worth leaving that one squashed]> I'm using the -undefined flag here, but this is not actually a flag > documented anywhere in the libtool documentation, but I assume it's > fine because libtool doesn't complain.I'll have to research if it is just ignoring an unknown flag, or actually honoring it (but even if it is ignoring the flag, libtool's default behavior of allowing undefined symbols on Linux is what we are indeed trying to test). This test will have to be conditional on platform (it won't work on mingw); so you may have to revive the configure.ac stuff you chopped out in patch 4.> --- > tests/Makefile.am | 28 ++++++++++++++ > tests/test-undefined.sh | 36 ++++++++++++++++++ > tests/test-undefined-plugin.c | 70 +++++++++++++++++++++++++++++++++++ > 3 files changed, 134 insertions(+) > > diff --git a/tests/Makefile.am b/tests/Makefile.am > index f9c6b8ad..901dca7e 100644 > --- a/tests/Makefile.am> +# Build a plugin with libtool -undefined flag. This is how plugins > +# were built before libnbdkit.so existed. > +TESTS += \ > + test-undefined.sh \ > + $(NULL) >> +# For use of the -rpath option, see: > +# https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html > +test_undefined_plugin_la_LDFLAGS = \ > + -module -avoid-version -shared \ > + -undefined \ > + $(SHARED_LDFLAGS) \ > + -rpath /nowhere \ > + $(NULL)The most important part here is that we did NOT pass in libnbdkit.so on the link line, but it still builds, resulting in a plugin with undefined symbols which can still be loaded by the just-built nbdkit.> +++ b/tests/test-undefined-plugin.c > @@ -0,0 +1,70 @@> + > +#include <config.h>Does our plugin need <config.h>? Or can we omit that to be more like a true out-of-tree plugin that did not opt-in to our library?> +#include <stdio.h> > +#include <stdlib.h> > +#include <string.h> > + > +#include <nbdkit-plugin.h> > + > +static void * > +undefined_open (int readonly) > +{ > + return NBDKIT_HANDLE_NOT_NEEDED;Hmm. I don't see any _use_ of an nbdkit_* function here. It's not enough that this library links without libnbdkit.so, but we need to be testing that when it uses an undefined symbol, such a symbol actually gets provided via the nbdkit binary dlopen()ing this plugin.> +static struct nbdkit_plugin plugin = { > + .name = "testundefined", > + .version = PACKAGE_VERSION, > + .open = undefined_open, > + .get_size = undefined_get_size, > + .pread = undefined_pread, > +};Easiest might be adding a .config callback to test an nbdkit_parse_* function. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Eric Blake
2020-Mar-26 19:09 UTC
Re: [Libguestfs] [PATCH nbdkit 9/9] tests/old-plugins: Add plugin from nbdkit 1.18.2.
On 3/26/20 1:25 PM, Richard W.M. Jones wrote:> This is significant because it's a plugin which was from the last > stable release containing undefined symbols (in the internal plugins). > > $ ldd -r tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so > linux-vdso.so.1 (0x00007ffe86cdd000) > libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f551b3e5000) > libc.so.6 => /lib64/libc.so.6 (0x00007f551b21b000) > /lib64/ld-linux-x86-64.so.2 (0x00007f551b431000) > undefined symbol: nbdkit_extents_free (tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so) > undefined symbol: nbdkit_add_extent (tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so) > undefined symbol: nbdkit_realpath (tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so) > undefined symbol: nbdkit_error (tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so) > undefined symbol: nbdkit_debug (tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so) > --- > tests/Makefile.am | 1 + > .../x86_64/Linux/v1.18.2/nbdkit-file-plugin.so | Bin 0 -> 28064 bytes > 2 files changed, 1 insertion(+)ACK. Of course, this can't go in until we're happy with the rest of the series, but it's a good test to add. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Apparently Analagous Threads
- [PATCH nbdkit 5/9 patch split 1/5] Create libnbdkit.so.
- [PATCH nbdkit 0/9] Port to Windows.
- [PATCH nbdkit 0/13] Port to Windows without using a separate library.
- [PATCH EXPERIMENTAL nbdkit 0/2] Port to Windows using mingw.
- [nbdkit PATCH 0/4] Start using cleanup macros in filters/plugins