From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B850A3857BAB; Thu, 11 Aug 2022 09:00:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B850A3857BAB From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99888] Add powerpc ELFv2 support for -fpatchable-function-entry* Date: Thu, 11 Aug 2022 09:00:35 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: linkw at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: linkw 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2022 09:00:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99888 --- Comment #6 from Kewen Lin --- (In reply to Fangrui Song from comment #5) > * There is a restriction on the number of instructions between the functi= on > label and the .localentry directive. > * For -fpatchable-function-entry=3DN[,M], M nops must precede the function > label. >=20 > On aarch64/x86/etc, these nops are consecutive. Personally I think this > condition can be lifted for PowerPC ELFv2. The runtime library will need = to > check st_other or do some instruction inspection, which may be fine. >=20=20 >=20=20 > nop > nop > nop > foo: > .LCF0: > .cfi_startproc > addis 2,12,.TOC.-.LCF0@ha > addi 2,2,.TOC.-.LCF0@l > .localentry foo,.-foo > nop > nop Thanks for the input! With your proposal, the nice thing is that we don't n= eed to bother the count of NOPs between GEP and LEP. But IMHO it seems confusing since we take GEP as function entry when patching preceding NOPs while take= LEP as function entry when patching succeeding NOPs. The acceptable counts of N= OPs in the proposed patch conforms to ELFv2 ABI, I hope runtime library can sur= vive with it.=