Bug 273840

Summary: Core dump with cc compilation
Product: Base System Reporter: wakai.toshiyuki
Component: binAssignee: freebsd-toolchain (Nobody) <toolchain>
Status: Closed Unable to Reproduce    
Severity: Affects Only Me CC: arrowd, dim, toolchain
Priority: --- Keywords: crash
Version: 13.2-RELEASEFlags: linimon: maintainer-feedback? (toolchain)
Hardware: amd64   
OS: Any   

Description wakai.toshiyuki 2023-09-16 06:02:17 UTC
FreeBSD as a guest of VirtualBox7.0.10. The host is Windows 11.
I compiled the following source with cc and it dumped core.

---
wakai@freebsd:~/src/test $ cat test1_1.c
#include <stdio.h>
int main()
{
printf("Hell is filled with amateur musicians.\n");
}
wakai@freebsd:~/src/test $ cc test1_1.c
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /usr/bin/ld --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o a.out /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /tmp/test1_1-2091db.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
 #0 0x00000000021bbde1 (/usr/bin/ld+0x21bbde1)
 #1 0x00000000021ba185 (/usr/bin/ld+0x21ba185)
 #2 0x00000000021bc4e0 (/usr/bin/ld+0x21bc4e0)
 #3 0x00000008268f0b60 (/lib/libthr.so.3+0x19b60)
 #4 0x00000008268f011f (/lib/libthr.so.3+0x1911f)
 #5 0x00007ffffffff8a3 ([vdso]+0x2d3)
 #6 0x0000000001a09e1a (/usr/bin/ld+0x1a09e1a)
 #7 0x0000000001a4f5f0 (/usr/bin/ld+0x1a4f5f0)
 #8 0x00000000019054a9 (/usr/bin/ld+0x19054a9)
 #9 0x00000000018fa262 (/usr/bin/ld+0x18fa262)
#10 0x00000000018f8a5a (/usr/bin/ld+0x18f8a5a)
cc: error: unable to execute command: Bus error (core dumped)
cc: error: linker command failed due to signal (use -v to see invocation)
wakai@freebsd:~/src/test $

---
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-09-17 12:20:49 UTC
If linking hello world (or its equivalent) does not work, I suspect a hardware problem, or in this case, a problem in the VM guest or hypervisor. If this error is reproducible, you could attempt to install the debug symbols during installation, then debug the ld invocation. Alternatively, save the core dump and load that in a debugger.
Comment 2 wakai.toshiyuki 2023-09-18 22:28:23 UTC
(In reply to Dimitry Andric from comment #1)
I do not know how to install debug symbols. Also, at present, I cannot prepare a PC dedicated to FreeBSD. Therefore, I will consider another way to learn C language. Thank you for your advice.