From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DF50E3858CDB; Sat, 30 Dec 2023 20:20:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF50E3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703967603; bh=cxIjscWUwXEWyH5jqXQjq0EcX/D8Q1ZL9rMfUeD6KFU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vUuhVhRq69d+C0Hc5l8GJiROyu22jZM5yyLvIMqGYDdBYCUazd8Bbv/1sib2JT/XC PTNwrNbRy3BMGdqyOjm7uomXGzvIt4Pwi5EHbDyw2k6RBuAwdi8ngCE+Q0VM/FJVzL sNAyhF8eN9I92o1RKlo3gnZACNVmbzgTO/pbnCtg= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/113183] LTO crashes with Segmentation fault Date: Sat, 30 Dec 2023 20:20:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113183 --- Comment #12 from Andrew Pinski --- (In reply to Sebastian Unger from comment #11) > I see. It was the SORT_BY_INIT_PRIORITY with the section name used not > actually having a priority that triggered it, was it?! If I change the > section name to .init_array.1 then it works. >=20 > But, yes, you suggestion using the constructor attribute is even better. >=20 > Thank you very much. >=20 > I suspect it would still be better to not crash though. ;-) Changing the linker script to: ``` .preinit_array : { KEEP(*(SORT_BY_INIT_PRIORITY(".preinit_array.*"))) KEEP (*(.preinit_array)) } >"LOADER_REGION" __preinit_array_start =3D ADDR(.preinit_array); __preinit_array_end =3D ADDR(.preinit_array) + SIZEOF(.preinit_array); .init_array : { KEEP(*(SORT_BY_INIT_PRIORITY(".init_array.*"))) KEEP (*(.init_array)) } >"LOADER_REGION" ``` Also fixes the ICE if you don't want to change to use the constructor attribute.=