libndr: Avoid assigning duplicate versions to symbols

Amitay Isaacs amitay at gmail.com
Tue Oct 20 06:49:18 UTC 2020


Hi,

On freebsd 12, the linking of libndr.so fails with following error:

[ 918/3912] Linking bin/default/librpc/libndr.so
ld: error: duplicate symbol '_ndr_pull_error' in version script
ld: error: duplicate symbol '_ndr_push_error' in version script
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This happened because symbols _ndr_push_error and _ndr_pull_error were
added to abi_match in commit 42ac80fb46cfb485e8c4a26d455fa784fdd1daed.
It generates the following snippet in ndr.vscript.

--------------------
NDR_1.0.0 {
        global:
                _ndr_pull_error;
                _ndr_push_error;
                ndr_print_steal_switch_value;
                ndr_push_steal_switch_value;
} NDR_0.2.1;

NDR_1.0.1 {
        global:
                ndr_*;
                GUID_*;
                _ndr_pull_error;
                _ndr_push_error;
        local:
                ndr_table_*;
                _end;
                __bss_start;
                _edata;
                *;
};
--------------------

Symbols _ndr_push_error and _ndr_pull_error are added to both versions
NDR_1.0.0 and NDR_1.0.1. This does not seem to be a problem for linux
ld.  It seems to ignore the later version assignments to the same
symbol as seen from the objdump:

$ objdump -T bin/default/librpc/libndr.so.1.0.1  | grep _ndr_pu.._error
0000000000012afe g    DF .text    0000000000000162  NDR_1.0.0   _ndr_push_error
0000000000012973 g    DF .text    000000000000018b  NDR_1.0.0   _ndr_pull_error

One solution is to avoid adding specific symbols to abi_match and only
use wildcards in abi_match.  This avoids the need to modify wafsamba
abi_write_vscript() function in samba_abi.py.  Patch is attached that
changes the symbols _ndr_push_error and _ndr_pull_error to wildcard
patterns as _ndr_push_error* and _ndr_pull_error*.

Amitay.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libndr-Avoid-assigning-duplicate-versions-to-symbols.patch
Type: text/x-patch
Size: 1353 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20201020/e6ffd5bb/0001-libndr-Avoid-assigning-duplicate-versions-to-symbols.bin>


More information about the samba-technical mailing list