Bug 1599441 - Failed to link testing program with error: multiple definition of `_end'
Summary: Failed to link testing program with error: multiple definition of `_end'
Keywords:
Status: CLOSED DUPLICATE of bug 1599521
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Nick Clifton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1600035
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-09 20:19 UTC by Lukas Slebodnik
Modified: 2018-07-12 21:27 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-07-12 21:27:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
A patch for samba (4.58 KB, patch)
2018-07-12 17:03 UTC, H.J. Lu
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1600035 0 unspecified CLOSED FreeIPA's ipa-kdb compile error "multiple definition of `_end'" 2021-02-22 00:41:40 UTC

Internal Links: 1600035

Description Lukas Slebodnik 2018-07-09 20:19:36 UTC
Description of problem:
The latest upgrade of binutils in rawhide caused failures when linking testing programs in autoconf.

Version-Release number of selected component (if applicable):
sh$ rpm -q binutils
binutils-2.30.90-1.fc29.x86_64

How reproducible:
Deterministic

Steps to Reproduce:
1. dnf install -y binutils gcc samba-devel
2. sh$ $ cat >conftest.c <<EOF                                                                                                                                           #include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <tevent.h>
#include <core/ntstatus.h>

struct winbindd_domain;

/* overwrite some winbind internal functions */
struct winbindd_domain *find_domain_from_name(const char *domain_name)
{
    return NULL;
}

bool get_global_winbindd_state_offline(void) {
    return false;
}

struct tevent_context *winbind_event_context(void)
{
    return NULL;
}

struct idmap_methods;

NTSTATUS smb_register_idmap(int version, const char *name, struct idmap_methods *methods);

int main(void)
{
    int v;
    NTSTATUS ret;

    /* Check the versions we know about */
    for (v = 5; v <= 6; v++) {
        ret = smb_register_idmap(v, NULL, NULL);
        if (!NT_STATUS_EQUAL(ret, NT_STATUS_OBJECT_TYPE_MISMATCH)) {
            return v;
        }
    }

    return -1;
}
EOF 

3. gcc -o conftest -g3 -O2 -Werror -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 conftest.c  -L/usr/lib64/samba -lidmap-samba4 -Wl,-rpath /usr/lib64/samba
4. echo $?

Actual results:
sh$ gcc -o conftest -g3 -O2 -Werror -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1  -I/usr/include/samba-4.0   conftest.c  -L/usr/lib64/samba -lidmap-samba4 -Wl,-rpath /usr/lib64/samba
/usr/bin/ld: //usr/lib64/libsamba-util.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamba-passdb.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamba-passdb.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsamba-passdb.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libsamba-errors.so.1:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamba-errors.so.1:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsmbconf.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsmbconf.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libsmbconf.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamdb.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libsamdb.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamdb.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsamba-credentials.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsamba-credentials.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libsamba-credentials.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamba-hostconfig.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsamba-hostconfig.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamba-hostconfig.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libndr-standard.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libtevent-util.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libtevent-util.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libndr-nbt.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libndr-nbt.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libndr-krb5pac.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libndr-krb5pac.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libndr-krb5pac.so.0:(*IND*+0x0): multiple definition of `__bss_start'
collect2: error: ld returned 1 exit status

Expected results:
sh$ gcc -o conftest -g3 -O2 -Werror -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1  -I/usr/include/samba-4.0   conftest.c  -L/usr/lib64/samba -lidmap-samba4 -Wl,-rpath /usr/lib64/samba

sh$ ./conftest 
Failed to register idmap module.
The module was compiled against SMB_IDMAP_INTERFACE_VERSION 5,
current SMB_IDMAP_INTERFACE_VERSION is 6.
Please recompile against the current version of samba!
Called with NULL pointer or empty name!

sh$ echo $?
6

Comment 1 Nick Clifton 2018-07-10 14:08:17 UTC
Hi Lukas,

  I think that this is BZ #1599521 in another form.  Please try
  binutils-2.30.90-2.fc29 and let me know if that fixes the problem
  for you.

Cheers
  Nick

Comment 2 Lukas Slebodnik 2018-07-10 15:38:18 UTC
I am not sure that it is the same issue.

sh$ rpm -q binutils
binutils-2.30.90-2.fc29.x86_64

sh$ cat >conftest.c <<EOF                                                                                                                                           #include <stdlib.h>
> #include <stdint.h>
> #include <stdbool.h>
> #include <tevent.h>
> #include <core/ntstatus.h>
>
> struct winbindd_domain;
>
> /* overwrite some winbind internal functions */
> struct winbindd_domain *find_domain_from_name(const char *domain_name)
> {
>     return NULL;
> }
>
> bool get_global_winbindd_state_offline(void) {
>     return false;
> }
>
> struct tevent_context *winbind_event_context(void)
> {
>     return NULL;
> }
>
> struct idmap_methods;
>
> NTSTATUS smb_register_idmap(int version, const char *name, struct idmap_methods *methods);
>
> int main(void)
> {
>     int v;
>     NTSTATUS ret;
>
>     /* Check the versions we know about */
>     for (v = 5; v <= 6; v++) {
>         ret = smb_register_idmap(v, NULL, NULL);
>         if (!NT_STATUS_EQUAL(ret, NT_STATUS_OBJECT_TYPE_MISMATCH)) {
>             return v;
>         }
>     }
>
>     return -1;
> }
> EOF

sh$ gcc -o conftest -g3 -O2 -Werror -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 conftest.c  -L/usr/lib64/samba -lidmap-samba4 -Wl,-rpath /usr/lib64/samba
/usr/bin/ld: //usr/lib64/libsamba-util.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamba-passdb.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamba-passdb.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsamba-passdb.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libsamba-errors.so.1:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamba-errors.so.1:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsmbconf.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsmbconf.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libsmbconf.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamdb.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libsamdb.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamdb.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsamba-credentials.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsamba-credentials.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libsamba-credentials.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamba-hostconfig.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libsamba-hostconfig.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libsamba-hostconfig.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libndr-standard.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libtevent-util.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libtevent-util.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libndr-nbt.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libndr-nbt.so.0:(*IND*+0x0): multiple definition of `__bss_start'
/usr/bin/ld: //usr/lib64/libndr-krb5pac.so.0:(*IND*+0x0): multiple definition of `_edata'
/usr/bin/ld: //usr/lib64/libndr-krb5pac.so.0:(*IND*+0x0): multiple definition of `_end'
/usr/bin/ld: //usr/lib64/libndr-krb5pac.so.0:(*IND*+0x0): multiple definition of `__bss_start'
collect2: error: ld returned 1 exit status

Comment 3 Nick Clifton 2018-07-11 09:43:20 UTC
Hi Lukas,

> I am not sure that it is the same issue.

> sh$ gcc -o conftest -g3 -O2 -Werror -I/usr/include/samba-4.0 -D_GNU_SOURCE=1
> conftest.c  -L/usr/lib64/samba -lidmap-samba4 -Wl,-rpath /usr/lib64/samba
> /usr/bin/ld: //usr/lib64/libsamba-util.so.0:(*IND*+0x0): multiple definition
> of `_end'

The multiple definitions are all coming from the samba libraries, right ?

I think that what has happened is that the samba-lib package was rebuilt with
the linker from the binutils-2.30.90-1.fc29, which inserted all these bogus
extra symbols.  So now you are seeing problems when you try to link against
those libraries.  If the samba-lib package were to be rebuilt with the linker
from the binutils-2.30.90-2.fc29 then I think that the problem would go away.
Luckily there is a mass rebuild starting today...

If the problem still exists when the rebuild is over then:
 a) I will have to investigate some more
 b) lots of people will be angry with me. :-(

Cheers
  Nick

Comment 4 H.J. Lu 2018-07-12 17:03:10 UTC
Created attachment 1458475 [details]
A patch for samba

This is a gold bug.  Don't use gold to build samba.

Comment 5 Lukas Slebodnik 2018-07-12 21:27:49 UTC
I can confirm that it is a duplicate of BZ #1599521
(samba bug was unrelated)

*** This bug has been marked as a duplicate of bug 1599521 ***


Note You need to log in before you can comment on or make changes to this bug.