From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 97C1B3858D32; Fri, 5 Jan 2024 01:31:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 97C1B3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704418278; bh=fpL7+/aUX8H+6lw2c39O75NJEirpUory/LiVPkhjJqY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nwqsGSE5tXdwrhWa1awd2aVCznZradPtrz48VNcPjMOWLsJ9gbykAt9XAOqoBpnDv w6btcdfE8oRxmdrRpoqtsahtmvIz8HKOR+vgGQF2Q+ZIUGczQTkEsxVJz5/HWMf5UA G/2c5DfOdFaapl1jCzZT16QkJ13bj4LNr5slH694= From: "yangyujie at loongson dot cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113233] LoongArch: target options from LTO objects not respected during linking Date: Fri, 05 Jan 2024 01:31:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yangyujie at loongson dot cn X-Bugzilla-Status: NEW 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=3D113233 --- Comment #6 from Yang Yujie --- (In reply to Xi Ruoyao from comment #4) > (In reply to Jan Hubicka from comment #3) > > > Confirm. But option save/restore has been always implemented: > > >=20 > > > .section .gnu.lto_.opts,"",@progbits > > > .ascii "'-fno-openmp' '-fno-openacc' '-fno-pie' '-fcf-protection" > > > .ascii "=3Dnone' '-mabi=3Dlp64d' '-march=3Dloongarch64' '-mfpu= =3D64' '-m" > > > .ascii "simd=3Dlasx' '-mcmodel=3Dnormal' '-mtune=3Dloongarch64' = '-flto" > > > .ascii "'\000" > > >=20 > > > So -msimd=3Dlasx is correctly recorded. Not sure why it does not wor= k. > >=20 > > With LTO we need to mix code compiled with different sets of options. > > For this reason we imply for every function defition and optimization > > and target attribute which record the flags. So it seems target > > attribute is likely broken for this flag. >=20 > Target attribute is not implemented for LoongArch. And I don't think it'= s a > good idea to implement it in stage 3. Yes, target attribute may have to wait. But save/restore can be implemented without target attributes of functions. By marking options as "Save" in .o= pt or implementing custom TARGET_OPTION_{SAVE,RESTORE} hooks, we can stream the target configuration (which may come from the command line / the target attributes / #pragma GCC target) into the per-function LTO bytecode, so that lto1 can pick up and use them later when generating code for each function.=