From nobody Wed Apr 23 10:12:56 2025 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZjFKs49pTz5t9kD; Wed, 23 Apr 2025 10:13:05 +0000 (UTC) (envelope-from developer@lorenzosalvadore.it) Received: from mail-4317.protonmail.ch (mail-4317.protonmail.ch [185.70.43.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "protonmail.com", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZjFKr5G9Gz42LY; Wed, 23 Apr 2025 10:13:04 +0000 (UTC) (envelope-from developer@lorenzosalvadore.it) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=lorenzosalvadore.it header.s=protonmail3 header.b=tTojrpKY; dmarc=pass (policy=quarantine) header.from=lorenzosalvadore.it; spf=pass (mx1.freebsd.org: domain of developer@lorenzosalvadore.it designates 185.70.43.17 as permitted sender) smtp.mailfrom=developer@lorenzosalvadore.it DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lorenzosalvadore.it; s=protonmail3; t=1745403182; x=1745662382; bh=0F5mY02+LmQjjOGFQkOy+jzUhthCHcP8uwHIwsGKv4I=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=tTojrpKYhfyuuYvJm5xv73mj44XvIhdq645D3SO1GSGVsA9D1nCa6OS7xWet3aK6C kse+XmCw89SPvUrT5thBJOzW6hv8jNI7LMqiuB4+1iS11wM+aN3FwaJztJIc0k3Q8k icq7EsB/NxuERb9dzVAXHSbCvVgUja//0+Aq6E02zayRNHzuahXEICBVAQk+VevIxH tmgq2fFNbZg9PeQAT+p+TJ4w+5WvwcU2BbiRBb35E6Pc4vJdCNlCXxu8Ytw/ouPCGI m35ce8WDUXaWJbHa2OZA3vpCgOmNJPmgJTlM1dv3jaNZ3SUDe9/hpSRy6uLnfX1jKJ fulCoVa4/3dsg== Date: Wed, 23 Apr 2025 10:12:56 +0000 To: Lorenzo Salvadore From: Lorenzo Salvadore Cc: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: Re: git: 0c397ecd5df6 - main - lang/gcc15-devel: Fix SIGBUS depending on CPUTYPE Message-ID: In-Reply-To: <202504161321.53GDLf4j042452@gitrepo.freebsd.org> References: <202504161321.53GDLf4j042452@gitrepo.freebsd.org> Feedback-ID: 53711648:user:proton X-Pm-Message-ID: e815c0e8a6b81e121c22ad88097761a8395ea968 List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; NEURAL_HAM_MEDIUM(-1.00)[-0.997]; DMARC_POLICY_ALLOW(-0.50)[lorenzosalvadore.it,quarantine]; R_SPF_ALLOW(-0.20)[+ip4:185.70.43.0/24:c]; R_DKIM_ALLOW(-0.20)[lorenzosalvadore.it:s=protonmail3]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[185.70.43.17:from]; MISSING_XM_UA(0.00)[]; ASN(0.00)[asn:62371, ipnet:185.70.43.0/24, country:CH]; ARC_NA(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; MLMMJ_DEST(0.00)[dev-commits-ports-all@FreeBSD.org,dev-commits-ports-main@FreeBSD.org]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; DKIM_TRACE(0.00)[lorenzosalvadore.it:+] X-Rspamd-Queue-Id: 4ZjFKr5G9Gz42LY X-Spamd-Bar: --- On Wednesday, April 16th, 2025 at 15:21, Lorenzo Salvadore wrote: >=20 >=20 > The branch main has been updated by salvadore: >=20 > URL: https://cgit.FreeBSD.org/ports/commit/?id=3D0c397ecd5df61ac9258943c9= f465ba7f937b0a93 >=20 > commit 0c397ecd5df61ac9258943c9f465ba7f937b0a93 > Author: Lorenzo Salvadore salvadore@FreeBSD.org Sorry, I forgot to set the Author field. Real author is Oleg Sidorkin . =20 > AuthorDate: 2025-04-15 12:27:38 +0000 > Commit: Lorenzo Salvadore salvadore@FreeBSD.org >=20 > CommitDate: 2025-04-16 13:20:40 +0000 >=20 > lang/gcc15-devel: Fix SIGBUS depending on CPUTYPE >=20 > Compiling GCC with some CPUTYPE values (e.g. broadwell) result in > breaking some applications (e.g. math/octave, cad/freecad), sending > a SIGBUS. >=20 > The issue is due to GCC generating instructions that require > variables > to be aligned in memory on certain CPUs. Our libthr does not have > the > required alignment so these CPUs fail to execute these instructions. >=20 > The patch disables the generation of such instructions. >=20 > PR: 285711 > Reported by: cracauer > Tested by: cracauer, jbo > --- > lang/gcc15-devel/Makefile | 1 + > lang/gcc15-devel/files/patch-libgcc_unwind.inc | 28 +++++++++++++++++++++= +++++ > 2 files changed, 29 insertions(+) >=20 > diff --git a/lang/gcc15-devel/Makefile b/lang/gcc15-devel/Makefile > index 695c2ebb7552..5caf32b24cd0 100644 > --- a/lang/gcc15-devel/Makefile > +++ b/lang/gcc15-devel/Makefile > @@ -1,5 +1,6 @@ > PORTNAME=3D gcc > PORTVERSION=3D 15.0.1.s20250413 > +PORTREVISION=3D 1 > CATEGORIES=3D lang > MASTER_SITES=3D GCC/snapshots/${DIST_VERSION} > PKGNAMESUFFIX=3D ${SUFFIX}-devel > diff --git a/lang/gcc15-devel/files/patch-libgcc_unwind.inc b/lang/gcc15-= devel/files/patch-libgcc_unwind.inc > new file mode 100644 > index 000000000000..42155a9ba48e > --- /dev/null > +++ b/lang/gcc15-devel/files/patch-libgcc_unwind.inc > @@ -0,0 +1,28 @@ > +GCC generates instructions that require variables to be aligned in memor= y on > +certain CPUs. Our libthr does not have the required alignment so these C= PUs fail > +to execute these instructions. The instructions generation is driven by = CPUTYPE. > +Some CPUs are fine to execute these instructions on unaligned data. > + > +This patch explicitly forbids GCC to generate instructions that require > +alignment of the data. > + > +If the entire program is compiled by LLVM or GCC, there is no problem (w= ith GCC > +everything is aligned, with LLVM vmovdqa is not used to assign both vari= ables > +at once). > + > +Linux does not have libthr, so Linux is not affected. Moreover Linux is = likely > +to build everything with GCC. > + > +--- libgcc/unwind.inc.orig 2025-04-12 08:18:17 UTC > ++++ libgcc/unwind.inc > +@@ -212,8 +212,8 @@ _Unwind_ForcedUnwind (struct _Unwind_Exception *exc, > + uw_init_context (&this_context); > + cur_context =3D this_context; > + > +- exc->private_1 =3D (_Unwind_Ptr) stop; >=20 > +- exc->private_2 =3D (_Unwind_Ptr) stop_argument; >=20 > ++ __builtin_memcpy(&exc->private_1, &stop, sizeof(_Unwind_Ptr)); >=20 > ++ __builtin_memcpy(&exc->private_2, &stop_argument, sizeof(_Unwind_Ptr))= ; >=20 > + > + code =3D _Unwind_ForcedUnwind_Phase2 (exc, &cur_context, &frames); > + if (code !=3D _URC_INSTALL_CONTEXT)