From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 00415385C422; Fri, 30 Sep 2022 12:18:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 00415385C422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664540315; bh=gaxZ0QNQVDYQutMKMl8l265cNRQiACpmlTOvQnNxQrM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WscznC3dNP4cvJY6Jc9m5/HTcF43lLI8e015hN2axh4LDcyLumXr1+MkV6Zd88QFy 4wTvNIsOQjuTjeWZz5IViybwvRIM6HTmSOvANORFUTixdpmvVfEr+wlHfY1FM5IQdb 2syIUsNeWq/wqB0W+1WrqrUt/QvSp8ZU5FAqMlQk= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99888] Add powerpc ELFv2 support for -fpatchable-function-entry* Date: Fri, 30 Sep 2022 12:18:32 +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: cvs-commit 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99888 --- Comment #12 from CVS Commits --- The master branch has been updated by Kewen Lin : https://gcc.gnu.org/g:c23b5006d3ffeda1a9edf5fd817765a6da3696ca commit r13-2984-gc23b5006d3ffeda1a9edf5fd817765a6da3696ca Author: Kewen Lin Date: Fri Sep 30 07:16:49 2022 -0500 rs6000: Rework ELFv2 support for -fpatchable-function-entry* [PR99888] As PR99888 and its related show, the current support for -fpatchable-function-entry on powerpc ELFv2 doesn't work well with global entry existence. For example, with one command line option -fpatchable-function-entry=3D3,2, it got below w/o this patch: .LPFE1: nop nop .type foo, @function foo: nop .LFB0: .cfi_startproc .LCF0: 0: addis 2,12,.TOC.-.LCF0@ha addi 2,2,.TOC.-.LCF0@l .localentry foo,.-foo , the assembly is unexpected since the patched nops have no effects when being entered from local entry. This patch is to update the nops patched before and after local entry, it looks like: .type foo, @function foo: .LFB0: .cfi_startproc .LCF0: 0: addis 2,12,.TOC.-.LCF0@ha addi 2,2,.TOC.-.LCF0@l nop nop .localentry foo,.-foo nop PR target/99888 PR target/105649 gcc/ChangeLog: * doc/invoke.texi (option -fpatchable-function-entry): Adjust t= he documentation for PowerPC ELFv2 ABI dual entry points. * config/rs6000/rs6000-internal.h (rs6000_print_patchable_function_entry): New function declarati= on. * config/rs6000/rs6000-logue.cc (rs6000_output_function_prologu= e): Support patchable-function-entry by emitting nops before and af= ter local entry for the function that needs global entry. * config/rs6000/rs6000.cc (rs6000_print_patchable_function_entr= y): Skip the function that needs global entry till global entry has been emitted. * config/rs6000/rs6000.h (struct machine_function): New bool me= mber global_entry_emitted. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr99888-1.c: New test. * gcc.target/powerpc/pr99888-2.c: New test. * gcc.target/powerpc/pr99888-3.c: New test. * gcc.target/powerpc/pr99888-4.c: New test. * gcc.target/powerpc/pr99888-5.c: New test. * gcc.target/powerpc/pr99888-6.c: New test. * c-c++-common/patchable_function_entry-default.c: Adjust for powerpc_elfv2 to avoid compilation error.=