public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libffi/97166] New: libffi build issue when compiling with -mcpu=power10
@ 2020-09-22 17:53 bergner at gcc dot gnu.org
  2020-09-22 18:44 ` [Bug libffi/97166] " bergner at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-09-22 17:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97166
           Summary: libffi build issue when compiling with -mcpu=power10
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libffi
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bergner at gcc dot gnu.org
  Target Milestone: ---

When building libffi with -mcpu=power10, we're seeing the following linker
error.

libtool: link: gcc -shared  -fPIC -DPIC  src/.libs/prep_cif.o src/.libs/types.o
src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o
src/powerpc/.libs/ffi.o src/powerpc/.libs/ffi_sysv.o
src/powerpc/.libs/ffi_linux64.o src/powerpc/.libs/sysv.o
src/powerpc/.libs/ppc_closure.o src/powerpc/.libs/linux64.o
src/powerpc/.libs/linux64_closure.o    -O3 -mcpu=power10 -Wl,--version-script
-Wl,libffi.map   -Wl,-soname -Wl,libffi.so.8 -o .libs/libffi.so.8.1.0
src/powerpc/.libs/linux64.o: in function `ffi_call_LINUX64':
(.text+0x40): call to `ffi_prep_args64' lacks nop, can't restore toc; (toc
save/adjust stub)
/home/bergner/gcc/install/gcc-fsf-mainline-power10/bin/ld: final link failed:
bad value
collect2: error: ld returned 1 exit status
Makefile:1028: recipe for target 'libffi.la' failed

This ends up being a bug in some POWER specific libffi asm code that doesn't
know about our new to POWER10 PCREL support.  This bugzilla is to track syncing
the fix to libffi into GCC version of libffi, which is being tracked upstream
here:

  https://github.com/libffi/libffi/pull/584

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

* [Bug libffi/97166] libffi build issue when compiling with -mcpu=power10
  2020-09-22 17:53 [Bug libffi/97166] New: libffi build issue when compiling with -mcpu=power10 bergner at gcc dot gnu.org
@ 2020-09-22 18:44 ` bergner at gcc dot gnu.org
  2020-09-24  8:02 ` amodra at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-09-22 18:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.0

--- Comment #1 from Peter Bergner <bergner at gcc dot gnu.org> ---
The same issue affects the libffi in GCC 10 sources, since GCC 10 has power10
support, so that needs fixing too.

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

* [Bug libffi/97166] libffi build issue when compiling with -mcpu=power10
  2020-09-22 17:53 [Bug libffi/97166] New: libffi build issue when compiling with -mcpu=power10 bergner at gcc dot gnu.org
  2020-09-22 18:44 ` [Bug libffi/97166] " bergner at gcc dot gnu.org
@ 2020-09-24  8:02 ` amodra at gmail dot com
  2020-09-24 14:01 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: amodra at gmail dot com @ 2020-09-24  8:02 UTC (permalink / raw)
  To: gcc-bugs

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

Alan Modra <amodra at gmail dot com> changed:

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

--- Comment #2 from Alan Modra <amodra at gmail dot com> ---
Oops didn't put the PR number in the commit.  Fixed on master with commit
08cd8d5929 and followup commit fff56af642.  These two will give a working
power10 libffi even without commit 677b9150f5, the patch adding a built-in
__PCREL__ define but you'll get some linker stubs to call between pc-rel and
toc code.

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

* [Bug libffi/97166] libffi build issue when compiling with -mcpu=power10
  2020-09-22 17:53 [Bug libffi/97166] New: libffi build issue when compiling with -mcpu=power10 bergner at gcc dot gnu.org
  2020-09-22 18:44 ` [Bug libffi/97166] " bergner at gcc dot gnu.org
  2020-09-24  8:02 ` amodra at gmail dot com
@ 2020-09-24 14:01 ` cvs-commit at gcc dot gnu.org
  2020-09-24 14:01 ` cvs-commit at gcc dot gnu.org
  2020-09-24 14:21 ` amodra at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-24 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:8f4b43c00feed11a6cedd4c40baa3cdcf687b3a1

commit r10-8794-g8f4b43c00feed11a6cedd4c40baa3cdcf687b3a1
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Sep 23 20:15:39 2020 +0930

    [RS6000] Built-in __PCREL__ define

    Useful in assembly to know details of power10 function calls.

            PR target/97166
            * config/rs6000/rs6000-c.c (rs6000_target_modify_macros):
            Conditionally define __PCREL__.

    (cherry picked from commit 677b9150f54a0483d3de1182ac40717b7c4431a5)

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

* [Bug libffi/97166] libffi build issue when compiling with -mcpu=power10
  2020-09-22 17:53 [Bug libffi/97166] New: libffi build issue when compiling with -mcpu=power10 bergner at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-09-24 14:01 ` cvs-commit at gcc dot gnu.org
@ 2020-09-24 14:01 ` cvs-commit at gcc dot gnu.org
  2020-09-24 14:21 ` amodra at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-24 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:71c83e108de7b54f604eeebefbc9e97672310ca7

commit r10-8795-g71c83e108de7b54f604eeebefbc9e97672310ca7
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Sep 18 23:21:05 2020 +0930

    [RS6000] Power10 libffi fixes

    Power10 pc-relative code doesn't use or preserve r2 as a TOC pointer.
    That means calling between pc-relative and TOC using code can't be
    done without intervening linker stubs, and a call from TOC code to
    pc-relative code must have a nop after the bl in order to restore r2.

    Now the PowerPC libffi assembly code doesn't use r2 except for the
    implicit use when making calls back to C, ffi_closure_helper_LINUX64
    and ffi_prep_args64.  So changing the assembly to interoperate with
    pc-relative code without stubs is easily done.

            PR target/97166
            * src/powerpc/linux64.S (ffi_call_LINUX64): Don't emit global
            entry when __PCREL__.  Call using @notoc.  Add nops.
            * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Likewise.
            (ffi_go_closure_linux64): Likewise.

    (cherry picked from commit 08cd8d5929eac84b27788d8483fd75ab7ad13129)
    (cherry picked from commit fff56af6421a1a3e357bcaad99f2ea084d72a7a8)

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

* [Bug libffi/97166] libffi build issue when compiling with -mcpu=power10
  2020-09-22 17:53 [Bug libffi/97166] New: libffi build issue when compiling with -mcpu=power10 bergner at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-09-24 14:01 ` cvs-commit at gcc dot gnu.org
@ 2020-09-24 14:21 ` amodra at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: amodra at gmail dot com @ 2020-09-24 14:21 UTC (permalink / raw)
  To: gcc-bugs

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

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |10.3

--- Comment #5 from Alan Modra <amodra at gmail dot com> ---
Fixed everywhere we support power10

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

end of thread, other threads:[~2020-09-24 14:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 17:53 [Bug libffi/97166] New: libffi build issue when compiling with -mcpu=power10 bergner at gcc dot gnu.org
2020-09-22 18:44 ` [Bug libffi/97166] " bergner at gcc dot gnu.org
2020-09-24  8:02 ` amodra at gmail dot com
2020-09-24 14:01 ` cvs-commit at gcc dot gnu.org
2020-09-24 14:01 ` cvs-commit at gcc dot gnu.org
2020-09-24 14:21 ` 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).