libndr: Avoid assigning duplicate versions to symbols
Amitay Isaacs
amitay at gmail.com
Wed Oct 21 02:42:22 UTC 2020
On Tue, Oct 20, 2020 at 7:08 PM Andreas Schneider <asn at samba.org> wrote:
>
> On Tuesday, 20 October 2020 08:49:18 CEST Amitay Isaacs via samba-technical
> wrote:
> > 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*.
>
> This looks fine for me, but I think we need a bug for 4.13 for that?
>
https://bugzilla.samba.org/show_bug.cgi?id=14541
https://gitlab.com/samba-team/samba/-/merge_requests/1623
Amitay.
More information about the samba-technical
mailing list