libndr: Avoid assigning duplicate versions to symbols

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


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

[ 918/3912] Linking bin/default/librpc/
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 {
} NDR_0.2.1;

NDR_1.0.1 {

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/  | 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  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*.

-------------- 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: <>

More information about the samba-technical mailing list