Can you generate a backtrace on the system itself, with full debug info? It seems to be some issue in the dynamic linker, ld-elf.so.1, but lldb and gdb have different opinions on the backtrace:
$ lldb -f make_hash -c make_hash.core
(lldb) target create "make_hash" --core "make_hash.core"
Core file '/home/dim/tmp/make_hash.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'make_hash', stop reason = signal SIGSEGV
* frame #0: 0x0000000800611e36 ld-elf.so.1`lm_add(p="", f="", t="") at libmap.c:344
frame #1: 0x0000000800604bc4 ld-elf.so.1`_rtld(sp=0x0000000000000000, exit_proc=0x0000000000000000, objp=0x0000000000000000) at rtld.c:570
$ gdb ./make_hash make_hash.core
GNU gdb (GDB) 8.0 [GDB v8.0 for FreeBSD]
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd12.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>\.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>\.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./make_hash...(no debugging symbols found)...done.
[New LWP 100141]
warning: Unexpected size of section `.reg-xstate/100141' in core file.
warning: .dynamic section for "/lib/libc.so.7" is not at the expected address (wrong library or version mismatch?)
warning: .dynamic section for "/libexec/ld-elf.so.1" is not at the expected address (wrong library or version mismatch?)
Core was generated by `make_hash'.
Program terminated with signal SIGSEGV, Segmentation fault.
warning: Unexpected size of section `.reg-xstate/100141' in core file.
#0 0x0000000800611e36 in setup (list1=0x4007f0 "\330\035`",
list2=0x8d3c9ed3 <error: Cannot access memory at address 0x8d3c9ed3>, n=<optimized out>, size=34366166016,
cmp=<optimized out>) at /usr/src/lib/libc/stdlib/merge.c:320
320 reverse(f1, f2-size);
(gdb) bt
#0 0x0000000800611e36 in setup (list1=0x4007f0 "\330\035`",
list2=0x8d3c9ed3 <error: Cannot access memory at address 0x8d3c9ed3>, n=<optimized out>, size=34366166016,
cmp=<optimized out>) at /usr/src/lib/libc/stdlib/merge.c:320
#1 mergesort (base=0x4007f0, nmemb=<optimized out>, size=<optimized out>, cmp=0x7fffffffa940)
at /usr/src/lib/libc/stdlib/merge.c:144
#2 0x0000000800604bc4 in free_tls (tls=<optimized out>, tcbalign=8, tcbsize=<optimized out>)
at /usr/src/libexec/rtld-elf/rtld.c:4833
#3 allocate_tls (objs=0x0, oldtls=0x80081e628 <iswcntrl_l+16>, tcbsize=<optimized out>, tcbalign=<optimized out>)
at /usr/src/libexec/rtld-elf/rtld.c:4803
#4 0x00000008006032a9 in symlook_list (objlist=<optimized out>, req=<optimized out>, dlp=<optimized out>)
at /usr/src/libexec/rtld-elf/rtld.c:4120
#5 do_dlsym (handle=<optimized out>, name=<optimized out>, retaddr=<optimized out>, ve=<optimized out>, flags=2)
at /usr/src/libexec/rtld-elf/rtld.c:3466
Backtrace stopped: Cannot access memory at address 0x8
-Dimitry