public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/96493] New: powerpc local call linkage failure
@ 2020-08-06  3:37 amodra at gmail dot com
  2020-08-06  7:55 ` [Bug target/96493] " amodra at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: amodra at gmail dot com @ 2020-08-06  3:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96493

            Bug ID: 96493
           Summary: powerpc local call linkage failure
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amodra at gmail dot com
  Target Milestone: ---

/* -O2 -mcpu=power8 */
static int __attribute__ ((target("cpu=power10"),noclone,noinline))
local_func (int x)
{
  return x;
}

int main()
{
  return local_func (0);
}

results in a linker complaint "call to `local_func' lacks nop, can't restore
toc; (toc save/adjust stub)".

rs6000.md call_local et al patterns can't be allowed to match when
caller/callee disagree about r2 usage.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/96493] powerpc local call linkage failure
  2020-08-06  3:37 [Bug target/96493] New: powerpc local call linkage failure amodra at gmail dot com
@ 2020-08-06  7:55 ` amodra at gmail dot com
  2020-08-06 15:46 ` bergner at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: amodra at gmail dot com @ 2020-08-06  7:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96493

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-08-06
           Assignee|unassigned at gcc dot gnu.org      |amodra at gmail dot com
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/96493] powerpc local call linkage failure
  2020-08-06  3:37 [Bug target/96493] New: powerpc local call linkage failure amodra at gmail dot com
  2020-08-06  7:55 ` [Bug target/96493] " amodra at gmail dot com
@ 2020-08-06 15:46 ` bergner at gcc dot gnu.org
  2020-08-07  0:35 ` amodra at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-08-06 15:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96493

--- Comment #1 from Peter Bergner <bergner at gcc dot gnu.org> ---
We will want this backported to GCC 10 too, correct?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/96493] powerpc local call linkage failure
  2020-08-06  3:37 [Bug target/96493] New: powerpc local call linkage failure amodra at gmail dot com
  2020-08-06  7:55 ` [Bug target/96493] " amodra at gmail dot com
  2020-08-06 15:46 ` bergner at gcc dot gnu.org
@ 2020-08-07  0:35 ` amodra at gmail dot com
  2020-08-07  3:03 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: amodra at gmail dot com @ 2020-08-07  0:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96493

--- Comment #2 from Alan Modra <amodra at gmail dot com> ---
Yes, it is a bug present in any gcc version supporting pcrel.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/96493] powerpc local call linkage failure
  2020-08-06  3:37 [Bug target/96493] New: powerpc local call linkage failure amodra at gmail dot com
                   ` (2 preceding siblings ...)
  2020-08-07  0:35 ` amodra at gmail dot com
@ 2020-08-07  3:03 ` cvs-commit at gcc dot gnu.org
  2020-08-07 13:39 ` bergner at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-07  3:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96493

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alan Modra <amodra@gcc.gnu.org>:

https://gcc.gnu.org/g:f8ac30f1653ff69706c35af6d725f1d330600f11

commit r11-2603-gf8ac30f1653ff69706c35af6d725f1d330600f11
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Aug 6 14:12:21 2020 +0930

    PR96493, powerpc local call linkage failure

    This corrects current_file_function_operand, an operand predicate used
    to determine whether a symbol_ref is safe to use with the local_call
    patterns.  Calls between pcrel and non-pcrel code need to go via
    linker stubs.  In the case of non-pcrel code to pcrel the stub saves
    r2 but there needs to be a nop after the branch for the r2 restore.
    So the local_call patterns can't be used there.  For pcrel code to
    non-pcrel the local_call patterns could still be used, but I thought
    it better to not use them since the call isn't direct.  Code generated
    by the corresponding call_nonlocal_aix for pcrel is identical anyway.

    Incidentally, without the TREE_CODE () == FUNCTION_DECL test,
    gcc.c-torture/compile/pr37433.c and pr37433-1.c ICE.  Also, if you
    make the test more strict by disallowing an op without a
    SYMBOL_REF_DECL then a bunch of go and split-stack tests fail.  That's
    because a prologue call to __morestack can't have a following nop.
    (__morestack calls its caller at a fixed offset from the __morestack
    call!)

    gcc/
            PR target/96493
            * config/rs6000/predicates.md (current_file_function_operand):
Don't
            accept functions that differ in r2 usage.

    gcc/testsuite/
            * gcc.target/powerpc/pr96493.c: New file.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/96493] powerpc local call linkage failure
  2020-08-06  3:37 [Bug target/96493] New: powerpc local call linkage failure amodra at gmail dot com
                   ` (3 preceding siblings ...)
  2020-08-07  3:03 ` cvs-commit at gcc dot gnu.org
@ 2020-08-07 13:39 ` bergner at gcc dot gnu.org
  2020-08-12 16:26 ` bergner at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-08-07 13:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96493

Peter Bergner <bergner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.3

--- Comment #4 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to Alan Modra from comment #2)
> Yes, it is a bug present in any gcc version supporting pcrel.

Ok, then I'm setting the target milestone to GCC 10.3.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/96493] powerpc local call linkage failure
  2020-08-06  3:37 [Bug target/96493] New: powerpc local call linkage failure amodra at gmail dot com
                   ` (4 preceding siblings ...)
  2020-08-07 13:39 ` bergner at gcc dot gnu.org
@ 2020-08-12 16:26 ` bergner at gcc dot gnu.org
  2020-08-12 22:47 ` cvs-commit at gcc dot gnu.org
  2020-08-12 22:56 ` amodra at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-08-12 16:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96493

--- Comment #5 from Peter Bergner <bergner at gcc dot gnu.org> ---
I think this has baked on trunk enough now.  Can we get this backported to GCC
10 along with the updated test case fix from PR96525?  I'd like to merge this
along with some other backports I have done into the IBM GCC 10 branch.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/96493] powerpc local call linkage failure
  2020-08-06  3:37 [Bug target/96493] New: powerpc local call linkage failure amodra at gmail dot com
                   ` (5 preceding siblings ...)
  2020-08-12 16:26 ` bergner at gcc dot gnu.org
@ 2020-08-12 22:47 ` cvs-commit at gcc dot gnu.org
  2020-08-12 22:56 ` amodra at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-12 22:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96493

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Alan Modra <amodra@gcc.gnu.org>:

https://gcc.gnu.org/g:61e46440e8124ba605f7ff81aaf1a19176d0c14b

commit r10-8615-g61e46440e8124ba605f7ff81aaf1a19176d0c14b
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Aug 6 14:12:21 2020 +0930

    PR96493, powerpc local call linkage failure

    This corrects current_file_function_operand, an operand predicate used
    to determine whether a symbol_ref is safe to use with the local_call
    patterns.  Calls between pcrel and non-pcrel code need to go via
    linker stubs.  In the case of non-pcrel code to pcrel the stub saves
    r2 but there needs to be a nop after the branch for the r2 restore.
    So the local_call patterns can't be used there.  For pcrel code to
    non-pcrel the local_call patterns could still be used, but I thought
    it better to not use them since the call isn't direct.  Code generated
    by the corresponding call_nonlocal_aix for pcrel is identical anyway.

    Incidentally, without the TREE_CODE () == FUNCTION_DECL test,
    gcc.c-torture/compile/pr37433.c and pr37433-1.c ICE.  Also, if you
    make the test more strict by disallowing an op without a
    SYMBOL_REF_DECL then a bunch of go and split-stack tests fail.  That's
    because a prologue call to __morestack can't have a following nop.
    (__morestack calls its caller at a fixed offset from the __morestack
    call!)

    gcc/
            PR target/96493
            * config/rs6000/predicates.md (current_file_function_operand):
Don't
            accept functions that differ in r2 usage.

    gcc/testsuite/
            * gcc.target/powerpc/pr96493.c: New file.

    (cherry picked from commit f8ac30f1653ff69706c35af6d725f1d330600f11)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/96493] powerpc local call linkage failure
  2020-08-06  3:37 [Bug target/96493] New: powerpc local call linkage failure amodra at gmail dot com
                   ` (6 preceding siblings ...)
  2020-08-12 22:47 ` cvs-commit at gcc dot gnu.org
@ 2020-08-12 22:56 ` amodra at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: amodra at gmail dot com @ 2020-08-12 22:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96493

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Host|                            |gcc
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Alan Modra <amodra at gmail dot com> ---
Patches applied to master and gcc-10

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-08-12 22:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-06  3:37 [Bug target/96493] New: powerpc local call linkage failure amodra at gmail dot com
2020-08-06  7:55 ` [Bug target/96493] " amodra at gmail dot com
2020-08-06 15:46 ` bergner at gcc dot gnu.org
2020-08-07  0:35 ` amodra at gmail dot com
2020-08-07  3:03 ` cvs-commit at gcc dot gnu.org
2020-08-07 13:39 ` bergner at gcc dot gnu.org
2020-08-12 16:26 ` bergner at gcc dot gnu.org
2020-08-12 22:47 ` cvs-commit at gcc dot gnu.org
2020-08-12 22:56 ` amodra at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).