[Bug 236165] crash in malloc with ld.lld and -Wl,--export-dynamic -static

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Mar 2 18:58:45 UTC 2019


            Bug ID: 236165
           Summary: crash in malloc with ld.lld and -Wl,--export-dynamic
           Product: Base System
           Version: 12.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: andrew at 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"). This
consistently drops a core on 12-stable (tested at r344237) but apparently not
on 11-stable. Tested on amd64 and armv7.

dlopen is not actually implicated in the issue: it can be reproduced with only

#include <stdlib.h>
int main()
  return 0;

cc -g -Wl,--export-dynamic -static testprog.c
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.

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

More information about the freebsd-bugs mailing list