[Bug 274211] lang/tcc: Crashes with SIGSEGV on 14.x / 15.0-CURRENT when compiling hello world

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 05 Oct 2023 06:51:01 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274211

--- Comment #4 from Paul Floyd <pjfloyd@wanadoo.fr> ---
As I see it there are 2 possible fixes.

At the crash

        if (sh->sh_type == SHT_RELX) {
            s->sh_info = sm_table[sh->sh_info].s->sh_num;

sh is referring to section header 4 for which a new section was created.
sh->sh_info refers to section header 3 which got skipped.

So either the above code needs changing to something like

        if (sh->sh_type == SHT_RELX) {
            if (sm_table[sh->sh_info].new_section) {
                s->sh_info = sm_table[sh->sh_info].s->sh_num;

Or section header 3 needs to be handled so that sm_table[3] has been
initialized.

Trying the easy one as above, I get lots of errors in /usr/include/sys/_types.h
because it seems like tcc does not know the size of any builtin types.

I also tried "hello world" on FreeBSD 13.2 amd64 and it compiled but the exe
coredumps between _start() and main().

From what I see in the port git history there was a code fix back in 2015.
Otherwise totally dead.

In the github history a lot has changed.

I don't think that it is worth trying to patch the ports version 0_9_26. It
would probably be easier to switch to the upstream 9.28

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