[Libguestfs] [PATCH libnbd] lib: Use symbol versions.

Richard W.M. Jones rjones at redhat.com
Sat Jul 27 13:19:47 UTC 2019


This patch adds support for symbol versions.  It is based on what
libvirt does.

The generated syms file looks like:

LIBNBD_1.0 {
  global:
    nbd_...;
    nbd_...;
  local: *;
};

In a future stable 1.2 release, new symbols would go into a new
section which would look like this:

LIBNBD_1.2 {
  global:
    nbd_new_symbol;
    nbd_another_new_symbol;
  local: *;
} LIBNBD_1.0;

In my testing the ‘local:’ label is needed.  For some reason libvirt
doesn’t use it.

The change appears to be working in as much as I can see the symbol
versions appearing, and the test/example programs continue to run.

$ nm -D --with-symbol-versions lib/.libs/libnbd.so.0 | grep LIBNBD
0000000000000000 A LIBNBD_1.0@@LIBNBD_1.0
0000000000005470 T nbd_add_meta_context@@LIBNBD_1.0
00000000000085d0 T nbd_aio_block_status@@LIBNBD_1.0
0000000000008710 T nbd_aio_block_status_callback@@LIBNBD_1.0
0000000000008110 T nbd_aio_cache@@LIBNBD_1.0
0000000000008230 T nbd_aio_cache_callback@@LIBNBD_1.0
00000000000089e0 T nbd_aio_command_completed@@LIBNBD_1.0
0000000000006f20 T nbd_aio_connect@@LIBNBD_1.0
0000000000007320 T nbd_aio_connect_command@@LIBNBD_1.0
[etc]

$ nm -D --with-symbol-versions examples/.libs/glib-main-loop | grep LIBNBD
                 U nbd_aio_connect_command at LIBNBD_1.0
                 U nbd_aio_get_direction at LIBNBD_1.0
                 U nbd_aio_get_fd at LIBNBD_1.0
                 U nbd_aio_in_flight at LIBNBD_1.0
                 U nbd_aio_is_ready at LIBNBD_1.0
                 U nbd_aio_notify_read at LIBNBD_1.0
                 U nbd_aio_notify_write at LIBNBD_1.0
                 U nbd_aio_peek_command_completed at LIBNBD_1.0
                 U nbd_aio_pread_callback at LIBNBD_1.0
                 U nbd_aio_pwrite_callback at LIBNBD_1.0
                 U nbd_close at LIBNBD_1.0
                 U nbd_create at LIBNBD_1.0
                 U nbd_get_debug at LIBNBD_1.0
                 U nbd_get_error at LIBNBD_1.0

Rich.





More information about the Libguestfs mailing list