Date: Mon, 02 Oct 2023 11:14:43 +0000 From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 274211] lang/tcc: Crashes with SIGSEGV on 14.x / 15.0-CURRENT when compiling hello world Message-ID: <bug-274211-7788@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D274211 Bug ID: 274211 Summary: lang/tcc: Crashes with SIGSEGV on 14.x / 15.0-CURRENT when compiling hello world Product: Ports & Packages Version: Latest Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: ports-bugs@FreeBSD.org Reporter: freebsd@igalic.co given the following hello.c: ``` #include <stdio.h> int main (int argc, const char **argv) { printf("Hello, World!\n"); return 0; } ``` when invoking tcc to compile a binary (tcc -o hello hello.c) we get a SIGSEGV in tcc_load_object_file. Here's the full lldb output, with= tcc compiled with `-O0 -g`: ``` meena@defbix /u/p/l/t/w/tinycc-release_0_9_26 =E2=9D=AF=E2=9D=AF=E2=9D=AF l= ldb ./tcc -- /home/meena/src/hello.c -o hello (lldb) target create "./tcc" Current executable set to '/usr/ports/lang/tcc/work/tinycc-release_0_9_26/t= cc' (x86_64). (lldb) settings set -- target.run-args "/home/meena/src/hello.c" "-o" "hel= lo" (lldb) run Process 20766 launched: '/usr/ports/lang/tcc/work/tinycc-release_0_9_26/tcc' (x86_64) Process 20766 stopped * thread #1, name =3D 'tcc', stop reason =3D signal SIGSEGV: invalid addres= s (fault address: 0x1c) frame #0: 0x000000000022aa26 tcc`tcc_load_object_file(s1=3D0x00002e6d3ec09000, fd=3D3, file_offset=3D0) = at tccelf.c:2533:51 2530 if (sh->sh_link > 0) 2531 s->link =3D sm_table[sh->sh_link].s; 2532 if (sh->sh_type =3D=3D SHT_RELX) { -> 2533 s->sh_info =3D sm_table[sh->sh_info].s->sh_num; 2534 /* update backward link */ 2535 s1->sections[s->sh_info]->reloc =3D s; 2536 } (lldb) bt all * thread #1, name =3D 'tcc', stop reason =3D signal SIGSEGV: invalid addres= s (fault address: 0x1c) * frame #0: 0x000000000022aa26 tcc`tcc_load_object_file(s1=3D0x00002e6d3ec09000, fd=3D3, file_offset=3D0) = at tccelf.c:2533:51 frame #1: 0x00000000002112fe tcc`tcc_add_file_internal(s1=3D0x00002e6d3ec09000, filename=3D"/usr/lib/crt= 1.o", flags=3D0) at libtcc.c:1181:19 frame #2: 0x0000000000211538 tcc`tcc_add_library_internal(s=3D0x00002e6d3ec09000, fmt=3D"%s/%s", filename=3D"crt1.o", flags=3D0, paths=3D0x00002e6d3ec08010, nb_paths=3D1) at libtcc.c:1254:13 frame #3: 0x00000000002115bf tcc`tcc_add_crt(s=3D0x00002e6d3ec09000, filename=3D"crt1.o") at libtcc.c:1270:15 frame #4: 0x0000000000211864 tcc`tcc_set_output_type(s=3D0x00002e6d3ec0= 9000, output_type=3D1) at libtcc.c:1360:13 frame #5: 0x000000000020e6a3 tcc`main(argc=3D4, argv=3D0x0000000820c887= 78) at tcc.c:302:5 frame #6: 0x0000000822e9dbea libc.so.7`__libc_start1(argc=3D4, argv=3D0x0000000820c88778, env=3D0x0000000820c887a0, cleanup=3D<unavailable= >, mainX=3D(tcc`main at tcc.c:245)) at libc_start1.c:157:7 frame #7: 0x000000000020e3c0 tcc`_start at crt1_s.S:83 (lldb)=20 ``` n.b.: Given that this bug only occurs on 14.x / 15.0-CURRENT, chances are t= hat it's got something to do with recent libc/csu changes. also note that setting ARCHLEVEL=3Dscalar doesn't change the behaviour. --=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-274211-7788>