Bug 284441 - lang/gcc and -static option lead to segfaults
Summary: lang/gcc and -static option lead to segfaults
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Lorenzo Salvadore
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-29 17:46 UTC by sgk
Modified: 2025-02-04 08:17 UTC (History)
3 users (show)

See Also:
salvadore: maintainer-feedback+


Attachments
Patch for lang/gcc14 (778 bytes, patch)
2025-01-30 20:51 UTC, sgk
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sgk 2025-01-29 17:46:31 UTC
I recently reported an issue with lang/gcc14 and static linking.  The email trail
is here:

https://lists.freebsd.org/archives/freebsd-hackers/2025-January/004236.html

kib has fixed FreeBSD to avoid the issue, and commit a change to top-of-tree:

https://lists.freebsd.org/archives/dev-commits-src-main/2025-January/029575.html

dim has provided a patch for lang/gcc14 and I've tested that patch with 
top-of-tree gcc sources.  He sent the patch to GCC here:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118685

If there is soemone involved with the lang/gccXX ports and they have commit
access to gcc git repository, you may want to commit the change.

For this report, I know lang/gcc14. Other ports may also have a problem.
Comment 1 sgk 2025-01-30 20:51:11 UTC
Created attachment 257135 [details]
Patch for lang/gcc14

To move this along, here's a patch for lang/gcc14.
Comment 2 Lorenzo Salvadore freebsd_committer freebsd_triage 2025-01-31 08:52:08 UTC
Thanks for the patch, which is definitely helpful!

I am going to test it and commit it to all the GCC ports. I am going to start with the -devel ports, then if everything is all right I will move to the production ports. I believe it will not take long.
Comment 3 commit-hook freebsd_committer freebsd_triage 2025-02-04 08:17:28 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=aac6274e7a2e0d07771a1989be1ad73d2844afba

commit aac6274e7a2e0d07771a1989be1ad73d2844afba
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-02-02 08:20:42 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2025-02-04 08:16:34 +0000

    lang/gcc14-devel: Fix segfaults for static binaries

    Fix segmentation faults caused by -static flag into compiled binaries.

    Email thread: https://lists.freebsd.org/archives/freebsd-hackers/2025-January/004236.html
    Upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118685

    PR:             284441
    Reported by:    kargl

 lang/gcc14-devel/Makefile                             |  1 +
 lang/gcc14-devel/files/patch-libgcc-config.host (new) | 11 +++++++++++
 2 files changed, 12 insertions(+)
Comment 4 commit-hook freebsd_committer freebsd_triage 2025-02-04 08:17:30 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=07afa7646b3889d74a77e1f0206b350404baca4a

commit 07afa7646b3889d74a77e1f0206b350404baca4a
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-02-03 16:01:00 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2025-02-04 08:16:35 +0000

    lang/gcc15-devel: Fix segfaults for static binaries

    Fix segmentation faults caused by -static flag into compiled binaries.

    Email thread: https://lists.freebsd.org/archives/freebsd-hackers/2025-January/004236.html
    Upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118685

    PR:             284441
    Reported by:    kargl

 lang/gcc15-devel/Makefile                             |  1 +
 lang/gcc15-devel/files/patch-libgcc-config.host (new) | 11 +++++++++++
 2 files changed, 12 insertions(+)
Comment 5 commit-hook freebsd_committer freebsd_triage 2025-02-04 08:17:31 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=168cb3d94f79d676bb4155c15dcfcf6a48756b6d

commit 168cb3d94f79d676bb4155c15dcfcf6a48756b6d
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-01-31 09:34:06 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2025-02-04 08:16:33 +0000

    lang/gcc12-devel: Fix segfaults for static binaries

    Fix segmentation faults caused by -static flag into compiled binaries.

    Email thread: https://lists.freebsd.org/archives/freebsd-hackers/2025-January/004236.html
    Upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118685

    PR:             284441
    Reported by:    kargl

 lang/gcc12-devel/Makefile                             |  1 +
 lang/gcc12-devel/files/patch-libgcc-config.host (new) | 11 +++++++++++
 2 files changed, 12 insertions(+)
Comment 6 commit-hook freebsd_committer freebsd_triage 2025-02-04 08:17:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=670c92d6ac8df54055d4403d51d287a5d75cd93b

commit 670c92d6ac8df54055d4403d51d287a5d75cd93b
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-02-01 10:41:25 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2025-02-04 08:16:33 +0000

    lang/gcc13-devel: Fix segfaults for static binaries

    Fix segmentation faults caused by -static flag into compiled binaries.

    Email thread: https://lists.freebsd.org/archives/freebsd-hackers/2025-January/004236.html
    Upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118685

    PR:             284441
    Reported by:    kargl

 lang/gcc13-devel/Makefile                             |  1 +
 lang/gcc13-devel/files/patch-libgcc-config.host (new) | 11 +++++++++++
 2 files changed, 12 insertions(+)