Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 02 Mar 2019 18:58:42 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 236165] crash in malloc with ld.lld and -Wl,--export-dynamic -static
Message-ID:  <bug-236165-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236165

            Bug ID: 236165
           Summary: crash in malloc with ld.lld and -Wl,--export-dynamic
                    -static
           Product: Base System
           Version: 12.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: andrew@tao11.riddles.org.uk

The combination of -Wl,--export-dynamic and -static is used by some Autoconf
tests ("checking whether a statically linked program can dlopen itself"). T=
his
consistently drops a core on 12-stable (tested at r344237) but apparently n=
ot
on 11-stable. Tested on amd64 and armv7.

dlopen is not actually implicated in the issue: it can be reproduced with o=
nly
this:

#include <stdlib.h>
int main()
{
  malloc(1);
  return 0;
}

cc -g -Wl,--export-dynamic -static testprog.c
./a.out
segmentation fault (core dumped)  ./a.out

The problem seems to be that the a.out is actually dynamic in spite of the
-static option, but it still has libc.a statically linked into it. With ld.=
bfd,
the a.out comes out as static and there is no coredump.

I doubt this is breaking any real code, but it generates a lot of worrying
logfile entries when building ports.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236165-227>