mbox series

[v2,0/4] libffi: Sync with upstream

Message ID 20210902155045.2620513-1-hjl.tools@gmail.com
Headers show
Series libffi: Sync with upstream | expand

Message

H.J. Lu Sept. 2, 2021, 3:50 p.m. UTC
Change in the v2 patch:

1. Disable static trampolines by default.


GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes 
from upstream over the last 10+ years.  In the meantime, libffi upstream
has been changed significantly with new features, bug fixes and new target
support.  Here is a set of patches to sync with libffi 3.4.2 release and
make it easier to sync with libffi upstream:

1. Document how to sync with upstream.
2. Add scripts to help sync with upstream.
3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at

https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
4. Integrate libffi build and testsuite with GCC.

H.J. Lu (4):
  libffi: Add HOWTO_MERGE, autogen.sh and merge.sh
  libffi: Sync with libffi 3.4.2
  libffi: Integrate build with GCC
  libffi: Integrate testsuite with GCC testsuite

 libffi/.gitattributes                         |    4 +
 libffi/ChangeLog.libffi                       | 7743 ++++++++++++++++-
 libffi/HOWTO_MERGE                            |   13 +
 libffi/LICENSE                                |    2 +-
 libffi/LICENSE-BUILDTOOLS                     |  353 +
 libffi/MERGE                                  |    4 +
 libffi/Makefile.am                            |  135 +-
 libffi/Makefile.in                            |  219 +-
 libffi/README                                 |  450 -
 libffi/README.md                              |  495 ++
 libffi/acinclude.m4                           |   38 +-
 libffi/autogen.sh                             |   11 +
 libffi/configure                              |  487 +-
 libffi/configure.ac                           |   91 +-
 libffi/configure.host                         |   97 +-
 libffi/doc/Makefile.am                        |    3 +
 libffi/doc/libffi.texi                        |  382 +-
 libffi/doc/version.texi                       |    8 +-
 libffi/fficonfig.h.in                         |   21 +-
 libffi/generate-darwin-source-and-headers.py  |  143 +-
 libffi/include/Makefile.am                    |    2 +-
 libffi/include/Makefile.in                    |    3 +-
 libffi/include/ffi.h.in                       |  213 +-
 libffi/include/ffi_cfi.h                      |   21 +
 libffi/include/ffi_common.h                   |   50 +-
 libffi/include/tramp.h                        |   45 +
 libffi/libffi.map.in                          |   24 +-
 libffi/libffi.pc.in                           |    2 +-
 libffi/libffi.xcodeproj/project.pbxproj       |  530 +-
 libffi/libtool-version                        |   25 +-
 libffi/man/Makefile.in                        |    1 +
 libffi/mdate-sh                               |   39 +-
 libffi/merge.sh                               |   51 +
 libffi/msvcc.sh                               |  134 +-
 libffi/src/aarch64/ffi.c                      |  536 +-
 libffi/src/aarch64/ffitarget.h                |   35 +-
 libffi/src/aarch64/internal.h                 |   33 +
 libffi/src/aarch64/sysv.S                     |  189 +-
 libffi/src/aarch64/win64_armasm.S             |  506 ++
 libffi/src/alpha/ffi.c                        |    6 +-
 libffi/src/arc/ffi.c                          |    6 +-
 libffi/src/arm/ffi.c                          |  380 +-
 libffi/src/arm/ffitarget.h                    |   24 +-
 libffi/src/arm/internal.h                     |   10 +
 libffi/src/arm/sysv.S                         |  304 +-
 libffi/src/arm/sysv_msvc_arm32.S              |  311 +
 libffi/src/closures.c                         |  489 +-
 libffi/src/cris/ffi.c                         |    4 +-
 libffi/src/csky/ffi.c                         |  395 +
 libffi/src/csky/ffitarget.h                   |   63 +
 libffi/src/csky/sysv.S                        |  371 +
 libffi/src/dlmalloc.c                         |    7 +-
 libffi/src/frv/ffi.c                          |    4 +-
 libffi/src/ia64/ffi.c                         |   30 +-
 libffi/src/ia64/ffitarget.h                   |    3 +-
 libffi/src/ia64/unix.S                        |    9 +-
 libffi/src/java_raw_api.c                     |    6 +-
 libffi/src/kvx/asm.h                          |    5 +
 libffi/src/kvx/ffi.c                          |  273 +
 libffi/src/kvx/ffitarget.h                    |   75 +
 libffi/src/kvx/sysv.S                         |  127 +
 libffi/src/m32r/ffi.c                         |    2 +-
 libffi/src/m68k/ffi.c                         |    4 +-
 libffi/src/m68k/sysv.S                        |   29 +-
 libffi/src/m88k/ffi.c                         |    8 +-
 libffi/src/metag/ffi.c                        |   14 +-
 libffi/src/microblaze/ffi.c                   |   10 +-
 libffi/src/mips/ffi.c                         |  146 +-
 libffi/src/mips/ffitarget.h                   |   23 +-
 libffi/src/mips/n32.S                         |  151 +-
 libffi/src/mips/o32.S                         |  177 +-
 libffi/src/moxie/eabi.S                       |    2 +-
 libffi/src/moxie/ffi.c                        |   27 +-
 libffi/src/nios2/ffi.c                        |    4 +-
 libffi/src/pa/ffi.c                           |  216 +-
 libffi/src/pa/ffitarget.h                     |   11 +-
 libffi/src/pa/hpux32.S                        |   76 +-
 libffi/src/pa/linux.S                         |  160 +-
 libffi/src/powerpc/asm.h                      |    4 +-
 libffi/src/powerpc/darwin_closure.S           |    6 +-
 libffi/src/powerpc/ffi.c                      |   10 +-
 libffi/src/powerpc/ffi_darwin.c               |   48 +-
 libffi/src/powerpc/ffi_linux64.c              |  247 +-
 libffi/src/powerpc/ffi_powerpc.h              |   25 +-
 libffi/src/powerpc/ffitarget.h                |   14 +-
 libffi/src/powerpc/linux64.S                  |  111 +-
 libffi/src/powerpc/linux64_closure.S          |   70 +-
 libffi/src/powerpc/sysv.S                     |   12 +-
 libffi/src/prep_cif.c                         |   64 +-
 libffi/src/raw_api.c                          |   10 +-
 libffi/src/riscv/ffi.c                        |   16 +-
 libffi/src/sparc/ffi.c                        |    6 +-
 libffi/src/sparc/ffi64.c                      |   18 +-
 libffi/src/tramp.c                            |  729 ++
 libffi/src/types.c                            |    4 +-
 libffi/src/vax/ffi.c                          |    4 +-
 libffi/src/x86/asmnames.h                     |   30 +
 libffi/src/x86/darwin.S                       |  444 -
 libffi/src/x86/darwin64.S                     |  416 -
 libffi/src/x86/darwin64_c.c                   |  643 --
 libffi/src/x86/darwin_c.c                     |  843 --
 libffi/src/x86/ffi.c                          |  162 +-
 libffi/src/x86/ffi64.c                        |  164 +-
 libffi/src/x86/ffitarget.h                    |   42 +-
 libffi/src/x86/ffiw64.c                       |  114 +-
 libffi/src/x86/internal.h                     |   14 +
 libffi/src/x86/internal64.h                   |   14 +
 libffi/src/x86/sysv.S                         |  215 +-
 libffi/src/x86/sysv_intel.S                   |  995 +++
 libffi/src/x86/unix64.S                       |  204 +-
 libffi/src/x86/win64.S                        |  170 +-
 libffi/src/x86/win64_intel.S                  |  238 +
 libffi/src/xtensa/ffi.c                       |    4 +-
 libffi/src/xtensa/sysv.S                      |    7 +-
 libffi/testsuite/Makefile.am                  |  206 +-
 libffi/testsuite/Makefile.in                  |  210 +-
 libffi/testsuite/lib/libffi.exp               |  294 +-
 libffi/testsuite/libffi.bhaible/Makefile      |   28 +
 libffi/testsuite/libffi.bhaible/README        |   78 +
 libffi/testsuite/libffi.bhaible/alignof.h     |   50 +
 libffi/testsuite/libffi.bhaible/bhaible.exp   |   63 +
 libffi/testsuite/libffi.bhaible/test-call.c   | 1745 ++++
 .../testsuite/libffi.bhaible/test-callback.c  | 2885 ++++++
 libffi/testsuite/libffi.bhaible/testcases.c   |  747 ++
 libffi/testsuite/libffi.call/align_mixed.c    |   46 +
 libffi/testsuite/libffi.call/align_stdcall.c  |   46 +
 libffi/testsuite/libffi.call/call.exp         |   28 +-
 libffi/testsuite/libffi.call/cls_uchar_va.c   |   44 -
 libffi/testsuite/libffi.call/cls_ushort_va.c  |   44 -
 libffi/testsuite/libffi.call/ffitest.h        |   13 +-
 libffi/testsuite/libffi.call/float2.c         |   23 +-
 libffi/testsuite/libffi.call/offsets.c        |   46 +
 libffi/testsuite/libffi.call/struct10.c       |   57 +
 libffi/testsuite/libffi.call/va_1.c           |  120 +-
 libffi/testsuite/libffi.call/va_2.c           |  196 +
 libffi/testsuite/libffi.closures/closure.exp  |   67 +
 .../closure_fn0.c                             |    0
 .../closure_fn1.c                             |    0
 .../closure_fn2.c                             |    0
 .../closure_fn3.c                             |    0
 .../closure_fn4.c                             |    0
 .../closure_fn5.c                             |    0
 .../closure_fn6.c                             |    0
 .../closure_loc_fn0.c                         |    3 +
 .../closure_simple.c                          |    0
 .../cls_12byte.c                              |    0
 .../cls_16byte.c                              |    0
 .../cls_18byte.c                              |    0
 .../cls_19byte.c                              |    0
 .../cls_1_1byte.c                             |    0
 .../cls_20byte.c                              |    2 +-
 .../cls_20byte1.c                             |    2 +-
 .../cls_24byte.c                              |    6 +-
 .../cls_2byte.c                               |    0
 .../cls_3_1byte.c                             |    0
 .../cls_3byte1.c                              |    0
 .../cls_3byte2.c                              |    0
 libffi/testsuite/libffi.closures/cls_3float.c |   95 +
 .../cls_4_1byte.c                             |    0
 .../cls_4byte.c                               |    0
 .../cls_5_1_byte.c                            |    2 +-
 .../cls_5byte.c                               |    2 +-
 .../cls_64byte.c                              |    0
 .../cls_6_1_byte.c                            |    2 +-
 .../cls_6byte.c                               |    2 +-
 .../cls_7_1_byte.c                            |    2 +-
 .../cls_7byte.c                               |    2 +-
 .../cls_8byte.c                               |    0
 .../cls_9byte1.c                              |    2 +-
 .../cls_9byte2.c                              |    2 +-
 .../cls_align_double.c                        |    2 +-
 .../cls_align_float.c                         |    2 +-
 .../cls_align_longdouble.c                    |    2 +-
 .../cls_align_longdouble_split.c              |    2 +-
 .../cls_align_longdouble_split2.c             |    2 +-
 .../cls_align_pointer.c                       |    2 +-
 .../cls_align_sint16.c                        |    2 +-
 .../cls_align_sint32.c                        |    2 +-
 .../cls_align_sint64.c                        |    2 +-
 .../cls_align_uint16.c                        |    2 +-
 .../cls_align_uint32.c                        |    2 +-
 .../cls_align_uint64.c                        |    2 +-
 .../cls_dbls_struct.c                         |    6 +-
 .../cls_double.c                              |    0
 .../cls_double_va.c                           |    0
 .../cls_float.c                               |    0
 .../cls_longdouble.c                          |    0
 .../cls_longdouble_va.c                       |    0
 .../cls_many_mixed_args.c                     |    0
 .../cls_many_mixed_float_double.c             |    0
 .../cls_multi_schar.c                         |    2 +-
 .../cls_multi_sshort.c                        |    2 +-
 .../cls_multi_sshortchar.c                    |    2 +-
 .../cls_multi_uchar.c                         |    2 +-
 .../cls_multi_ushort.c                        |    2 +-
 .../cls_multi_ushortchar.c                    |    2 +-
 .../cls_pointer.c                             |    0
 .../cls_pointer_stack.c                       |    0
 .../cls_schar.c                               |    0
 .../cls_sint.c                                |    0
 .../cls_sshort.c                              |    0
 .../cls_struct_va1.c                          |    0
 .../cls_uchar.c                               |    0
 .../cls_uint.c                                |    0
 .../cls_uint_va.c                             |    0
 .../cls_ulong_va.c                            |    0
 .../cls_ulonglong.c                           |    0
 .../cls_ushort.c                              |    0
 .../err_bad_abi.c                             |    0
 libffi/testsuite/libffi.closures/ffitest.h    |  144 +
 .../huge_struct.c                             |    4 +-
 .../nested_struct.c                           |    2 +-
 .../nested_struct1.c                          |    2 +-
 .../nested_struct10.c                         |    1 +
 .../nested_struct11.c                         |    0
 .../libffi.closures/nested_struct12.c         |   86 +
 .../nested_struct13.c}                        |   14 +-
 .../nested_struct2.c                          |    2 +-
 .../nested_struct3.c                          |    2 +-
 .../nested_struct4.c                          |    0
 .../nested_struct5.c                          |    0
 .../nested_struct6.c                          |    0
 .../nested_struct7.c                          |    0
 .../nested_struct8.c                          |    0
 .../nested_struct9.c                          |    0
 .../problem1.c                                |    0
 .../libffi.closures/single_entry_structs1.c   |   86 +
 .../libffi.closures/single_entry_structs2.c   |  102 +
 .../libffi.closures/single_entry_structs3.c   |  101 +
 .../stret_large.c                             |    0
 .../stret_large2.c                            |    0
 .../stret_medium.c                            |    2 +-
 .../stret_medium2.c                           |    2 +-
 .../testclosure.c                             |    2 +-
 .../unwindtest.cc                             |   13 +-
 .../unwindtest_ffi_call.cc                    |    5 +-
 libffi/testsuite/libffi.go/static-chain.h     |    6 -
 libffi/testsuite/libffi.special/ffitestcxx.h  |   96 -
 libffi/testsuite/libffi.special/special.exp   |   35 -
 239 files changed, 24951 insertions(+), 6175 deletions(-)
 create mode 100644 libffi/.gitattributes
 create mode 100644 libffi/HOWTO_MERGE
 create mode 100644 libffi/LICENSE-BUILDTOOLS
 create mode 100644 libffi/MERGE
 delete mode 100644 libffi/README
 create mode 100644 libffi/README.md
 create mode 100755 libffi/autogen.sh
 create mode 100644 libffi/doc/Makefile.am
 mode change 100644 => 100755 libffi/generate-darwin-source-and-headers.py
 create mode 100644 libffi/include/tramp.h
 mode change 100644 => 100755 libffi/mdate-sh
 create mode 100755 libffi/merge.sh
 create mode 100644 libffi/src/aarch64/win64_armasm.S
 create mode 100644 libffi/src/arm/sysv_msvc_arm32.S
 create mode 100644 libffi/src/csky/ffi.c
 create mode 100644 libffi/src/csky/ffitarget.h
 create mode 100644 libffi/src/csky/sysv.S
 create mode 100644 libffi/src/kvx/asm.h
 create mode 100644 libffi/src/kvx/ffi.c
 create mode 100644 libffi/src/kvx/ffitarget.h
 create mode 100644 libffi/src/kvx/sysv.S
 create mode 100644 libffi/src/tramp.c
 create mode 100644 libffi/src/x86/asmnames.h
 delete mode 100644 libffi/src/x86/darwin.S
 delete mode 100644 libffi/src/x86/darwin64.S
 delete mode 100644 libffi/src/x86/darwin64_c.c
 delete mode 100644 libffi/src/x86/darwin_c.c
 create mode 100644 libffi/src/x86/sysv_intel.S
 create mode 100644 libffi/src/x86/win64_intel.S
 create mode 100644 libffi/testsuite/libffi.bhaible/Makefile
 create mode 100644 libffi/testsuite/libffi.bhaible/README
 create mode 100644 libffi/testsuite/libffi.bhaible/alignof.h
 create mode 100644 libffi/testsuite/libffi.bhaible/bhaible.exp
 create mode 100644 libffi/testsuite/libffi.bhaible/test-call.c
 create mode 100644 libffi/testsuite/libffi.bhaible/test-callback.c
 create mode 100644 libffi/testsuite/libffi.bhaible/testcases.c
 create mode 100644 libffi/testsuite/libffi.call/align_mixed.c
 create mode 100644 libffi/testsuite/libffi.call/align_stdcall.c
 delete mode 100644 libffi/testsuite/libffi.call/cls_uchar_va.c
 delete mode 100644 libffi/testsuite/libffi.call/cls_ushort_va.c
 create mode 100644 libffi/testsuite/libffi.call/offsets.c
 create mode 100644 libffi/testsuite/libffi.call/struct10.c
 create mode 100644 libffi/testsuite/libffi.call/va_2.c
 create mode 100644 libffi/testsuite/libffi.closures/closure.exp
 rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn0.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn1.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn2.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn3.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn4.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn5.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn6.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/closure_loc_fn0.c (96%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/closure_simple.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_12byte.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_16byte.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_18byte.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_19byte.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_1_1byte.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte1.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_24byte.c (95%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_2byte.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3_1byte.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte1.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte2.c (100%)
 create mode 100644 libffi/testsuite/libffi.closures/cls_3float.c
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4_1byte.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4byte.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5_1_byte.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5byte.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_64byte.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6_1_byte.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6byte.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7_1_byte.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7byte.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_8byte.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte1.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte2.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_double.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_float.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split.c (98%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split2.c (98%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_pointer.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint16.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint32.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint64.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint16.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint32.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint64.c (97%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_dbls_struct.c (92%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double_va.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_float.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble_va.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_args.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_float_double.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_schar.c (96%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshort.c (96%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshortchar.c (96%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_uchar.c (96%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushort.c (95%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushortchar.c (96%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer_stack.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_schar.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sint.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sshort.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_struct_va1.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uchar.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint_va.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulong_va.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulonglong.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ushort.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/err_bad_abi.c (100%)
 create mode 100644 libffi/testsuite/libffi.closures/ffitest.h
 rename libffi/testsuite/{libffi.call => libffi.closures}/huge_struct.c (99%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct.c (98%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct1.c (98%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct10.c (99%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct11.c (100%)
 create mode 100644 libffi/testsuite/libffi.closures/nested_struct12.c
 rename libffi/testsuite/{libffi.call/nested_struct12.c => libffi.closures/nested_struct13.c} (88%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct2.c (98%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct3.c (98%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct4.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct5.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct6.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct7.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct8.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct9.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/problem1.c (100%)
 create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs1.c
 create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs2.c
 create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs3.c
 rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large2.c (100%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium.c (98%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium2.c (98%)
 rename libffi/testsuite/{libffi.call => libffi.closures}/testclosure.c (95%)
 rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest.cc (95%)
 rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest_ffi_call.cc (94%)
 delete mode 100644 libffi/testsuite/libffi.special/ffitestcxx.h
 delete mode 100644 libffi/testsuite/libffi.special/special.exp

Comments

H.J. Lu Oct. 10, 2021, 1:55 p.m. UTC | #1
On Thu, Sep 2, 2021 at 8:50 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Change in the v2 patch:
>
> 1. Disable static trampolines by default.
>
>
> GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> from upstream over the last 10+ years.  In the meantime, libffi upstream
> has been changed significantly with new features, bug fixes and new target
> support.  Here is a set of patches to sync with libffi 3.4.2 release and
> make it easier to sync with libffi upstream:
>
> 1. Document how to sync with upstream.
> 2. Add scripts to help sync with upstream.
> 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
>
> https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> 4. Integrate libffi build and testsuite with GCC.
>
> H.J. Lu (4):
>   libffi: Add HOWTO_MERGE, autogen.sh and merge.sh
>   libffi: Sync with libffi 3.4.2
>   libffi: Integrate build with GCC
>   libffi: Integrate testsuite with GCC testsuite
>
>  libffi/.gitattributes                         |    4 +
>  libffi/ChangeLog.libffi                       | 7743 ++++++++++++++++-
>  libffi/HOWTO_MERGE                            |   13 +
>  libffi/LICENSE                                |    2 +-
>  libffi/LICENSE-BUILDTOOLS                     |  353 +
>  libffi/MERGE                                  |    4 +
>  libffi/Makefile.am                            |  135 +-
>  libffi/Makefile.in                            |  219 +-
>  libffi/README                                 |  450 -
>  libffi/README.md                              |  495 ++
>  libffi/acinclude.m4                           |   38 +-
>  libffi/autogen.sh                             |   11 +
>  libffi/configure                              |  487 +-
>  libffi/configure.ac                           |   91 +-
>  libffi/configure.host                         |   97 +-
>  libffi/doc/Makefile.am                        |    3 +
>  libffi/doc/libffi.texi                        |  382 +-
>  libffi/doc/version.texi                       |    8 +-
>  libffi/fficonfig.h.in                         |   21 +-
>  libffi/generate-darwin-source-and-headers.py  |  143 +-
>  libffi/include/Makefile.am                    |    2 +-
>  libffi/include/Makefile.in                    |    3 +-
>  libffi/include/ffi.h.in                       |  213 +-
>  libffi/include/ffi_cfi.h                      |   21 +
>  libffi/include/ffi_common.h                   |   50 +-
>  libffi/include/tramp.h                        |   45 +
>  libffi/libffi.map.in                          |   24 +-
>  libffi/libffi.pc.in                           |    2 +-
>  libffi/libffi.xcodeproj/project.pbxproj       |  530 +-
>  libffi/libtool-version                        |   25 +-
>  libffi/man/Makefile.in                        |    1 +
>  libffi/mdate-sh                               |   39 +-
>  libffi/merge.sh                               |   51 +
>  libffi/msvcc.sh                               |  134 +-
>  libffi/src/aarch64/ffi.c                      |  536 +-
>  libffi/src/aarch64/ffitarget.h                |   35 +-
>  libffi/src/aarch64/internal.h                 |   33 +
>  libffi/src/aarch64/sysv.S                     |  189 +-
>  libffi/src/aarch64/win64_armasm.S             |  506 ++
>  libffi/src/alpha/ffi.c                        |    6 +-
>  libffi/src/arc/ffi.c                          |    6 +-
>  libffi/src/arm/ffi.c                          |  380 +-
>  libffi/src/arm/ffitarget.h                    |   24 +-
>  libffi/src/arm/internal.h                     |   10 +
>  libffi/src/arm/sysv.S                         |  304 +-
>  libffi/src/arm/sysv_msvc_arm32.S              |  311 +
>  libffi/src/closures.c                         |  489 +-
>  libffi/src/cris/ffi.c                         |    4 +-
>  libffi/src/csky/ffi.c                         |  395 +
>  libffi/src/csky/ffitarget.h                   |   63 +
>  libffi/src/csky/sysv.S                        |  371 +
>  libffi/src/dlmalloc.c                         |    7 +-
>  libffi/src/frv/ffi.c                          |    4 +-
>  libffi/src/ia64/ffi.c                         |   30 +-
>  libffi/src/ia64/ffitarget.h                   |    3 +-
>  libffi/src/ia64/unix.S                        |    9 +-
>  libffi/src/java_raw_api.c                     |    6 +-
>  libffi/src/kvx/asm.h                          |    5 +
>  libffi/src/kvx/ffi.c                          |  273 +
>  libffi/src/kvx/ffitarget.h                    |   75 +
>  libffi/src/kvx/sysv.S                         |  127 +
>  libffi/src/m32r/ffi.c                         |    2 +-
>  libffi/src/m68k/ffi.c                         |    4 +-
>  libffi/src/m68k/sysv.S                        |   29 +-
>  libffi/src/m88k/ffi.c                         |    8 +-
>  libffi/src/metag/ffi.c                        |   14 +-
>  libffi/src/microblaze/ffi.c                   |   10 +-
>  libffi/src/mips/ffi.c                         |  146 +-
>  libffi/src/mips/ffitarget.h                   |   23 +-
>  libffi/src/mips/n32.S                         |  151 +-
>  libffi/src/mips/o32.S                         |  177 +-
>  libffi/src/moxie/eabi.S                       |    2 +-
>  libffi/src/moxie/ffi.c                        |   27 +-
>  libffi/src/nios2/ffi.c                        |    4 +-
>  libffi/src/pa/ffi.c                           |  216 +-
>  libffi/src/pa/ffitarget.h                     |   11 +-
>  libffi/src/pa/hpux32.S                        |   76 +-
>  libffi/src/pa/linux.S                         |  160 +-
>  libffi/src/powerpc/asm.h                      |    4 +-
>  libffi/src/powerpc/darwin_closure.S           |    6 +-
>  libffi/src/powerpc/ffi.c                      |   10 +-
>  libffi/src/powerpc/ffi_darwin.c               |   48 +-
>  libffi/src/powerpc/ffi_linux64.c              |  247 +-
>  libffi/src/powerpc/ffi_powerpc.h              |   25 +-
>  libffi/src/powerpc/ffitarget.h                |   14 +-
>  libffi/src/powerpc/linux64.S                  |  111 +-
>  libffi/src/powerpc/linux64_closure.S          |   70 +-
>  libffi/src/powerpc/sysv.S                     |   12 +-
>  libffi/src/prep_cif.c                         |   64 +-
>  libffi/src/raw_api.c                          |   10 +-
>  libffi/src/riscv/ffi.c                        |   16 +-
>  libffi/src/sparc/ffi.c                        |    6 +-
>  libffi/src/sparc/ffi64.c                      |   18 +-
>  libffi/src/tramp.c                            |  729 ++
>  libffi/src/types.c                            |    4 +-
>  libffi/src/vax/ffi.c                          |    4 +-
>  libffi/src/x86/asmnames.h                     |   30 +
>  libffi/src/x86/darwin.S                       |  444 -
>  libffi/src/x86/darwin64.S                     |  416 -
>  libffi/src/x86/darwin64_c.c                   |  643 --
>  libffi/src/x86/darwin_c.c                     |  843 --
>  libffi/src/x86/ffi.c                          |  162 +-
>  libffi/src/x86/ffi64.c                        |  164 +-
>  libffi/src/x86/ffitarget.h                    |   42 +-
>  libffi/src/x86/ffiw64.c                       |  114 +-
>  libffi/src/x86/internal.h                     |   14 +
>  libffi/src/x86/internal64.h                   |   14 +
>  libffi/src/x86/sysv.S                         |  215 +-
>  libffi/src/x86/sysv_intel.S                   |  995 +++
>  libffi/src/x86/unix64.S                       |  204 +-
>  libffi/src/x86/win64.S                        |  170 +-
>  libffi/src/x86/win64_intel.S                  |  238 +
>  libffi/src/xtensa/ffi.c                       |    4 +-
>  libffi/src/xtensa/sysv.S                      |    7 +-
>  libffi/testsuite/Makefile.am                  |  206 +-
>  libffi/testsuite/Makefile.in                  |  210 +-
>  libffi/testsuite/lib/libffi.exp               |  294 +-
>  libffi/testsuite/libffi.bhaible/Makefile      |   28 +
>  libffi/testsuite/libffi.bhaible/README        |   78 +
>  libffi/testsuite/libffi.bhaible/alignof.h     |   50 +
>  libffi/testsuite/libffi.bhaible/bhaible.exp   |   63 +
>  libffi/testsuite/libffi.bhaible/test-call.c   | 1745 ++++
>  .../testsuite/libffi.bhaible/test-callback.c  | 2885 ++++++
>  libffi/testsuite/libffi.bhaible/testcases.c   |  747 ++
>  libffi/testsuite/libffi.call/align_mixed.c    |   46 +
>  libffi/testsuite/libffi.call/align_stdcall.c  |   46 +
>  libffi/testsuite/libffi.call/call.exp         |   28 +-
>  libffi/testsuite/libffi.call/cls_uchar_va.c   |   44 -
>  libffi/testsuite/libffi.call/cls_ushort_va.c  |   44 -
>  libffi/testsuite/libffi.call/ffitest.h        |   13 +-
>  libffi/testsuite/libffi.call/float2.c         |   23 +-
>  libffi/testsuite/libffi.call/offsets.c        |   46 +
>  libffi/testsuite/libffi.call/struct10.c       |   57 +
>  libffi/testsuite/libffi.call/va_1.c           |  120 +-
>  libffi/testsuite/libffi.call/va_2.c           |  196 +
>  libffi/testsuite/libffi.closures/closure.exp  |   67 +
>  .../closure_fn0.c                             |    0
>  .../closure_fn1.c                             |    0
>  .../closure_fn2.c                             |    0
>  .../closure_fn3.c                             |    0
>  .../closure_fn4.c                             |    0
>  .../closure_fn5.c                             |    0
>  .../closure_fn6.c                             |    0
>  .../closure_loc_fn0.c                         |    3 +
>  .../closure_simple.c                          |    0
>  .../cls_12byte.c                              |    0
>  .../cls_16byte.c                              |    0
>  .../cls_18byte.c                              |    0
>  .../cls_19byte.c                              |    0
>  .../cls_1_1byte.c                             |    0
>  .../cls_20byte.c                              |    2 +-
>  .../cls_20byte1.c                             |    2 +-
>  .../cls_24byte.c                              |    6 +-
>  .../cls_2byte.c                               |    0
>  .../cls_3_1byte.c                             |    0
>  .../cls_3byte1.c                              |    0
>  .../cls_3byte2.c                              |    0
>  libffi/testsuite/libffi.closures/cls_3float.c |   95 +
>  .../cls_4_1byte.c                             |    0
>  .../cls_4byte.c                               |    0
>  .../cls_5_1_byte.c                            |    2 +-
>  .../cls_5byte.c                               |    2 +-
>  .../cls_64byte.c                              |    0
>  .../cls_6_1_byte.c                            |    2 +-
>  .../cls_6byte.c                               |    2 +-
>  .../cls_7_1_byte.c                            |    2 +-
>  .../cls_7byte.c                               |    2 +-
>  .../cls_8byte.c                               |    0
>  .../cls_9byte1.c                              |    2 +-
>  .../cls_9byte2.c                              |    2 +-
>  .../cls_align_double.c                        |    2 +-
>  .../cls_align_float.c                         |    2 +-
>  .../cls_align_longdouble.c                    |    2 +-
>  .../cls_align_longdouble_split.c              |    2 +-
>  .../cls_align_longdouble_split2.c             |    2 +-
>  .../cls_align_pointer.c                       |    2 +-
>  .../cls_align_sint16.c                        |    2 +-
>  .../cls_align_sint32.c                        |    2 +-
>  .../cls_align_sint64.c                        |    2 +-
>  .../cls_align_uint16.c                        |    2 +-
>  .../cls_align_uint32.c                        |    2 +-
>  .../cls_align_uint64.c                        |    2 +-
>  .../cls_dbls_struct.c                         |    6 +-
>  .../cls_double.c                              |    0
>  .../cls_double_va.c                           |    0
>  .../cls_float.c                               |    0
>  .../cls_longdouble.c                          |    0
>  .../cls_longdouble_va.c                       |    0
>  .../cls_many_mixed_args.c                     |    0
>  .../cls_many_mixed_float_double.c             |    0
>  .../cls_multi_schar.c                         |    2 +-
>  .../cls_multi_sshort.c                        |    2 +-
>  .../cls_multi_sshortchar.c                    |    2 +-
>  .../cls_multi_uchar.c                         |    2 +-
>  .../cls_multi_ushort.c                        |    2 +-
>  .../cls_multi_ushortchar.c                    |    2 +-
>  .../cls_pointer.c                             |    0
>  .../cls_pointer_stack.c                       |    0
>  .../cls_schar.c                               |    0
>  .../cls_sint.c                                |    0
>  .../cls_sshort.c                              |    0
>  .../cls_struct_va1.c                          |    0
>  .../cls_uchar.c                               |    0
>  .../cls_uint.c                                |    0
>  .../cls_uint_va.c                             |    0
>  .../cls_ulong_va.c                            |    0
>  .../cls_ulonglong.c                           |    0
>  .../cls_ushort.c                              |    0
>  .../err_bad_abi.c                             |    0
>  libffi/testsuite/libffi.closures/ffitest.h    |  144 +
>  .../huge_struct.c                             |    4 +-
>  .../nested_struct.c                           |    2 +-
>  .../nested_struct1.c                          |    2 +-
>  .../nested_struct10.c                         |    1 +
>  .../nested_struct11.c                         |    0
>  .../libffi.closures/nested_struct12.c         |   86 +
>  .../nested_struct13.c}                        |   14 +-
>  .../nested_struct2.c                          |    2 +-
>  .../nested_struct3.c                          |    2 +-
>  .../nested_struct4.c                          |    0
>  .../nested_struct5.c                          |    0
>  .../nested_struct6.c                          |    0
>  .../nested_struct7.c                          |    0
>  .../nested_struct8.c                          |    0
>  .../nested_struct9.c                          |    0
>  .../problem1.c                                |    0
>  .../libffi.closures/single_entry_structs1.c   |   86 +
>  .../libffi.closures/single_entry_structs2.c   |  102 +
>  .../libffi.closures/single_entry_structs3.c   |  101 +
>  .../stret_large.c                             |    0
>  .../stret_large2.c                            |    0
>  .../stret_medium.c                            |    2 +-
>  .../stret_medium2.c                           |    2 +-
>  .../testclosure.c                             |    2 +-
>  .../unwindtest.cc                             |   13 +-
>  .../unwindtest_ffi_call.cc                    |    5 +-
>  libffi/testsuite/libffi.go/static-chain.h     |    6 -
>  libffi/testsuite/libffi.special/ffitestcxx.h  |   96 -
>  libffi/testsuite/libffi.special/special.exp   |   35 -
>  239 files changed, 24951 insertions(+), 6175 deletions(-)
>  create mode 100644 libffi/.gitattributes
>  create mode 100644 libffi/HOWTO_MERGE
>  create mode 100644 libffi/LICENSE-BUILDTOOLS
>  create mode 100644 libffi/MERGE
>  delete mode 100644 libffi/README
>  create mode 100644 libffi/README.md
>  create mode 100755 libffi/autogen.sh
>  create mode 100644 libffi/doc/Makefile.am
>  mode change 100644 => 100755 libffi/generate-darwin-source-and-headers.py
>  create mode 100644 libffi/include/tramp.h
>  mode change 100644 => 100755 libffi/mdate-sh
>  create mode 100755 libffi/merge.sh
>  create mode 100644 libffi/src/aarch64/win64_armasm.S
>  create mode 100644 libffi/src/arm/sysv_msvc_arm32.S
>  create mode 100644 libffi/src/csky/ffi.c
>  create mode 100644 libffi/src/csky/ffitarget.h
>  create mode 100644 libffi/src/csky/sysv.S
>  create mode 100644 libffi/src/kvx/asm.h
>  create mode 100644 libffi/src/kvx/ffi.c
>  create mode 100644 libffi/src/kvx/ffitarget.h
>  create mode 100644 libffi/src/kvx/sysv.S
>  create mode 100644 libffi/src/tramp.c
>  create mode 100644 libffi/src/x86/asmnames.h
>  delete mode 100644 libffi/src/x86/darwin.S
>  delete mode 100644 libffi/src/x86/darwin64.S
>  delete mode 100644 libffi/src/x86/darwin64_c.c
>  delete mode 100644 libffi/src/x86/darwin_c.c
>  create mode 100644 libffi/src/x86/sysv_intel.S
>  create mode 100644 libffi/src/x86/win64_intel.S
>  create mode 100644 libffi/testsuite/libffi.bhaible/Makefile
>  create mode 100644 libffi/testsuite/libffi.bhaible/README
>  create mode 100644 libffi/testsuite/libffi.bhaible/alignof.h
>  create mode 100644 libffi/testsuite/libffi.bhaible/bhaible.exp
>  create mode 100644 libffi/testsuite/libffi.bhaible/test-call.c
>  create mode 100644 libffi/testsuite/libffi.bhaible/test-callback.c
>  create mode 100644 libffi/testsuite/libffi.bhaible/testcases.c
>  create mode 100644 libffi/testsuite/libffi.call/align_mixed.c
>  create mode 100644 libffi/testsuite/libffi.call/align_stdcall.c
>  delete mode 100644 libffi/testsuite/libffi.call/cls_uchar_va.c
>  delete mode 100644 libffi/testsuite/libffi.call/cls_ushort_va.c
>  create mode 100644 libffi/testsuite/libffi.call/offsets.c
>  create mode 100644 libffi/testsuite/libffi.call/struct10.c
>  create mode 100644 libffi/testsuite/libffi.call/va_2.c
>  create mode 100644 libffi/testsuite/libffi.closures/closure.exp
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn0.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn1.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn2.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn3.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn4.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn5.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn6.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_loc_fn0.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_simple.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_12byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_16byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_18byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_19byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_1_1byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte1.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_24byte.c (95%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_2byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3_1byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte1.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte2.c (100%)
>  create mode 100644 libffi/testsuite/libffi.closures/cls_3float.c
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4_1byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5_1_byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_64byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6_1_byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7_1_byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_8byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte1.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte2.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_double.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_float.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split2.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_pointer.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint16.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint32.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint64.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint16.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint32.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint64.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_dbls_struct.c (92%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double_va.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_float.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble_va.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_args.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_float_double.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_schar.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshort.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshortchar.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_uchar.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushort.c (95%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushortchar.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer_stack.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_schar.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sint.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sshort.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_struct_va1.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uchar.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint_va.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulong_va.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulonglong.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ushort.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/err_bad_abi.c (100%)
>  create mode 100644 libffi/testsuite/libffi.closures/ffitest.h
>  rename libffi/testsuite/{libffi.call => libffi.closures}/huge_struct.c (99%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct1.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct10.c (99%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct11.c (100%)
>  create mode 100644 libffi/testsuite/libffi.closures/nested_struct12.c
>  rename libffi/testsuite/{libffi.call/nested_struct12.c => libffi.closures/nested_struct13.c} (88%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct2.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct3.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct4.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct5.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct6.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct7.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct8.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct9.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/problem1.c (100%)
>  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs1.c
>  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs2.c
>  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs3.c
>  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large2.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium2.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/testclosure.c (95%)
>  rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest.cc (95%)
>  rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest_ffi_call.cc (94%)
>  delete mode 100644 libffi/testsuite/libffi.special/ffitestcxx.h
>  delete mode 100644 libffi/testsuite/libffi.special/special.exp
>
> --
> 2.31.1
>

PING:

https://gcc.gnu.org/pipermail/gcc-patches/2021-September/578702.html
Richard Biener Oct. 13, 2021, 12:45 p.m. UTC | #2
On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Change in the v2 patch:
>
> 1. Disable static trampolines by default.
>
>
> GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> from upstream over the last 10+ years.  In the meantime, libffi upstream
> has been changed significantly with new features, bug fixes and new target
> support.  Here is a set of patches to sync with libffi 3.4.2 release and
> make it easier to sync with libffi upstream:
>
> 1. Document how to sync with upstream.
> 2. Add scripts to help sync with upstream.
> 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
>
> https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> 4. Integrate libffi build and testsuite with GCC.

How did you test this?  It looks like libgo is the only consumer of
libffi these days.
In particular go/libgo seems to be supported on almost all targets besides
darwin/windows - did you test cross and canadian configurations?

I applaud the attempt to sync to upsteam but I fear you won't get any "review"
of this massive diff.

I suppose the SONAME changes after the sync?

Thanks,
Richard.

> H.J. Lu (4):
>   libffi: Add HOWTO_MERGE, autogen.sh and merge.sh
>   libffi: Sync with libffi 3.4.2
>   libffi: Integrate build with GCC
>   libffi: Integrate testsuite with GCC testsuite
>
>  libffi/.gitattributes                         |    4 +
>  libffi/ChangeLog.libffi                       | 7743 ++++++++++++++++-
>  libffi/HOWTO_MERGE                            |   13 +
>  libffi/LICENSE                                |    2 +-
>  libffi/LICENSE-BUILDTOOLS                     |  353 +
>  libffi/MERGE                                  |    4 +
>  libffi/Makefile.am                            |  135 +-
>  libffi/Makefile.in                            |  219 +-
>  libffi/README                                 |  450 -
>  libffi/README.md                              |  495 ++
>  libffi/acinclude.m4                           |   38 +-
>  libffi/autogen.sh                             |   11 +
>  libffi/configure                              |  487 +-
>  libffi/configure.ac                           |   91 +-
>  libffi/configure.host                         |   97 +-
>  libffi/doc/Makefile.am                        |    3 +
>  libffi/doc/libffi.texi                        |  382 +-
>  libffi/doc/version.texi                       |    8 +-
>  libffi/fficonfig.h.in                         |   21 +-
>  libffi/generate-darwin-source-and-headers.py  |  143 +-
>  libffi/include/Makefile.am                    |    2 +-
>  libffi/include/Makefile.in                    |    3 +-
>  libffi/include/ffi.h.in                       |  213 +-
>  libffi/include/ffi_cfi.h                      |   21 +
>  libffi/include/ffi_common.h                   |   50 +-
>  libffi/include/tramp.h                        |   45 +
>  libffi/libffi.map.in                          |   24 +-
>  libffi/libffi.pc.in                           |    2 +-
>  libffi/libffi.xcodeproj/project.pbxproj       |  530 +-
>  libffi/libtool-version                        |   25 +-
>  libffi/man/Makefile.in                        |    1 +
>  libffi/mdate-sh                               |   39 +-
>  libffi/merge.sh                               |   51 +
>  libffi/msvcc.sh                               |  134 +-
>  libffi/src/aarch64/ffi.c                      |  536 +-
>  libffi/src/aarch64/ffitarget.h                |   35 +-
>  libffi/src/aarch64/internal.h                 |   33 +
>  libffi/src/aarch64/sysv.S                     |  189 +-
>  libffi/src/aarch64/win64_armasm.S             |  506 ++
>  libffi/src/alpha/ffi.c                        |    6 +-
>  libffi/src/arc/ffi.c                          |    6 +-
>  libffi/src/arm/ffi.c                          |  380 +-
>  libffi/src/arm/ffitarget.h                    |   24 +-
>  libffi/src/arm/internal.h                     |   10 +
>  libffi/src/arm/sysv.S                         |  304 +-
>  libffi/src/arm/sysv_msvc_arm32.S              |  311 +
>  libffi/src/closures.c                         |  489 +-
>  libffi/src/cris/ffi.c                         |    4 +-
>  libffi/src/csky/ffi.c                         |  395 +
>  libffi/src/csky/ffitarget.h                   |   63 +
>  libffi/src/csky/sysv.S                        |  371 +
>  libffi/src/dlmalloc.c                         |    7 +-
>  libffi/src/frv/ffi.c                          |    4 +-
>  libffi/src/ia64/ffi.c                         |   30 +-
>  libffi/src/ia64/ffitarget.h                   |    3 +-
>  libffi/src/ia64/unix.S                        |    9 +-
>  libffi/src/java_raw_api.c                     |    6 +-
>  libffi/src/kvx/asm.h                          |    5 +
>  libffi/src/kvx/ffi.c                          |  273 +
>  libffi/src/kvx/ffitarget.h                    |   75 +
>  libffi/src/kvx/sysv.S                         |  127 +
>  libffi/src/m32r/ffi.c                         |    2 +-
>  libffi/src/m68k/ffi.c                         |    4 +-
>  libffi/src/m68k/sysv.S                        |   29 +-
>  libffi/src/m88k/ffi.c                         |    8 +-
>  libffi/src/metag/ffi.c                        |   14 +-
>  libffi/src/microblaze/ffi.c                   |   10 +-
>  libffi/src/mips/ffi.c                         |  146 +-
>  libffi/src/mips/ffitarget.h                   |   23 +-
>  libffi/src/mips/n32.S                         |  151 +-
>  libffi/src/mips/o32.S                         |  177 +-
>  libffi/src/moxie/eabi.S                       |    2 +-
>  libffi/src/moxie/ffi.c                        |   27 +-
>  libffi/src/nios2/ffi.c                        |    4 +-
>  libffi/src/pa/ffi.c                           |  216 +-
>  libffi/src/pa/ffitarget.h                     |   11 +-
>  libffi/src/pa/hpux32.S                        |   76 +-
>  libffi/src/pa/linux.S                         |  160 +-
>  libffi/src/powerpc/asm.h                      |    4 +-
>  libffi/src/powerpc/darwin_closure.S           |    6 +-
>  libffi/src/powerpc/ffi.c                      |   10 +-
>  libffi/src/powerpc/ffi_darwin.c               |   48 +-
>  libffi/src/powerpc/ffi_linux64.c              |  247 +-
>  libffi/src/powerpc/ffi_powerpc.h              |   25 +-
>  libffi/src/powerpc/ffitarget.h                |   14 +-
>  libffi/src/powerpc/linux64.S                  |  111 +-
>  libffi/src/powerpc/linux64_closure.S          |   70 +-
>  libffi/src/powerpc/sysv.S                     |   12 +-
>  libffi/src/prep_cif.c                         |   64 +-
>  libffi/src/raw_api.c                          |   10 +-
>  libffi/src/riscv/ffi.c                        |   16 +-
>  libffi/src/sparc/ffi.c                        |    6 +-
>  libffi/src/sparc/ffi64.c                      |   18 +-
>  libffi/src/tramp.c                            |  729 ++
>  libffi/src/types.c                            |    4 +-
>  libffi/src/vax/ffi.c                          |    4 +-
>  libffi/src/x86/asmnames.h                     |   30 +
>  libffi/src/x86/darwin.S                       |  444 -
>  libffi/src/x86/darwin64.S                     |  416 -
>  libffi/src/x86/darwin64_c.c                   |  643 --
>  libffi/src/x86/darwin_c.c                     |  843 --
>  libffi/src/x86/ffi.c                          |  162 +-
>  libffi/src/x86/ffi64.c                        |  164 +-
>  libffi/src/x86/ffitarget.h                    |   42 +-
>  libffi/src/x86/ffiw64.c                       |  114 +-
>  libffi/src/x86/internal.h                     |   14 +
>  libffi/src/x86/internal64.h                   |   14 +
>  libffi/src/x86/sysv.S                         |  215 +-
>  libffi/src/x86/sysv_intel.S                   |  995 +++
>  libffi/src/x86/unix64.S                       |  204 +-
>  libffi/src/x86/win64.S                        |  170 +-
>  libffi/src/x86/win64_intel.S                  |  238 +
>  libffi/src/xtensa/ffi.c                       |    4 +-
>  libffi/src/xtensa/sysv.S                      |    7 +-
>  libffi/testsuite/Makefile.am                  |  206 +-
>  libffi/testsuite/Makefile.in                  |  210 +-
>  libffi/testsuite/lib/libffi.exp               |  294 +-
>  libffi/testsuite/libffi.bhaible/Makefile      |   28 +
>  libffi/testsuite/libffi.bhaible/README        |   78 +
>  libffi/testsuite/libffi.bhaible/alignof.h     |   50 +
>  libffi/testsuite/libffi.bhaible/bhaible.exp   |   63 +
>  libffi/testsuite/libffi.bhaible/test-call.c   | 1745 ++++
>  .../testsuite/libffi.bhaible/test-callback.c  | 2885 ++++++
>  libffi/testsuite/libffi.bhaible/testcases.c   |  747 ++
>  libffi/testsuite/libffi.call/align_mixed.c    |   46 +
>  libffi/testsuite/libffi.call/align_stdcall.c  |   46 +
>  libffi/testsuite/libffi.call/call.exp         |   28 +-
>  libffi/testsuite/libffi.call/cls_uchar_va.c   |   44 -
>  libffi/testsuite/libffi.call/cls_ushort_va.c  |   44 -
>  libffi/testsuite/libffi.call/ffitest.h        |   13 +-
>  libffi/testsuite/libffi.call/float2.c         |   23 +-
>  libffi/testsuite/libffi.call/offsets.c        |   46 +
>  libffi/testsuite/libffi.call/struct10.c       |   57 +
>  libffi/testsuite/libffi.call/va_1.c           |  120 +-
>  libffi/testsuite/libffi.call/va_2.c           |  196 +
>  libffi/testsuite/libffi.closures/closure.exp  |   67 +
>  .../closure_fn0.c                             |    0
>  .../closure_fn1.c                             |    0
>  .../closure_fn2.c                             |    0
>  .../closure_fn3.c                             |    0
>  .../closure_fn4.c                             |    0
>  .../closure_fn5.c                             |    0
>  .../closure_fn6.c                             |    0
>  .../closure_loc_fn0.c                         |    3 +
>  .../closure_simple.c                          |    0
>  .../cls_12byte.c                              |    0
>  .../cls_16byte.c                              |    0
>  .../cls_18byte.c                              |    0
>  .../cls_19byte.c                              |    0
>  .../cls_1_1byte.c                             |    0
>  .../cls_20byte.c                              |    2 +-
>  .../cls_20byte1.c                             |    2 +-
>  .../cls_24byte.c                              |    6 +-
>  .../cls_2byte.c                               |    0
>  .../cls_3_1byte.c                             |    0
>  .../cls_3byte1.c                              |    0
>  .../cls_3byte2.c                              |    0
>  libffi/testsuite/libffi.closures/cls_3float.c |   95 +
>  .../cls_4_1byte.c                             |    0
>  .../cls_4byte.c                               |    0
>  .../cls_5_1_byte.c                            |    2 +-
>  .../cls_5byte.c                               |    2 +-
>  .../cls_64byte.c                              |    0
>  .../cls_6_1_byte.c                            |    2 +-
>  .../cls_6byte.c                               |    2 +-
>  .../cls_7_1_byte.c                            |    2 +-
>  .../cls_7byte.c                               |    2 +-
>  .../cls_8byte.c                               |    0
>  .../cls_9byte1.c                              |    2 +-
>  .../cls_9byte2.c                              |    2 +-
>  .../cls_align_double.c                        |    2 +-
>  .../cls_align_float.c                         |    2 +-
>  .../cls_align_longdouble.c                    |    2 +-
>  .../cls_align_longdouble_split.c              |    2 +-
>  .../cls_align_longdouble_split2.c             |    2 +-
>  .../cls_align_pointer.c                       |    2 +-
>  .../cls_align_sint16.c                        |    2 +-
>  .../cls_align_sint32.c                        |    2 +-
>  .../cls_align_sint64.c                        |    2 +-
>  .../cls_align_uint16.c                        |    2 +-
>  .../cls_align_uint32.c                        |    2 +-
>  .../cls_align_uint64.c                        |    2 +-
>  .../cls_dbls_struct.c                         |    6 +-
>  .../cls_double.c                              |    0
>  .../cls_double_va.c                           |    0
>  .../cls_float.c                               |    0
>  .../cls_longdouble.c                          |    0
>  .../cls_longdouble_va.c                       |    0
>  .../cls_many_mixed_args.c                     |    0
>  .../cls_many_mixed_float_double.c             |    0
>  .../cls_multi_schar.c                         |    2 +-
>  .../cls_multi_sshort.c                        |    2 +-
>  .../cls_multi_sshortchar.c                    |    2 +-
>  .../cls_multi_uchar.c                         |    2 +-
>  .../cls_multi_ushort.c                        |    2 +-
>  .../cls_multi_ushortchar.c                    |    2 +-
>  .../cls_pointer.c                             |    0
>  .../cls_pointer_stack.c                       |    0
>  .../cls_schar.c                               |    0
>  .../cls_sint.c                                |    0
>  .../cls_sshort.c                              |    0
>  .../cls_struct_va1.c                          |    0
>  .../cls_uchar.c                               |    0
>  .../cls_uint.c                                |    0
>  .../cls_uint_va.c                             |    0
>  .../cls_ulong_va.c                            |    0
>  .../cls_ulonglong.c                           |    0
>  .../cls_ushort.c                              |    0
>  .../err_bad_abi.c                             |    0
>  libffi/testsuite/libffi.closures/ffitest.h    |  144 +
>  .../huge_struct.c                             |    4 +-
>  .../nested_struct.c                           |    2 +-
>  .../nested_struct1.c                          |    2 +-
>  .../nested_struct10.c                         |    1 +
>  .../nested_struct11.c                         |    0
>  .../libffi.closures/nested_struct12.c         |   86 +
>  .../nested_struct13.c}                        |   14 +-
>  .../nested_struct2.c                          |    2 +-
>  .../nested_struct3.c                          |    2 +-
>  .../nested_struct4.c                          |    0
>  .../nested_struct5.c                          |    0
>  .../nested_struct6.c                          |    0
>  .../nested_struct7.c                          |    0
>  .../nested_struct8.c                          |    0
>  .../nested_struct9.c                          |    0
>  .../problem1.c                                |    0
>  .../libffi.closures/single_entry_structs1.c   |   86 +
>  .../libffi.closures/single_entry_structs2.c   |  102 +
>  .../libffi.closures/single_entry_structs3.c   |  101 +
>  .../stret_large.c                             |    0
>  .../stret_large2.c                            |    0
>  .../stret_medium.c                            |    2 +-
>  .../stret_medium2.c                           |    2 +-
>  .../testclosure.c                             |    2 +-
>  .../unwindtest.cc                             |   13 +-
>  .../unwindtest_ffi_call.cc                    |    5 +-
>  libffi/testsuite/libffi.go/static-chain.h     |    6 -
>  libffi/testsuite/libffi.special/ffitestcxx.h  |   96 -
>  libffi/testsuite/libffi.special/special.exp   |   35 -
>  239 files changed, 24951 insertions(+), 6175 deletions(-)
>  create mode 100644 libffi/.gitattributes
>  create mode 100644 libffi/HOWTO_MERGE
>  create mode 100644 libffi/LICENSE-BUILDTOOLS
>  create mode 100644 libffi/MERGE
>  delete mode 100644 libffi/README
>  create mode 100644 libffi/README.md
>  create mode 100755 libffi/autogen.sh
>  create mode 100644 libffi/doc/Makefile.am
>  mode change 100644 => 100755 libffi/generate-darwin-source-and-headers.py
>  create mode 100644 libffi/include/tramp.h
>  mode change 100644 => 100755 libffi/mdate-sh
>  create mode 100755 libffi/merge.sh
>  create mode 100644 libffi/src/aarch64/win64_armasm.S
>  create mode 100644 libffi/src/arm/sysv_msvc_arm32.S
>  create mode 100644 libffi/src/csky/ffi.c
>  create mode 100644 libffi/src/csky/ffitarget.h
>  create mode 100644 libffi/src/csky/sysv.S
>  create mode 100644 libffi/src/kvx/asm.h
>  create mode 100644 libffi/src/kvx/ffi.c
>  create mode 100644 libffi/src/kvx/ffitarget.h
>  create mode 100644 libffi/src/kvx/sysv.S
>  create mode 100644 libffi/src/tramp.c
>  create mode 100644 libffi/src/x86/asmnames.h
>  delete mode 100644 libffi/src/x86/darwin.S
>  delete mode 100644 libffi/src/x86/darwin64.S
>  delete mode 100644 libffi/src/x86/darwin64_c.c
>  delete mode 100644 libffi/src/x86/darwin_c.c
>  create mode 100644 libffi/src/x86/sysv_intel.S
>  create mode 100644 libffi/src/x86/win64_intel.S
>  create mode 100644 libffi/testsuite/libffi.bhaible/Makefile
>  create mode 100644 libffi/testsuite/libffi.bhaible/README
>  create mode 100644 libffi/testsuite/libffi.bhaible/alignof.h
>  create mode 100644 libffi/testsuite/libffi.bhaible/bhaible.exp
>  create mode 100644 libffi/testsuite/libffi.bhaible/test-call.c
>  create mode 100644 libffi/testsuite/libffi.bhaible/test-callback.c
>  create mode 100644 libffi/testsuite/libffi.bhaible/testcases.c
>  create mode 100644 libffi/testsuite/libffi.call/align_mixed.c
>  create mode 100644 libffi/testsuite/libffi.call/align_stdcall.c
>  delete mode 100644 libffi/testsuite/libffi.call/cls_uchar_va.c
>  delete mode 100644 libffi/testsuite/libffi.call/cls_ushort_va.c
>  create mode 100644 libffi/testsuite/libffi.call/offsets.c
>  create mode 100644 libffi/testsuite/libffi.call/struct10.c
>  create mode 100644 libffi/testsuite/libffi.call/va_2.c
>  create mode 100644 libffi/testsuite/libffi.closures/closure.exp
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn0.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn1.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn2.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn3.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn4.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn5.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn6.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_loc_fn0.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_simple.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_12byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_16byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_18byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_19byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_1_1byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte1.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_24byte.c (95%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_2byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3_1byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte1.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte2.c (100%)
>  create mode 100644 libffi/testsuite/libffi.closures/cls_3float.c
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4_1byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5_1_byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_64byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6_1_byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7_1_byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7byte.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_8byte.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte1.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte2.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_double.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_float.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split2.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_pointer.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint16.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint32.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint64.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint16.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint32.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint64.c (97%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_dbls_struct.c (92%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double_va.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_float.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble_va.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_args.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_float_double.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_schar.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshort.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshortchar.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_uchar.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushort.c (95%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushortchar.c (96%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer_stack.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_schar.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sint.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sshort.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_struct_va1.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uchar.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint_va.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulong_va.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulonglong.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ushort.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/err_bad_abi.c (100%)
>  create mode 100644 libffi/testsuite/libffi.closures/ffitest.h
>  rename libffi/testsuite/{libffi.call => libffi.closures}/huge_struct.c (99%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct1.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct10.c (99%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct11.c (100%)
>  create mode 100644 libffi/testsuite/libffi.closures/nested_struct12.c
>  rename libffi/testsuite/{libffi.call/nested_struct12.c => libffi.closures/nested_struct13.c} (88%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct2.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct3.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct4.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct5.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct6.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct7.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct8.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct9.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/problem1.c (100%)
>  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs1.c
>  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs2.c
>  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs3.c
>  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large2.c (100%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium2.c (98%)
>  rename libffi/testsuite/{libffi.call => libffi.closures}/testclosure.c (95%)
>  rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest.cc (95%)
>  rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest_ffi_call.cc (94%)
>  delete mode 100644 libffi/testsuite/libffi.special/ffitestcxx.h
>  delete mode 100644 libffi/testsuite/libffi.special/special.exp
>
> --
> 2.31.1
>
H.J. Lu Oct. 13, 2021, 12:56 p.m. UTC | #3
On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > Change in the v2 patch:
> >
> > 1. Disable static trampolines by default.
> >
> >
> > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > has been changed significantly with new features, bug fixes and new target
> > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > make it easier to sync with libffi upstream:
> >
> > 1. Document how to sync with upstream.
> > 2. Add scripts to help sync with upstream.
> > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> >
> > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > 4. Integrate libffi build and testsuite with GCC.
>
> How did you test this?  It looks like libgo is the only consumer of
> libffi these days.
> In particular go/libgo seems to be supported on almost all targets besides
> darwin/windows - did you test cross and canadian configurations?

I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
the upstream libffi works on Darwin and Windows.

> I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> of this massive diff.

I believe that it should just work.  Our libffi is very much out of date.

> I suppose the SONAME changes after the sync?

Yes, SONAME is synced with upstream which was updated.

> Thanks,
> Richard.
>
> > H.J. Lu (4):
> >   libffi: Add HOWTO_MERGE, autogen.sh and merge.sh
> >   libffi: Sync with libffi 3.4.2
> >   libffi: Integrate build with GCC
> >   libffi: Integrate testsuite with GCC testsuite
> >
> >  libffi/.gitattributes                         |    4 +
> >  libffi/ChangeLog.libffi                       | 7743 ++++++++++++++++-
> >  libffi/HOWTO_MERGE                            |   13 +
> >  libffi/LICENSE                                |    2 +-
> >  libffi/LICENSE-BUILDTOOLS                     |  353 +
> >  libffi/MERGE                                  |    4 +
> >  libffi/Makefile.am                            |  135 +-
> >  libffi/Makefile.in                            |  219 +-
> >  libffi/README                                 |  450 -
> >  libffi/README.md                              |  495 ++
> >  libffi/acinclude.m4                           |   38 +-
> >  libffi/autogen.sh                             |   11 +
> >  libffi/configure                              |  487 +-
> >  libffi/configure.ac                           |   91 +-
> >  libffi/configure.host                         |   97 +-
> >  libffi/doc/Makefile.am                        |    3 +
> >  libffi/doc/libffi.texi                        |  382 +-
> >  libffi/doc/version.texi                       |    8 +-
> >  libffi/fficonfig.h.in                         |   21 +-
> >  libffi/generate-darwin-source-and-headers.py  |  143 +-
> >  libffi/include/Makefile.am                    |    2 +-
> >  libffi/include/Makefile.in                    |    3 +-
> >  libffi/include/ffi.h.in                       |  213 +-
> >  libffi/include/ffi_cfi.h                      |   21 +
> >  libffi/include/ffi_common.h                   |   50 +-
> >  libffi/include/tramp.h                        |   45 +
> >  libffi/libffi.map.in                          |   24 +-
> >  libffi/libffi.pc.in                           |    2 +-
> >  libffi/libffi.xcodeproj/project.pbxproj       |  530 +-
> >  libffi/libtool-version                        |   25 +-
> >  libffi/man/Makefile.in                        |    1 +
> >  libffi/mdate-sh                               |   39 +-
> >  libffi/merge.sh                               |   51 +
> >  libffi/msvcc.sh                               |  134 +-
> >  libffi/src/aarch64/ffi.c                      |  536 +-
> >  libffi/src/aarch64/ffitarget.h                |   35 +-
> >  libffi/src/aarch64/internal.h                 |   33 +
> >  libffi/src/aarch64/sysv.S                     |  189 +-
> >  libffi/src/aarch64/win64_armasm.S             |  506 ++
> >  libffi/src/alpha/ffi.c                        |    6 +-
> >  libffi/src/arc/ffi.c                          |    6 +-
> >  libffi/src/arm/ffi.c                          |  380 +-
> >  libffi/src/arm/ffitarget.h                    |   24 +-
> >  libffi/src/arm/internal.h                     |   10 +
> >  libffi/src/arm/sysv.S                         |  304 +-
> >  libffi/src/arm/sysv_msvc_arm32.S              |  311 +
> >  libffi/src/closures.c                         |  489 +-
> >  libffi/src/cris/ffi.c                         |    4 +-
> >  libffi/src/csky/ffi.c                         |  395 +
> >  libffi/src/csky/ffitarget.h                   |   63 +
> >  libffi/src/csky/sysv.S                        |  371 +
> >  libffi/src/dlmalloc.c                         |    7 +-
> >  libffi/src/frv/ffi.c                          |    4 +-
> >  libffi/src/ia64/ffi.c                         |   30 +-
> >  libffi/src/ia64/ffitarget.h                   |    3 +-
> >  libffi/src/ia64/unix.S                        |    9 +-
> >  libffi/src/java_raw_api.c                     |    6 +-
> >  libffi/src/kvx/asm.h                          |    5 +
> >  libffi/src/kvx/ffi.c                          |  273 +
> >  libffi/src/kvx/ffitarget.h                    |   75 +
> >  libffi/src/kvx/sysv.S                         |  127 +
> >  libffi/src/m32r/ffi.c                         |    2 +-
> >  libffi/src/m68k/ffi.c                         |    4 +-
> >  libffi/src/m68k/sysv.S                        |   29 +-
> >  libffi/src/m88k/ffi.c                         |    8 +-
> >  libffi/src/metag/ffi.c                        |   14 +-
> >  libffi/src/microblaze/ffi.c                   |   10 +-
> >  libffi/src/mips/ffi.c                         |  146 +-
> >  libffi/src/mips/ffitarget.h                   |   23 +-
> >  libffi/src/mips/n32.S                         |  151 +-
> >  libffi/src/mips/o32.S                         |  177 +-
> >  libffi/src/moxie/eabi.S                       |    2 +-
> >  libffi/src/moxie/ffi.c                        |   27 +-
> >  libffi/src/nios2/ffi.c                        |    4 +-
> >  libffi/src/pa/ffi.c                           |  216 +-
> >  libffi/src/pa/ffitarget.h                     |   11 +-
> >  libffi/src/pa/hpux32.S                        |   76 +-
> >  libffi/src/pa/linux.S                         |  160 +-
> >  libffi/src/powerpc/asm.h                      |    4 +-
> >  libffi/src/powerpc/darwin_closure.S           |    6 +-
> >  libffi/src/powerpc/ffi.c                      |   10 +-
> >  libffi/src/powerpc/ffi_darwin.c               |   48 +-
> >  libffi/src/powerpc/ffi_linux64.c              |  247 +-
> >  libffi/src/powerpc/ffi_powerpc.h              |   25 +-
> >  libffi/src/powerpc/ffitarget.h                |   14 +-
> >  libffi/src/powerpc/linux64.S                  |  111 +-
> >  libffi/src/powerpc/linux64_closure.S          |   70 +-
> >  libffi/src/powerpc/sysv.S                     |   12 +-
> >  libffi/src/prep_cif.c                         |   64 +-
> >  libffi/src/raw_api.c                          |   10 +-
> >  libffi/src/riscv/ffi.c                        |   16 +-
> >  libffi/src/sparc/ffi.c                        |    6 +-
> >  libffi/src/sparc/ffi64.c                      |   18 +-
> >  libffi/src/tramp.c                            |  729 ++
> >  libffi/src/types.c                            |    4 +-
> >  libffi/src/vax/ffi.c                          |    4 +-
> >  libffi/src/x86/asmnames.h                     |   30 +
> >  libffi/src/x86/darwin.S                       |  444 -
> >  libffi/src/x86/darwin64.S                     |  416 -
> >  libffi/src/x86/darwin64_c.c                   |  643 --
> >  libffi/src/x86/darwin_c.c                     |  843 --
> >  libffi/src/x86/ffi.c                          |  162 +-
> >  libffi/src/x86/ffi64.c                        |  164 +-
> >  libffi/src/x86/ffitarget.h                    |   42 +-
> >  libffi/src/x86/ffiw64.c                       |  114 +-
> >  libffi/src/x86/internal.h                     |   14 +
> >  libffi/src/x86/internal64.h                   |   14 +
> >  libffi/src/x86/sysv.S                         |  215 +-
> >  libffi/src/x86/sysv_intel.S                   |  995 +++
> >  libffi/src/x86/unix64.S                       |  204 +-
> >  libffi/src/x86/win64.S                        |  170 +-
> >  libffi/src/x86/win64_intel.S                  |  238 +
> >  libffi/src/xtensa/ffi.c                       |    4 +-
> >  libffi/src/xtensa/sysv.S                      |    7 +-
> >  libffi/testsuite/Makefile.am                  |  206 +-
> >  libffi/testsuite/Makefile.in                  |  210 +-
> >  libffi/testsuite/lib/libffi.exp               |  294 +-
> >  libffi/testsuite/libffi.bhaible/Makefile      |   28 +
> >  libffi/testsuite/libffi.bhaible/README        |   78 +
> >  libffi/testsuite/libffi.bhaible/alignof.h     |   50 +
> >  libffi/testsuite/libffi.bhaible/bhaible.exp   |   63 +
> >  libffi/testsuite/libffi.bhaible/test-call.c   | 1745 ++++
> >  .../testsuite/libffi.bhaible/test-callback.c  | 2885 ++++++
> >  libffi/testsuite/libffi.bhaible/testcases.c   |  747 ++
> >  libffi/testsuite/libffi.call/align_mixed.c    |   46 +
> >  libffi/testsuite/libffi.call/align_stdcall.c  |   46 +
> >  libffi/testsuite/libffi.call/call.exp         |   28 +-
> >  libffi/testsuite/libffi.call/cls_uchar_va.c   |   44 -
> >  libffi/testsuite/libffi.call/cls_ushort_va.c  |   44 -
> >  libffi/testsuite/libffi.call/ffitest.h        |   13 +-
> >  libffi/testsuite/libffi.call/float2.c         |   23 +-
> >  libffi/testsuite/libffi.call/offsets.c        |   46 +
> >  libffi/testsuite/libffi.call/struct10.c       |   57 +
> >  libffi/testsuite/libffi.call/va_1.c           |  120 +-
> >  libffi/testsuite/libffi.call/va_2.c           |  196 +
> >  libffi/testsuite/libffi.closures/closure.exp  |   67 +
> >  .../closure_fn0.c                             |    0
> >  .../closure_fn1.c                             |    0
> >  .../closure_fn2.c                             |    0
> >  .../closure_fn3.c                             |    0
> >  .../closure_fn4.c                             |    0
> >  .../closure_fn5.c                             |    0
> >  .../closure_fn6.c                             |    0
> >  .../closure_loc_fn0.c                         |    3 +
> >  .../closure_simple.c                          |    0
> >  .../cls_12byte.c                              |    0
> >  .../cls_16byte.c                              |    0
> >  .../cls_18byte.c                              |    0
> >  .../cls_19byte.c                              |    0
> >  .../cls_1_1byte.c                             |    0
> >  .../cls_20byte.c                              |    2 +-
> >  .../cls_20byte1.c                             |    2 +-
> >  .../cls_24byte.c                              |    6 +-
> >  .../cls_2byte.c                               |    0
> >  .../cls_3_1byte.c                             |    0
> >  .../cls_3byte1.c                              |    0
> >  .../cls_3byte2.c                              |    0
> >  libffi/testsuite/libffi.closures/cls_3float.c |   95 +
> >  .../cls_4_1byte.c                             |    0
> >  .../cls_4byte.c                               |    0
> >  .../cls_5_1_byte.c                            |    2 +-
> >  .../cls_5byte.c                               |    2 +-
> >  .../cls_64byte.c                              |    0
> >  .../cls_6_1_byte.c                            |    2 +-
> >  .../cls_6byte.c                               |    2 +-
> >  .../cls_7_1_byte.c                            |    2 +-
> >  .../cls_7byte.c                               |    2 +-
> >  .../cls_8byte.c                               |    0
> >  .../cls_9byte1.c                              |    2 +-
> >  .../cls_9byte2.c                              |    2 +-
> >  .../cls_align_double.c                        |    2 +-
> >  .../cls_align_float.c                         |    2 +-
> >  .../cls_align_longdouble.c                    |    2 +-
> >  .../cls_align_longdouble_split.c              |    2 +-
> >  .../cls_align_longdouble_split2.c             |    2 +-
> >  .../cls_align_pointer.c                       |    2 +-
> >  .../cls_align_sint16.c                        |    2 +-
> >  .../cls_align_sint32.c                        |    2 +-
> >  .../cls_align_sint64.c                        |    2 +-
> >  .../cls_align_uint16.c                        |    2 +-
> >  .../cls_align_uint32.c                        |    2 +-
> >  .../cls_align_uint64.c                        |    2 +-
> >  .../cls_dbls_struct.c                         |    6 +-
> >  .../cls_double.c                              |    0
> >  .../cls_double_va.c                           |    0
> >  .../cls_float.c                               |    0
> >  .../cls_longdouble.c                          |    0
> >  .../cls_longdouble_va.c                       |    0
> >  .../cls_many_mixed_args.c                     |    0
> >  .../cls_many_mixed_float_double.c             |    0
> >  .../cls_multi_schar.c                         |    2 +-
> >  .../cls_multi_sshort.c                        |    2 +-
> >  .../cls_multi_sshortchar.c                    |    2 +-
> >  .../cls_multi_uchar.c                         |    2 +-
> >  .../cls_multi_ushort.c                        |    2 +-
> >  .../cls_multi_ushortchar.c                    |    2 +-
> >  .../cls_pointer.c                             |    0
> >  .../cls_pointer_stack.c                       |    0
> >  .../cls_schar.c                               |    0
> >  .../cls_sint.c                                |    0
> >  .../cls_sshort.c                              |    0
> >  .../cls_struct_va1.c                          |    0
> >  .../cls_uchar.c                               |    0
> >  .../cls_uint.c                                |    0
> >  .../cls_uint_va.c                             |    0
> >  .../cls_ulong_va.c                            |    0
> >  .../cls_ulonglong.c                           |    0
> >  .../cls_ushort.c                              |    0
> >  .../err_bad_abi.c                             |    0
> >  libffi/testsuite/libffi.closures/ffitest.h    |  144 +
> >  .../huge_struct.c                             |    4 +-
> >  .../nested_struct.c                           |    2 +-
> >  .../nested_struct1.c                          |    2 +-
> >  .../nested_struct10.c                         |    1 +
> >  .../nested_struct11.c                         |    0
> >  .../libffi.closures/nested_struct12.c         |   86 +
> >  .../nested_struct13.c}                        |   14 +-
> >  .../nested_struct2.c                          |    2 +-
> >  .../nested_struct3.c                          |    2 +-
> >  .../nested_struct4.c                          |    0
> >  .../nested_struct5.c                          |    0
> >  .../nested_struct6.c                          |    0
> >  .../nested_struct7.c                          |    0
> >  .../nested_struct8.c                          |    0
> >  .../nested_struct9.c                          |    0
> >  .../problem1.c                                |    0
> >  .../libffi.closures/single_entry_structs1.c   |   86 +
> >  .../libffi.closures/single_entry_structs2.c   |  102 +
> >  .../libffi.closures/single_entry_structs3.c   |  101 +
> >  .../stret_large.c                             |    0
> >  .../stret_large2.c                            |    0
> >  .../stret_medium.c                            |    2 +-
> >  .../stret_medium2.c                           |    2 +-
> >  .../testclosure.c                             |    2 +-
> >  .../unwindtest.cc                             |   13 +-
> >  .../unwindtest_ffi_call.cc                    |    5 +-
> >  libffi/testsuite/libffi.go/static-chain.h     |    6 -
> >  libffi/testsuite/libffi.special/ffitestcxx.h  |   96 -
> >  libffi/testsuite/libffi.special/special.exp   |   35 -
> >  239 files changed, 24951 insertions(+), 6175 deletions(-)
> >  create mode 100644 libffi/.gitattributes
> >  create mode 100644 libffi/HOWTO_MERGE
> >  create mode 100644 libffi/LICENSE-BUILDTOOLS
> >  create mode 100644 libffi/MERGE
> >  delete mode 100644 libffi/README
> >  create mode 100644 libffi/README.md
> >  create mode 100755 libffi/autogen.sh
> >  create mode 100644 libffi/doc/Makefile.am
> >  mode change 100644 => 100755 libffi/generate-darwin-source-and-headers.py
> >  create mode 100644 libffi/include/tramp.h
> >  mode change 100644 => 100755 libffi/mdate-sh
> >  create mode 100755 libffi/merge.sh
> >  create mode 100644 libffi/src/aarch64/win64_armasm.S
> >  create mode 100644 libffi/src/arm/sysv_msvc_arm32.S
> >  create mode 100644 libffi/src/csky/ffi.c
> >  create mode 100644 libffi/src/csky/ffitarget.h
> >  create mode 100644 libffi/src/csky/sysv.S
> >  create mode 100644 libffi/src/kvx/asm.h
> >  create mode 100644 libffi/src/kvx/ffi.c
> >  create mode 100644 libffi/src/kvx/ffitarget.h
> >  create mode 100644 libffi/src/kvx/sysv.S
> >  create mode 100644 libffi/src/tramp.c
> >  create mode 100644 libffi/src/x86/asmnames.h
> >  delete mode 100644 libffi/src/x86/darwin.S
> >  delete mode 100644 libffi/src/x86/darwin64.S
> >  delete mode 100644 libffi/src/x86/darwin64_c.c
> >  delete mode 100644 libffi/src/x86/darwin_c.c
> >  create mode 100644 libffi/src/x86/sysv_intel.S
> >  create mode 100644 libffi/src/x86/win64_intel.S
> >  create mode 100644 libffi/testsuite/libffi.bhaible/Makefile
> >  create mode 100644 libffi/testsuite/libffi.bhaible/README
> >  create mode 100644 libffi/testsuite/libffi.bhaible/alignof.h
> >  create mode 100644 libffi/testsuite/libffi.bhaible/bhaible.exp
> >  create mode 100644 libffi/testsuite/libffi.bhaible/test-call.c
> >  create mode 100644 libffi/testsuite/libffi.bhaible/test-callback.c
> >  create mode 100644 libffi/testsuite/libffi.bhaible/testcases.c
> >  create mode 100644 libffi/testsuite/libffi.call/align_mixed.c
> >  create mode 100644 libffi/testsuite/libffi.call/align_stdcall.c
> >  delete mode 100644 libffi/testsuite/libffi.call/cls_uchar_va.c
> >  delete mode 100644 libffi/testsuite/libffi.call/cls_ushort_va.c
> >  create mode 100644 libffi/testsuite/libffi.call/offsets.c
> >  create mode 100644 libffi/testsuite/libffi.call/struct10.c
> >  create mode 100644 libffi/testsuite/libffi.call/va_2.c
> >  create mode 100644 libffi/testsuite/libffi.closures/closure.exp
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn0.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn1.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn2.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn3.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn4.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn5.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn6.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_loc_fn0.c (96%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_simple.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_12byte.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_16byte.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_18byte.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_19byte.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_1_1byte.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte1.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_24byte.c (95%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_2byte.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3_1byte.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte1.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte2.c (100%)
> >  create mode 100644 libffi/testsuite/libffi.closures/cls_3float.c
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4_1byte.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4byte.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5_1_byte.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5byte.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_64byte.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6_1_byte.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6byte.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7_1_byte.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7byte.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_8byte.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte1.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte2.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_double.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_float.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split.c (98%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split2.c (98%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_pointer.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint16.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint32.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint64.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint16.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint32.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint64.c (97%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_dbls_struct.c (92%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double_va.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_float.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble_va.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_args.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_float_double.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_schar.c (96%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshort.c (96%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshortchar.c (96%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_uchar.c (96%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushort.c (95%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushortchar.c (96%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer_stack.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_schar.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sint.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sshort.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_struct_va1.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uchar.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint_va.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulong_va.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulonglong.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ushort.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/err_bad_abi.c (100%)
> >  create mode 100644 libffi/testsuite/libffi.closures/ffitest.h
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/huge_struct.c (99%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct.c (98%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct1.c (98%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct10.c (99%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct11.c (100%)
> >  create mode 100644 libffi/testsuite/libffi.closures/nested_struct12.c
> >  rename libffi/testsuite/{libffi.call/nested_struct12.c => libffi.closures/nested_struct13.c} (88%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct2.c (98%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct3.c (98%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct4.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct5.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct6.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct7.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct8.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct9.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/problem1.c (100%)
> >  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs1.c
> >  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs2.c
> >  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs3.c
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large2.c (100%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium.c (98%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium2.c (98%)
> >  rename libffi/testsuite/{libffi.call => libffi.closures}/testclosure.c (95%)
> >  rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest.cc (95%)
> >  rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest_ffi_call.cc (94%)
> >  delete mode 100644 libffi/testsuite/libffi.special/ffitestcxx.h
> >  delete mode 100644 libffi/testsuite/libffi.special/special.exp
> >
> > --
> > 2.31.1
> >
Richard Biener Oct. 13, 2021, 1:03 p.m. UTC | #4
On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> <richard.guenther@gmail.com> wrote:
> >
> > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > Change in the v2 patch:
> > >
> > > 1. Disable static trampolines by default.
> > >
> > >
> > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > has been changed significantly with new features, bug fixes and new target
> > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > make it easier to sync with libffi upstream:
> > >
> > > 1. Document how to sync with upstream.
> > > 2. Add scripts to help sync with upstream.
> > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > >
> > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > 4. Integrate libffi build and testsuite with GCC.
> >
> > How did you test this?  It looks like libgo is the only consumer of
> > libffi these days.
> > In particular go/libgo seems to be supported on almost all targets besides
> > darwin/windows - did you test cross and canadian configurations?
>
> I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> the upstream libffi works on Darwin and Windows.
>
> > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > of this massive diff.
>
> I believe that it should just work.  Our libffi is very much out of date.

Yes, you can hope.  And yes, our libffi is out of date.

Can you please do the extra step to test one weird architecture, namely
powerpc64-aix which is available on the compile-farm?

If that goes well I think it's good to "hope" at this point (and plenty of
time to fix fallout until the GCC 12 release).

Thus OK after the extra testing dance and waiting until early next
week so others can throw in a veto.

Thanks,
Richard.

> > I suppose the SONAME changes after the sync?
>
> Yes, SONAME is synced with upstream which was updated.
>
> > Thanks,
> > Richard.
> >
> > > H.J. Lu (4):
> > >   libffi: Add HOWTO_MERGE, autogen.sh and merge.sh
> > >   libffi: Sync with libffi 3.4.2
> > >   libffi: Integrate build with GCC
> > >   libffi: Integrate testsuite with GCC testsuite
> > >
> > >  libffi/.gitattributes                         |    4 +
> > >  libffi/ChangeLog.libffi                       | 7743 ++++++++++++++++-
> > >  libffi/HOWTO_MERGE                            |   13 +
> > >  libffi/LICENSE                                |    2 +-
> > >  libffi/LICENSE-BUILDTOOLS                     |  353 +
> > >  libffi/MERGE                                  |    4 +
> > >  libffi/Makefile.am                            |  135 +-
> > >  libffi/Makefile.in                            |  219 +-
> > >  libffi/README                                 |  450 -
> > >  libffi/README.md                              |  495 ++
> > >  libffi/acinclude.m4                           |   38 +-
> > >  libffi/autogen.sh                             |   11 +
> > >  libffi/configure                              |  487 +-
> > >  libffi/configure.ac                           |   91 +-
> > >  libffi/configure.host                         |   97 +-
> > >  libffi/doc/Makefile.am                        |    3 +
> > >  libffi/doc/libffi.texi                        |  382 +-
> > >  libffi/doc/version.texi                       |    8 +-
> > >  libffi/fficonfig.h.in                         |   21 +-
> > >  libffi/generate-darwin-source-and-headers.py  |  143 +-
> > >  libffi/include/Makefile.am                    |    2 +-
> > >  libffi/include/Makefile.in                    |    3 +-
> > >  libffi/include/ffi.h.in                       |  213 +-
> > >  libffi/include/ffi_cfi.h                      |   21 +
> > >  libffi/include/ffi_common.h                   |   50 +-
> > >  libffi/include/tramp.h                        |   45 +
> > >  libffi/libffi.map.in                          |   24 +-
> > >  libffi/libffi.pc.in                           |    2 +-
> > >  libffi/libffi.xcodeproj/project.pbxproj       |  530 +-
> > >  libffi/libtool-version                        |   25 +-
> > >  libffi/man/Makefile.in                        |    1 +
> > >  libffi/mdate-sh                               |   39 +-
> > >  libffi/merge.sh                               |   51 +
> > >  libffi/msvcc.sh                               |  134 +-
> > >  libffi/src/aarch64/ffi.c                      |  536 +-
> > >  libffi/src/aarch64/ffitarget.h                |   35 +-
> > >  libffi/src/aarch64/internal.h                 |   33 +
> > >  libffi/src/aarch64/sysv.S                     |  189 +-
> > >  libffi/src/aarch64/win64_armasm.S             |  506 ++
> > >  libffi/src/alpha/ffi.c                        |    6 +-
> > >  libffi/src/arc/ffi.c                          |    6 +-
> > >  libffi/src/arm/ffi.c                          |  380 +-
> > >  libffi/src/arm/ffitarget.h                    |   24 +-
> > >  libffi/src/arm/internal.h                     |   10 +
> > >  libffi/src/arm/sysv.S                         |  304 +-
> > >  libffi/src/arm/sysv_msvc_arm32.S              |  311 +
> > >  libffi/src/closures.c                         |  489 +-
> > >  libffi/src/cris/ffi.c                         |    4 +-
> > >  libffi/src/csky/ffi.c                         |  395 +
> > >  libffi/src/csky/ffitarget.h                   |   63 +
> > >  libffi/src/csky/sysv.S                        |  371 +
> > >  libffi/src/dlmalloc.c                         |    7 +-
> > >  libffi/src/frv/ffi.c                          |    4 +-
> > >  libffi/src/ia64/ffi.c                         |   30 +-
> > >  libffi/src/ia64/ffitarget.h                   |    3 +-
> > >  libffi/src/ia64/unix.S                        |    9 +-
> > >  libffi/src/java_raw_api.c                     |    6 +-
> > >  libffi/src/kvx/asm.h                          |    5 +
> > >  libffi/src/kvx/ffi.c                          |  273 +
> > >  libffi/src/kvx/ffitarget.h                    |   75 +
> > >  libffi/src/kvx/sysv.S                         |  127 +
> > >  libffi/src/m32r/ffi.c                         |    2 +-
> > >  libffi/src/m68k/ffi.c                         |    4 +-
> > >  libffi/src/m68k/sysv.S                        |   29 +-
> > >  libffi/src/m88k/ffi.c                         |    8 +-
> > >  libffi/src/metag/ffi.c                        |   14 +-
> > >  libffi/src/microblaze/ffi.c                   |   10 +-
> > >  libffi/src/mips/ffi.c                         |  146 +-
> > >  libffi/src/mips/ffitarget.h                   |   23 +-
> > >  libffi/src/mips/n32.S                         |  151 +-
> > >  libffi/src/mips/o32.S                         |  177 +-
> > >  libffi/src/moxie/eabi.S                       |    2 +-
> > >  libffi/src/moxie/ffi.c                        |   27 +-
> > >  libffi/src/nios2/ffi.c                        |    4 +-
> > >  libffi/src/pa/ffi.c                           |  216 +-
> > >  libffi/src/pa/ffitarget.h                     |   11 +-
> > >  libffi/src/pa/hpux32.S                        |   76 +-
> > >  libffi/src/pa/linux.S                         |  160 +-
> > >  libffi/src/powerpc/asm.h                      |    4 +-
> > >  libffi/src/powerpc/darwin_closure.S           |    6 +-
> > >  libffi/src/powerpc/ffi.c                      |   10 +-
> > >  libffi/src/powerpc/ffi_darwin.c               |   48 +-
> > >  libffi/src/powerpc/ffi_linux64.c              |  247 +-
> > >  libffi/src/powerpc/ffi_powerpc.h              |   25 +-
> > >  libffi/src/powerpc/ffitarget.h                |   14 +-
> > >  libffi/src/powerpc/linux64.S                  |  111 +-
> > >  libffi/src/powerpc/linux64_closure.S          |   70 +-
> > >  libffi/src/powerpc/sysv.S                     |   12 +-
> > >  libffi/src/prep_cif.c                         |   64 +-
> > >  libffi/src/raw_api.c                          |   10 +-
> > >  libffi/src/riscv/ffi.c                        |   16 +-
> > >  libffi/src/sparc/ffi.c                        |    6 +-
> > >  libffi/src/sparc/ffi64.c                      |   18 +-
> > >  libffi/src/tramp.c                            |  729 ++
> > >  libffi/src/types.c                            |    4 +-
> > >  libffi/src/vax/ffi.c                          |    4 +-
> > >  libffi/src/x86/asmnames.h                     |   30 +
> > >  libffi/src/x86/darwin.S                       |  444 -
> > >  libffi/src/x86/darwin64.S                     |  416 -
> > >  libffi/src/x86/darwin64_c.c                   |  643 --
> > >  libffi/src/x86/darwin_c.c                     |  843 --
> > >  libffi/src/x86/ffi.c                          |  162 +-
> > >  libffi/src/x86/ffi64.c                        |  164 +-
> > >  libffi/src/x86/ffitarget.h                    |   42 +-
> > >  libffi/src/x86/ffiw64.c                       |  114 +-
> > >  libffi/src/x86/internal.h                     |   14 +
> > >  libffi/src/x86/internal64.h                   |   14 +
> > >  libffi/src/x86/sysv.S                         |  215 +-
> > >  libffi/src/x86/sysv_intel.S                   |  995 +++
> > >  libffi/src/x86/unix64.S                       |  204 +-
> > >  libffi/src/x86/win64.S                        |  170 +-
> > >  libffi/src/x86/win64_intel.S                  |  238 +
> > >  libffi/src/xtensa/ffi.c                       |    4 +-
> > >  libffi/src/xtensa/sysv.S                      |    7 +-
> > >  libffi/testsuite/Makefile.am                  |  206 +-
> > >  libffi/testsuite/Makefile.in                  |  210 +-
> > >  libffi/testsuite/lib/libffi.exp               |  294 +-
> > >  libffi/testsuite/libffi.bhaible/Makefile      |   28 +
> > >  libffi/testsuite/libffi.bhaible/README        |   78 +
> > >  libffi/testsuite/libffi.bhaible/alignof.h     |   50 +
> > >  libffi/testsuite/libffi.bhaible/bhaible.exp   |   63 +
> > >  libffi/testsuite/libffi.bhaible/test-call.c   | 1745 ++++
> > >  .../testsuite/libffi.bhaible/test-callback.c  | 2885 ++++++
> > >  libffi/testsuite/libffi.bhaible/testcases.c   |  747 ++
> > >  libffi/testsuite/libffi.call/align_mixed.c    |   46 +
> > >  libffi/testsuite/libffi.call/align_stdcall.c  |   46 +
> > >  libffi/testsuite/libffi.call/call.exp         |   28 +-
> > >  libffi/testsuite/libffi.call/cls_uchar_va.c   |   44 -
> > >  libffi/testsuite/libffi.call/cls_ushort_va.c  |   44 -
> > >  libffi/testsuite/libffi.call/ffitest.h        |   13 +-
> > >  libffi/testsuite/libffi.call/float2.c         |   23 +-
> > >  libffi/testsuite/libffi.call/offsets.c        |   46 +
> > >  libffi/testsuite/libffi.call/struct10.c       |   57 +
> > >  libffi/testsuite/libffi.call/va_1.c           |  120 +-
> > >  libffi/testsuite/libffi.call/va_2.c           |  196 +
> > >  libffi/testsuite/libffi.closures/closure.exp  |   67 +
> > >  .../closure_fn0.c                             |    0
> > >  .../closure_fn1.c                             |    0
> > >  .../closure_fn2.c                             |    0
> > >  .../closure_fn3.c                             |    0
> > >  .../closure_fn4.c                             |    0
> > >  .../closure_fn5.c                             |    0
> > >  .../closure_fn6.c                             |    0
> > >  .../closure_loc_fn0.c                         |    3 +
> > >  .../closure_simple.c                          |    0
> > >  .../cls_12byte.c                              |    0
> > >  .../cls_16byte.c                              |    0
> > >  .../cls_18byte.c                              |    0
> > >  .../cls_19byte.c                              |    0
> > >  .../cls_1_1byte.c                             |    0
> > >  .../cls_20byte.c                              |    2 +-
> > >  .../cls_20byte1.c                             |    2 +-
> > >  .../cls_24byte.c                              |    6 +-
> > >  .../cls_2byte.c                               |    0
> > >  .../cls_3_1byte.c                             |    0
> > >  .../cls_3byte1.c                              |    0
> > >  .../cls_3byte2.c                              |    0
> > >  libffi/testsuite/libffi.closures/cls_3float.c |   95 +
> > >  .../cls_4_1byte.c                             |    0
> > >  .../cls_4byte.c                               |    0
> > >  .../cls_5_1_byte.c                            |    2 +-
> > >  .../cls_5byte.c                               |    2 +-
> > >  .../cls_64byte.c                              |    0
> > >  .../cls_6_1_byte.c                            |    2 +-
> > >  .../cls_6byte.c                               |    2 +-
> > >  .../cls_7_1_byte.c                            |    2 +-
> > >  .../cls_7byte.c                               |    2 +-
> > >  .../cls_8byte.c                               |    0
> > >  .../cls_9byte1.c                              |    2 +-
> > >  .../cls_9byte2.c                              |    2 +-
> > >  .../cls_align_double.c                        |    2 +-
> > >  .../cls_align_float.c                         |    2 +-
> > >  .../cls_align_longdouble.c                    |    2 +-
> > >  .../cls_align_longdouble_split.c              |    2 +-
> > >  .../cls_align_longdouble_split2.c             |    2 +-
> > >  .../cls_align_pointer.c                       |    2 +-
> > >  .../cls_align_sint16.c                        |    2 +-
> > >  .../cls_align_sint32.c                        |    2 +-
> > >  .../cls_align_sint64.c                        |    2 +-
> > >  .../cls_align_uint16.c                        |    2 +-
> > >  .../cls_align_uint32.c                        |    2 +-
> > >  .../cls_align_uint64.c                        |    2 +-
> > >  .../cls_dbls_struct.c                         |    6 +-
> > >  .../cls_double.c                              |    0
> > >  .../cls_double_va.c                           |    0
> > >  .../cls_float.c                               |    0
> > >  .../cls_longdouble.c                          |    0
> > >  .../cls_longdouble_va.c                       |    0
> > >  .../cls_many_mixed_args.c                     |    0
> > >  .../cls_many_mixed_float_double.c             |    0
> > >  .../cls_multi_schar.c                         |    2 +-
> > >  .../cls_multi_sshort.c                        |    2 +-
> > >  .../cls_multi_sshortchar.c                    |    2 +-
> > >  .../cls_multi_uchar.c                         |    2 +-
> > >  .../cls_multi_ushort.c                        |    2 +-
> > >  .../cls_multi_ushortchar.c                    |    2 +-
> > >  .../cls_pointer.c                             |    0
> > >  .../cls_pointer_stack.c                       |    0
> > >  .../cls_schar.c                               |    0
> > >  .../cls_sint.c                                |    0
> > >  .../cls_sshort.c                              |    0
> > >  .../cls_struct_va1.c                          |    0
> > >  .../cls_uchar.c                               |    0
> > >  .../cls_uint.c                                |    0
> > >  .../cls_uint_va.c                             |    0
> > >  .../cls_ulong_va.c                            |    0
> > >  .../cls_ulonglong.c                           |    0
> > >  .../cls_ushort.c                              |    0
> > >  .../err_bad_abi.c                             |    0
> > >  libffi/testsuite/libffi.closures/ffitest.h    |  144 +
> > >  .../huge_struct.c                             |    4 +-
> > >  .../nested_struct.c                           |    2 +-
> > >  .../nested_struct1.c                          |    2 +-
> > >  .../nested_struct10.c                         |    1 +
> > >  .../nested_struct11.c                         |    0
> > >  .../libffi.closures/nested_struct12.c         |   86 +
> > >  .../nested_struct13.c}                        |   14 +-
> > >  .../nested_struct2.c                          |    2 +-
> > >  .../nested_struct3.c                          |    2 +-
> > >  .../nested_struct4.c                          |    0
> > >  .../nested_struct5.c                          |    0
> > >  .../nested_struct6.c                          |    0
> > >  .../nested_struct7.c                          |    0
> > >  .../nested_struct8.c                          |    0
> > >  .../nested_struct9.c                          |    0
> > >  .../problem1.c                                |    0
> > >  .../libffi.closures/single_entry_structs1.c   |   86 +
> > >  .../libffi.closures/single_entry_structs2.c   |  102 +
> > >  .../libffi.closures/single_entry_structs3.c   |  101 +
> > >  .../stret_large.c                             |    0
> > >  .../stret_large2.c                            |    0
> > >  .../stret_medium.c                            |    2 +-
> > >  .../stret_medium2.c                           |    2 +-
> > >  .../testclosure.c                             |    2 +-
> > >  .../unwindtest.cc                             |   13 +-
> > >  .../unwindtest_ffi_call.cc                    |    5 +-
> > >  libffi/testsuite/libffi.go/static-chain.h     |    6 -
> > >  libffi/testsuite/libffi.special/ffitestcxx.h  |   96 -
> > >  libffi/testsuite/libffi.special/special.exp   |   35 -
> > >  239 files changed, 24951 insertions(+), 6175 deletions(-)
> > >  create mode 100644 libffi/.gitattributes
> > >  create mode 100644 libffi/HOWTO_MERGE
> > >  create mode 100644 libffi/LICENSE-BUILDTOOLS
> > >  create mode 100644 libffi/MERGE
> > >  delete mode 100644 libffi/README
> > >  create mode 100644 libffi/README.md
> > >  create mode 100755 libffi/autogen.sh
> > >  create mode 100644 libffi/doc/Makefile.am
> > >  mode change 100644 => 100755 libffi/generate-darwin-source-and-headers.py
> > >  create mode 100644 libffi/include/tramp.h
> > >  mode change 100644 => 100755 libffi/mdate-sh
> > >  create mode 100755 libffi/merge.sh
> > >  create mode 100644 libffi/src/aarch64/win64_armasm.S
> > >  create mode 100644 libffi/src/arm/sysv_msvc_arm32.S
> > >  create mode 100644 libffi/src/csky/ffi.c
> > >  create mode 100644 libffi/src/csky/ffitarget.h
> > >  create mode 100644 libffi/src/csky/sysv.S
> > >  create mode 100644 libffi/src/kvx/asm.h
> > >  create mode 100644 libffi/src/kvx/ffi.c
> > >  create mode 100644 libffi/src/kvx/ffitarget.h
> > >  create mode 100644 libffi/src/kvx/sysv.S
> > >  create mode 100644 libffi/src/tramp.c
> > >  create mode 100644 libffi/src/x86/asmnames.h
> > >  delete mode 100644 libffi/src/x86/darwin.S
> > >  delete mode 100644 libffi/src/x86/darwin64.S
> > >  delete mode 100644 libffi/src/x86/darwin64_c.c
> > >  delete mode 100644 libffi/src/x86/darwin_c.c
> > >  create mode 100644 libffi/src/x86/sysv_intel.S
> > >  create mode 100644 libffi/src/x86/win64_intel.S
> > >  create mode 100644 libffi/testsuite/libffi.bhaible/Makefile
> > >  create mode 100644 libffi/testsuite/libffi.bhaible/README
> > >  create mode 100644 libffi/testsuite/libffi.bhaible/alignof.h
> > >  create mode 100644 libffi/testsuite/libffi.bhaible/bhaible.exp
> > >  create mode 100644 libffi/testsuite/libffi.bhaible/test-call.c
> > >  create mode 100644 libffi/testsuite/libffi.bhaible/test-callback.c
> > >  create mode 100644 libffi/testsuite/libffi.bhaible/testcases.c
> > >  create mode 100644 libffi/testsuite/libffi.call/align_mixed.c
> > >  create mode 100644 libffi/testsuite/libffi.call/align_stdcall.c
> > >  delete mode 100644 libffi/testsuite/libffi.call/cls_uchar_va.c
> > >  delete mode 100644 libffi/testsuite/libffi.call/cls_ushort_va.c
> > >  create mode 100644 libffi/testsuite/libffi.call/offsets.c
> > >  create mode 100644 libffi/testsuite/libffi.call/struct10.c
> > >  create mode 100644 libffi/testsuite/libffi.call/va_2.c
> > >  create mode 100644 libffi/testsuite/libffi.closures/closure.exp
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn0.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn1.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn2.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn3.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn4.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn5.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn6.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_loc_fn0.c (96%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_simple.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_12byte.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_16byte.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_18byte.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_19byte.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_1_1byte.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte1.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_24byte.c (95%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_2byte.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3_1byte.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte1.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte2.c (100%)
> > >  create mode 100644 libffi/testsuite/libffi.closures/cls_3float.c
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4_1byte.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4byte.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5_1_byte.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5byte.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_64byte.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6_1_byte.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6byte.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7_1_byte.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7byte.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_8byte.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte1.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte2.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_double.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_float.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split.c (98%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split2.c (98%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_pointer.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint16.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint32.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint64.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint16.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint32.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint64.c (97%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_dbls_struct.c (92%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double_va.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_float.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble_va.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_args.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_float_double.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_schar.c (96%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshort.c (96%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshortchar.c (96%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_uchar.c (96%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushort.c (95%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushortchar.c (96%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer_stack.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_schar.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sint.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sshort.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_struct_va1.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uchar.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint_va.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulong_va.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulonglong.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ushort.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/err_bad_abi.c (100%)
> > >  create mode 100644 libffi/testsuite/libffi.closures/ffitest.h
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/huge_struct.c (99%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct.c (98%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct1.c (98%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct10.c (99%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct11.c (100%)
> > >  create mode 100644 libffi/testsuite/libffi.closures/nested_struct12.c
> > >  rename libffi/testsuite/{libffi.call/nested_struct12.c => libffi.closures/nested_struct13.c} (88%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct2.c (98%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct3.c (98%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct4.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct5.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct6.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct7.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct8.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct9.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/problem1.c (100%)
> > >  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs1.c
> > >  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs2.c
> > >  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs3.c
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large2.c (100%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium.c (98%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium2.c (98%)
> > >  rename libffi/testsuite/{libffi.call => libffi.closures}/testclosure.c (95%)
> > >  rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest.cc (95%)
> > >  rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest_ffi_call.cc (94%)
> > >  delete mode 100644 libffi/testsuite/libffi.special/ffitestcxx.h
> > >  delete mode 100644 libffi/testsuite/libffi.special/special.exp
> > >
> > > --
> > > 2.31.1
> > >
>
>
>
> --
> H.J.
H.J. Lu Oct. 13, 2021, 1:42 p.m. UTC | #5
On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > <richard.guenther@gmail.com> wrote:
> > >
> > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > Change in the v2 patch:
> > > >
> > > > 1. Disable static trampolines by default.
> > > >
> > > >
> > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > has been changed significantly with new features, bug fixes and new target
> > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > make it easier to sync with libffi upstream:
> > > >
> > > > 1. Document how to sync with upstream.
> > > > 2. Add scripts to help sync with upstream.
> > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > >
> > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > 4. Integrate libffi build and testsuite with GCC.
> > >
> > > How did you test this?  It looks like libgo is the only consumer of
> > > libffi these days.
> > > In particular go/libgo seems to be supported on almost all targets besides
> > > darwin/windows - did you test cross and canadian configurations?
> >
> > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > the upstream libffi works on Darwin and Windows.
> >
> > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > of this massive diff.
> >
> > I believe that it should just work.  Our libffi is very much out of date.
>
> Yes, you can hope.  And yes, our libffi is out of date.
>
> Can you please do the extra step to test one weird architecture, namely
> powerpc64-aix which is available on the compile-farm?

I will give it a try and report back.

> If that goes well I think it's good to "hope" at this point (and plenty of
> time to fix fallout until the GCC 12 release).
>
> Thus OK after the extra testing dance and waiting until early next
> week so others can throw in a veto.
>
> Thanks,
> Richard.
>
> > > I suppose the SONAME changes after the sync?
> >
> > Yes, SONAME is synced with upstream which was updated.
> >
> > > Thanks,
> > > Richard.
> > >
> > > > H.J. Lu (4):
> > > >   libffi: Add HOWTO_MERGE, autogen.sh and merge.sh
> > > >   libffi: Sync with libffi 3.4.2
> > > >   libffi: Integrate build with GCC
> > > >   libffi: Integrate testsuite with GCC testsuite
> > > >
> > > >  libffi/.gitattributes                         |    4 +
> > > >  libffi/ChangeLog.libffi                       | 7743 ++++++++++++++++-
> > > >  libffi/HOWTO_MERGE                            |   13 +
> > > >  libffi/LICENSE                                |    2 +-
> > > >  libffi/LICENSE-BUILDTOOLS                     |  353 +
> > > >  libffi/MERGE                                  |    4 +
> > > >  libffi/Makefile.am                            |  135 +-
> > > >  libffi/Makefile.in                            |  219 +-
> > > >  libffi/README                                 |  450 -
> > > >  libffi/README.md                              |  495 ++
> > > >  libffi/acinclude.m4                           |   38 +-
> > > >  libffi/autogen.sh                             |   11 +
> > > >  libffi/configure                              |  487 +-
> > > >  libffi/configure.ac                           |   91 +-
> > > >  libffi/configure.host                         |   97 +-
> > > >  libffi/doc/Makefile.am                        |    3 +
> > > >  libffi/doc/libffi.texi                        |  382 +-
> > > >  libffi/doc/version.texi                       |    8 +-
> > > >  libffi/fficonfig.h.in                         |   21 +-
> > > >  libffi/generate-darwin-source-and-headers.py  |  143 +-
> > > >  libffi/include/Makefile.am                    |    2 +-
> > > >  libffi/include/Makefile.in                    |    3 +-
> > > >  libffi/include/ffi.h.in                       |  213 +-
> > > >  libffi/include/ffi_cfi.h                      |   21 +
> > > >  libffi/include/ffi_common.h                   |   50 +-
> > > >  libffi/include/tramp.h                        |   45 +
> > > >  libffi/libffi.map.in                          |   24 +-
> > > >  libffi/libffi.pc.in                           |    2 +-
> > > >  libffi/libffi.xcodeproj/project.pbxproj       |  530 +-
> > > >  libffi/libtool-version                        |   25 +-
> > > >  libffi/man/Makefile.in                        |    1 +
> > > >  libffi/mdate-sh                               |   39 +-
> > > >  libffi/merge.sh                               |   51 +
> > > >  libffi/msvcc.sh                               |  134 +-
> > > >  libffi/src/aarch64/ffi.c                      |  536 +-
> > > >  libffi/src/aarch64/ffitarget.h                |   35 +-
> > > >  libffi/src/aarch64/internal.h                 |   33 +
> > > >  libffi/src/aarch64/sysv.S                     |  189 +-
> > > >  libffi/src/aarch64/win64_armasm.S             |  506 ++
> > > >  libffi/src/alpha/ffi.c                        |    6 +-
> > > >  libffi/src/arc/ffi.c                          |    6 +-
> > > >  libffi/src/arm/ffi.c                          |  380 +-
> > > >  libffi/src/arm/ffitarget.h                    |   24 +-
> > > >  libffi/src/arm/internal.h                     |   10 +
> > > >  libffi/src/arm/sysv.S                         |  304 +-
> > > >  libffi/src/arm/sysv_msvc_arm32.S              |  311 +
> > > >  libffi/src/closures.c                         |  489 +-
> > > >  libffi/src/cris/ffi.c                         |    4 +-
> > > >  libffi/src/csky/ffi.c                         |  395 +
> > > >  libffi/src/csky/ffitarget.h                   |   63 +
> > > >  libffi/src/csky/sysv.S                        |  371 +
> > > >  libffi/src/dlmalloc.c                         |    7 +-
> > > >  libffi/src/frv/ffi.c                          |    4 +-
> > > >  libffi/src/ia64/ffi.c                         |   30 +-
> > > >  libffi/src/ia64/ffitarget.h                   |    3 +-
> > > >  libffi/src/ia64/unix.S                        |    9 +-
> > > >  libffi/src/java_raw_api.c                     |    6 +-
> > > >  libffi/src/kvx/asm.h                          |    5 +
> > > >  libffi/src/kvx/ffi.c                          |  273 +
> > > >  libffi/src/kvx/ffitarget.h                    |   75 +
> > > >  libffi/src/kvx/sysv.S                         |  127 +
> > > >  libffi/src/m32r/ffi.c                         |    2 +-
> > > >  libffi/src/m68k/ffi.c                         |    4 +-
> > > >  libffi/src/m68k/sysv.S                        |   29 +-
> > > >  libffi/src/m88k/ffi.c                         |    8 +-
> > > >  libffi/src/metag/ffi.c                        |   14 +-
> > > >  libffi/src/microblaze/ffi.c                   |   10 +-
> > > >  libffi/src/mips/ffi.c                         |  146 +-
> > > >  libffi/src/mips/ffitarget.h                   |   23 +-
> > > >  libffi/src/mips/n32.S                         |  151 +-
> > > >  libffi/src/mips/o32.S                         |  177 +-
> > > >  libffi/src/moxie/eabi.S                       |    2 +-
> > > >  libffi/src/moxie/ffi.c                        |   27 +-
> > > >  libffi/src/nios2/ffi.c                        |    4 +-
> > > >  libffi/src/pa/ffi.c                           |  216 +-
> > > >  libffi/src/pa/ffitarget.h                     |   11 +-
> > > >  libffi/src/pa/hpux32.S                        |   76 +-
> > > >  libffi/src/pa/linux.S                         |  160 +-
> > > >  libffi/src/powerpc/asm.h                      |    4 +-
> > > >  libffi/src/powerpc/darwin_closure.S           |    6 +-
> > > >  libffi/src/powerpc/ffi.c                      |   10 +-
> > > >  libffi/src/powerpc/ffi_darwin.c               |   48 +-
> > > >  libffi/src/powerpc/ffi_linux64.c              |  247 +-
> > > >  libffi/src/powerpc/ffi_powerpc.h              |   25 +-
> > > >  libffi/src/powerpc/ffitarget.h                |   14 +-
> > > >  libffi/src/powerpc/linux64.S                  |  111 +-
> > > >  libffi/src/powerpc/linux64_closure.S          |   70 +-
> > > >  libffi/src/powerpc/sysv.S                     |   12 +-
> > > >  libffi/src/prep_cif.c                         |   64 +-
> > > >  libffi/src/raw_api.c                          |   10 +-
> > > >  libffi/src/riscv/ffi.c                        |   16 +-
> > > >  libffi/src/sparc/ffi.c                        |    6 +-
> > > >  libffi/src/sparc/ffi64.c                      |   18 +-
> > > >  libffi/src/tramp.c                            |  729 ++
> > > >  libffi/src/types.c                            |    4 +-
> > > >  libffi/src/vax/ffi.c                          |    4 +-
> > > >  libffi/src/x86/asmnames.h                     |   30 +
> > > >  libffi/src/x86/darwin.S                       |  444 -
> > > >  libffi/src/x86/darwin64.S                     |  416 -
> > > >  libffi/src/x86/darwin64_c.c                   |  643 --
> > > >  libffi/src/x86/darwin_c.c                     |  843 --
> > > >  libffi/src/x86/ffi.c                          |  162 +-
> > > >  libffi/src/x86/ffi64.c                        |  164 +-
> > > >  libffi/src/x86/ffitarget.h                    |   42 +-
> > > >  libffi/src/x86/ffiw64.c                       |  114 +-
> > > >  libffi/src/x86/internal.h                     |   14 +
> > > >  libffi/src/x86/internal64.h                   |   14 +
> > > >  libffi/src/x86/sysv.S                         |  215 +-
> > > >  libffi/src/x86/sysv_intel.S                   |  995 +++
> > > >  libffi/src/x86/unix64.S                       |  204 +-
> > > >  libffi/src/x86/win64.S                        |  170 +-
> > > >  libffi/src/x86/win64_intel.S                  |  238 +
> > > >  libffi/src/xtensa/ffi.c                       |    4 +-
> > > >  libffi/src/xtensa/sysv.S                      |    7 +-
> > > >  libffi/testsuite/Makefile.am                  |  206 +-
> > > >  libffi/testsuite/Makefile.in                  |  210 +-
> > > >  libffi/testsuite/lib/libffi.exp               |  294 +-
> > > >  libffi/testsuite/libffi.bhaible/Makefile      |   28 +
> > > >  libffi/testsuite/libffi.bhaible/README        |   78 +
> > > >  libffi/testsuite/libffi.bhaible/alignof.h     |   50 +
> > > >  libffi/testsuite/libffi.bhaible/bhaible.exp   |   63 +
> > > >  libffi/testsuite/libffi.bhaible/test-call.c   | 1745 ++++
> > > >  .../testsuite/libffi.bhaible/test-callback.c  | 2885 ++++++
> > > >  libffi/testsuite/libffi.bhaible/testcases.c   |  747 ++
> > > >  libffi/testsuite/libffi.call/align_mixed.c    |   46 +
> > > >  libffi/testsuite/libffi.call/align_stdcall.c  |   46 +
> > > >  libffi/testsuite/libffi.call/call.exp         |   28 +-
> > > >  libffi/testsuite/libffi.call/cls_uchar_va.c   |   44 -
> > > >  libffi/testsuite/libffi.call/cls_ushort_va.c  |   44 -
> > > >  libffi/testsuite/libffi.call/ffitest.h        |   13 +-
> > > >  libffi/testsuite/libffi.call/float2.c         |   23 +-
> > > >  libffi/testsuite/libffi.call/offsets.c        |   46 +
> > > >  libffi/testsuite/libffi.call/struct10.c       |   57 +
> > > >  libffi/testsuite/libffi.call/va_1.c           |  120 +-
> > > >  libffi/testsuite/libffi.call/va_2.c           |  196 +
> > > >  libffi/testsuite/libffi.closures/closure.exp  |   67 +
> > > >  .../closure_fn0.c                             |    0
> > > >  .../closure_fn1.c                             |    0
> > > >  .../closure_fn2.c                             |    0
> > > >  .../closure_fn3.c                             |    0
> > > >  .../closure_fn4.c                             |    0
> > > >  .../closure_fn5.c                             |    0
> > > >  .../closure_fn6.c                             |    0
> > > >  .../closure_loc_fn0.c                         |    3 +
> > > >  .../closure_simple.c                          |    0
> > > >  .../cls_12byte.c                              |    0
> > > >  .../cls_16byte.c                              |    0
> > > >  .../cls_18byte.c                              |    0
> > > >  .../cls_19byte.c                              |    0
> > > >  .../cls_1_1byte.c                             |    0
> > > >  .../cls_20byte.c                              |    2 +-
> > > >  .../cls_20byte1.c                             |    2 +-
> > > >  .../cls_24byte.c                              |    6 +-
> > > >  .../cls_2byte.c                               |    0
> > > >  .../cls_3_1byte.c                             |    0
> > > >  .../cls_3byte1.c                              |    0
> > > >  .../cls_3byte2.c                              |    0
> > > >  libffi/testsuite/libffi.closures/cls_3float.c |   95 +
> > > >  .../cls_4_1byte.c                             |    0
> > > >  .../cls_4byte.c                               |    0
> > > >  .../cls_5_1_byte.c                            |    2 +-
> > > >  .../cls_5byte.c                               |    2 +-
> > > >  .../cls_64byte.c                              |    0
> > > >  .../cls_6_1_byte.c                            |    2 +-
> > > >  .../cls_6byte.c                               |    2 +-
> > > >  .../cls_7_1_byte.c                            |    2 +-
> > > >  .../cls_7byte.c                               |    2 +-
> > > >  .../cls_8byte.c                               |    0
> > > >  .../cls_9byte1.c                              |    2 +-
> > > >  .../cls_9byte2.c                              |    2 +-
> > > >  .../cls_align_double.c                        |    2 +-
> > > >  .../cls_align_float.c                         |    2 +-
> > > >  .../cls_align_longdouble.c                    |    2 +-
> > > >  .../cls_align_longdouble_split.c              |    2 +-
> > > >  .../cls_align_longdouble_split2.c             |    2 +-
> > > >  .../cls_align_pointer.c                       |    2 +-
> > > >  .../cls_align_sint16.c                        |    2 +-
> > > >  .../cls_align_sint32.c                        |    2 +-
> > > >  .../cls_align_sint64.c                        |    2 +-
> > > >  .../cls_align_uint16.c                        |    2 +-
> > > >  .../cls_align_uint32.c                        |    2 +-
> > > >  .../cls_align_uint64.c                        |    2 +-
> > > >  .../cls_dbls_struct.c                         |    6 +-
> > > >  .../cls_double.c                              |    0
> > > >  .../cls_double_va.c                           |    0
> > > >  .../cls_float.c                               |    0
> > > >  .../cls_longdouble.c                          |    0
> > > >  .../cls_longdouble_va.c                       |    0
> > > >  .../cls_many_mixed_args.c                     |    0
> > > >  .../cls_many_mixed_float_double.c             |    0
> > > >  .../cls_multi_schar.c                         |    2 +-
> > > >  .../cls_multi_sshort.c                        |    2 +-
> > > >  .../cls_multi_sshortchar.c                    |    2 +-
> > > >  .../cls_multi_uchar.c                         |    2 +-
> > > >  .../cls_multi_ushort.c                        |    2 +-
> > > >  .../cls_multi_ushortchar.c                    |    2 +-
> > > >  .../cls_pointer.c                             |    0
> > > >  .../cls_pointer_stack.c                       |    0
> > > >  .../cls_schar.c                               |    0
> > > >  .../cls_sint.c                                |    0
> > > >  .../cls_sshort.c                              |    0
> > > >  .../cls_struct_va1.c                          |    0
> > > >  .../cls_uchar.c                               |    0
> > > >  .../cls_uint.c                                |    0
> > > >  .../cls_uint_va.c                             |    0
> > > >  .../cls_ulong_va.c                            |    0
> > > >  .../cls_ulonglong.c                           |    0
> > > >  .../cls_ushort.c                              |    0
> > > >  .../err_bad_abi.c                             |    0
> > > >  libffi/testsuite/libffi.closures/ffitest.h    |  144 +
> > > >  .../huge_struct.c                             |    4 +-
> > > >  .../nested_struct.c                           |    2 +-
> > > >  .../nested_struct1.c                          |    2 +-
> > > >  .../nested_struct10.c                         |    1 +
> > > >  .../nested_struct11.c                         |    0
> > > >  .../libffi.closures/nested_struct12.c         |   86 +
> > > >  .../nested_struct13.c}                        |   14 +-
> > > >  .../nested_struct2.c                          |    2 +-
> > > >  .../nested_struct3.c                          |    2 +-
> > > >  .../nested_struct4.c                          |    0
> > > >  .../nested_struct5.c                          |    0
> > > >  .../nested_struct6.c                          |    0
> > > >  .../nested_struct7.c                          |    0
> > > >  .../nested_struct8.c                          |    0
> > > >  .../nested_struct9.c                          |    0
> > > >  .../problem1.c                                |    0
> > > >  .../libffi.closures/single_entry_structs1.c   |   86 +
> > > >  .../libffi.closures/single_entry_structs2.c   |  102 +
> > > >  .../libffi.closures/single_entry_structs3.c   |  101 +
> > > >  .../stret_large.c                             |    0
> > > >  .../stret_large2.c                            |    0
> > > >  .../stret_medium.c                            |    2 +-
> > > >  .../stret_medium2.c                           |    2 +-
> > > >  .../testclosure.c                             |    2 +-
> > > >  .../unwindtest.cc                             |   13 +-
> > > >  .../unwindtest_ffi_call.cc                    |    5 +-
> > > >  libffi/testsuite/libffi.go/static-chain.h     |    6 -
> > > >  libffi/testsuite/libffi.special/ffitestcxx.h  |   96 -
> > > >  libffi/testsuite/libffi.special/special.exp   |   35 -
> > > >  239 files changed, 24951 insertions(+), 6175 deletions(-)
> > > >  create mode 100644 libffi/.gitattributes
> > > >  create mode 100644 libffi/HOWTO_MERGE
> > > >  create mode 100644 libffi/LICENSE-BUILDTOOLS
> > > >  create mode 100644 libffi/MERGE
> > > >  delete mode 100644 libffi/README
> > > >  create mode 100644 libffi/README.md
> > > >  create mode 100755 libffi/autogen.sh
> > > >  create mode 100644 libffi/doc/Makefile.am
> > > >  mode change 100644 => 100755 libffi/generate-darwin-source-and-headers.py
> > > >  create mode 100644 libffi/include/tramp.h
> > > >  mode change 100644 => 100755 libffi/mdate-sh
> > > >  create mode 100755 libffi/merge.sh
> > > >  create mode 100644 libffi/src/aarch64/win64_armasm.S
> > > >  create mode 100644 libffi/src/arm/sysv_msvc_arm32.S
> > > >  create mode 100644 libffi/src/csky/ffi.c
> > > >  create mode 100644 libffi/src/csky/ffitarget.h
> > > >  create mode 100644 libffi/src/csky/sysv.S
> > > >  create mode 100644 libffi/src/kvx/asm.h
> > > >  create mode 100644 libffi/src/kvx/ffi.c
> > > >  create mode 100644 libffi/src/kvx/ffitarget.h
> > > >  create mode 100644 libffi/src/kvx/sysv.S
> > > >  create mode 100644 libffi/src/tramp.c
> > > >  create mode 100644 libffi/src/x86/asmnames.h
> > > >  delete mode 100644 libffi/src/x86/darwin.S
> > > >  delete mode 100644 libffi/src/x86/darwin64.S
> > > >  delete mode 100644 libffi/src/x86/darwin64_c.c
> > > >  delete mode 100644 libffi/src/x86/darwin_c.c
> > > >  create mode 100644 libffi/src/x86/sysv_intel.S
> > > >  create mode 100644 libffi/src/x86/win64_intel.S
> > > >  create mode 100644 libffi/testsuite/libffi.bhaible/Makefile
> > > >  create mode 100644 libffi/testsuite/libffi.bhaible/README
> > > >  create mode 100644 libffi/testsuite/libffi.bhaible/alignof.h
> > > >  create mode 100644 libffi/testsuite/libffi.bhaible/bhaible.exp
> > > >  create mode 100644 libffi/testsuite/libffi.bhaible/test-call.c
> > > >  create mode 100644 libffi/testsuite/libffi.bhaible/test-callback.c
> > > >  create mode 100644 libffi/testsuite/libffi.bhaible/testcases.c
> > > >  create mode 100644 libffi/testsuite/libffi.call/align_mixed.c
> > > >  create mode 100644 libffi/testsuite/libffi.call/align_stdcall.c
> > > >  delete mode 100644 libffi/testsuite/libffi.call/cls_uchar_va.c
> > > >  delete mode 100644 libffi/testsuite/libffi.call/cls_ushort_va.c
> > > >  create mode 100644 libffi/testsuite/libffi.call/offsets.c
> > > >  create mode 100644 libffi/testsuite/libffi.call/struct10.c
> > > >  create mode 100644 libffi/testsuite/libffi.call/va_2.c
> > > >  create mode 100644 libffi/testsuite/libffi.closures/closure.exp
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn0.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn1.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn2.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn3.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn4.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn5.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_fn6.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_loc_fn0.c (96%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/closure_simple.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_12byte.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_16byte.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_18byte.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_19byte.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_1_1byte.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_20byte1.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_24byte.c (95%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_2byte.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3_1byte.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte1.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_3byte2.c (100%)
> > > >  create mode 100644 libffi/testsuite/libffi.closures/cls_3float.c
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4_1byte.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_4byte.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5_1_byte.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_5byte.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_64byte.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6_1_byte.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_6byte.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7_1_byte.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_7byte.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_8byte.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte1.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_9byte2.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_double.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_float.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split.c (98%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_longdouble_split2.c (98%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_pointer.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint16.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint32.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_sint64.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint16.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint32.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_align_uint64.c (97%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_dbls_struct.c (92%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_double_va.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_float.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_longdouble_va.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_args.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_many_mixed_float_double.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_schar.c (96%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshort.c (96%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_sshortchar.c (96%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_uchar.c (96%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushort.c (95%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_multi_ushortchar.c (96%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_pointer_stack.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_schar.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sint.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_sshort.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_struct_va1.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uchar.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_uint_va.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulong_va.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ulonglong.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/cls_ushort.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/err_bad_abi.c (100%)
> > > >  create mode 100644 libffi/testsuite/libffi.closures/ffitest.h
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/huge_struct.c (99%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct.c (98%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct1.c (98%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct10.c (99%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct11.c (100%)
> > > >  create mode 100644 libffi/testsuite/libffi.closures/nested_struct12.c
> > > >  rename libffi/testsuite/{libffi.call/nested_struct12.c => libffi.closures/nested_struct13.c} (88%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct2.c (98%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct3.c (98%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct4.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct5.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct6.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct7.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct8.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/nested_struct9.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/problem1.c (100%)
> > > >  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs1.c
> > > >  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs2.c
> > > >  create mode 100644 libffi/testsuite/libffi.closures/single_entry_structs3.c
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_large2.c (100%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium.c (98%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/stret_medium2.c (98%)
> > > >  rename libffi/testsuite/{libffi.call => libffi.closures}/testclosure.c (95%)
> > > >  rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest.cc (95%)
> > > >  rename libffi/testsuite/{libffi.special => libffi.closures}/unwindtest_ffi_call.cc (94%)
> > > >  delete mode 100644 libffi/testsuite/libffi.special/ffitestcxx.h
> > > >  delete mode 100644 libffi/testsuite/libffi.special/special.exp
> > > >
> > > > --
> > > > 2.31.1
> > > >
> >
> >
> >
> > --
> > H.J.
H.J. Lu Oct. 16, 2021, 12:06 a.m. UTC | #6
On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> <richard.guenther@gmail.com> wrote:
> >
> > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > <richard.guenther@gmail.com> wrote:
> > > >
> > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > >
> > > > > Change in the v2 patch:
> > > > >
> > > > > 1. Disable static trampolines by default.
> > > > >
> > > > >
> > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > has been changed significantly with new features, bug fixes and new target
> > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > make it easier to sync with libffi upstream:
> > > > >
> > > > > 1. Document how to sync with upstream.
> > > > > 2. Add scripts to help sync with upstream.
> > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > >
> > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > 4. Integrate libffi build and testsuite with GCC.
> > > >
> > > > How did you test this?  It looks like libgo is the only consumer of
> > > > libffi these days.
> > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > darwin/windows - did you test cross and canadian configurations?
> > >
> > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > the upstream libffi works on Darwin and Windows.
> > >
> > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > of this massive diff.
> > >
> > > I believe that it should just work.  Our libffi is very much out of date.
> >
> > Yes, you can hope.  And yes, our libffi is out of date.
> >
> > Can you please do the extra step to test one weird architecture, namely
> > powerpc64-aix which is available on the compile-farm?
>
> I will give it a try and report back.
>
> > If that goes well I think it's good to "hope" at this point (and plenty of
> > time to fix fallout until the GCC 12 release).
> >
> > Thus OK after the extra testing dance and waiting until early next
> > week so others can throw in a veto.

I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:

*  MT/MODEL: 8284-22A                                                         *
* Partition: gcc119                                                           *
*    System: power8-aix.osuosl.org                                            *
*       O/S: AIX V7.2 7200-04-03-2038

I configured GCC with

--with-as=/usr/bin/as --with-ld=/usr/bin/ld
--enable-version-specific-runtime-libs --disable-nls
--enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
--enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
--with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
--with-local-prefix=/opt/freeware --enable-languages=c,c++,go

I got

g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
-Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
    build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
4.0/libiberty/libiberty.a
ld: 0711-317 ERROR: Undefined symbol: lexer_line
ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
ld: 0711-317 ERROR: Undefined symbol: .yyend()
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
Makefile:3000: recipe for target 'build/gengtype' failed
gmake[5]: *** [build/gengtype] Error 1

David, is there an instruction to bootstrap GCC on AIX?

Thanks.
David Edelsohn Oct. 16, 2021, 12:22 a.m. UTC | #7
On Fri, Oct 15, 2021 at 8:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> > <richard.guenther@gmail.com> wrote:
> > >
> > > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > > <richard.guenther@gmail.com> wrote:
> > > > >
> > > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > >
> > > > > > Change in the v2 patch:
> > > > > >
> > > > > > 1. Disable static trampolines by default.
> > > > > >
> > > > > >
> > > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > > has been changed significantly with new features, bug fixes and new target
> > > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > > make it easier to sync with libffi upstream:
> > > > > >
> > > > > > 1. Document how to sync with upstream.
> > > > > > 2. Add scripts to help sync with upstream.
> > > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > > >
> > > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > > 4. Integrate libffi build and testsuite with GCC.
> > > > >
> > > > > How did you test this?  It looks like libgo is the only consumer of
> > > > > libffi these days.
> > > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > > darwin/windows - did you test cross and canadian configurations?
> > > >
> > > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > > the upstream libffi works on Darwin and Windows.
> > > >
> > > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > > of this massive diff.
> > > >
> > > > I believe that it should just work.  Our libffi is very much out of date.
> > >
> > > Yes, you can hope.  And yes, our libffi is out of date.
> > >
> > > Can you please do the extra step to test one weird architecture, namely
> > > powerpc64-aix which is available on the compile-farm?
> >
> > I will give it a try and report back.
> >
> > > If that goes well I think it's good to "hope" at this point (and plenty of
> > > time to fix fallout until the GCC 12 release).
> > >
> > > Thus OK after the extra testing dance and waiting until early next
> > > week so others can throw in a veto.
>
> I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:
>
> *  MT/MODEL: 8284-22A                                                         *
> * Partition: gcc119                                                           *
> *    System: power8-aix.osuosl.org                                            *
> *       O/S: AIX V7.2 7200-04-03-2038
>
> I configured GCC with
>
> --with-as=/usr/bin/as --with-ld=/usr/bin/ld
> --enable-version-specific-runtime-libs --disable-nls
> --enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
> --enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
> --with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
> --with-local-prefix=/opt/freeware --enable-languages=c,c++,go
>
> I got
>
> g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
> -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
> tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
> overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
> c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
>     build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
> 4.0/libiberty/libiberty.a
> ld: 0711-317 ERROR: Undefined symbol: lexer_line
> ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
> ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
> ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
> ld: 0711-317 ERROR: Undefined symbol: .yyend()
> ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
> collect2: error: ld returned 8 exit status
> Makefile:3000: recipe for target 'build/gengtype' failed
> gmake[5]: *** [build/gengtype] Error 1
>
> David, is there an instruction to bootstrap GCC on AIX?

The CompileFarm page in the GCC wiki has instructions under "build tips":

https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines

The error that you show might be due to not having /opt/freeware/bin
first in your path and the bootstrap used the AIX version of lex or
sed or some other command.

Thanks, David
H.J. Lu Oct. 16, 2021, 11:48 a.m. UTC | #8
On Fri, Oct 15, 2021 at 5:22 PM David Edelsohn <dje.gcc@gmail.com> wrote:
>
> On Fri, Oct 15, 2021 at 8:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> > > <richard.guenther@gmail.com> wrote:
> > > >
> > > > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > >
> > > > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > > > <richard.guenther@gmail.com> wrote:
> > > > > >
> > > > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > >
> > > > > > > Change in the v2 patch:
> > > > > > >
> > > > > > > 1. Disable static trampolines by default.
> > > > > > >
> > > > > > >
> > > > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > > > has been changed significantly with new features, bug fixes and new target
> > > > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > > > make it easier to sync with libffi upstream:
> > > > > > >
> > > > > > > 1. Document how to sync with upstream.
> > > > > > > 2. Add scripts to help sync with upstream.
> > > > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > > > >
> > > > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > > > 4. Integrate libffi build and testsuite with GCC.
> > > > > >
> > > > > > How did you test this?  It looks like libgo is the only consumer of
> > > > > > libffi these days.
> > > > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > > > darwin/windows - did you test cross and canadian configurations?
> > > > >
> > > > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > > > the upstream libffi works on Darwin and Windows.
> > > > >
> > > > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > > > of this massive diff.
> > > > >
> > > > > I believe that it should just work.  Our libffi is very much out of date.
> > > >
> > > > Yes, you can hope.  And yes, our libffi is out of date.
> > > >
> > > > Can you please do the extra step to test one weird architecture, namely
> > > > powerpc64-aix which is available on the compile-farm?
> > >
> > > I will give it a try and report back.
> > >
> > > > If that goes well I think it's good to "hope" at this point (and plenty of
> > > > time to fix fallout until the GCC 12 release).
> > > >
> > > > Thus OK after the extra testing dance and waiting until early next
> > > > week so others can throw in a veto.
> >
> > I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:
> >
> > *  MT/MODEL: 8284-22A                                                         *
> > * Partition: gcc119                                                           *
> > *    System: power8-aix.osuosl.org                                            *
> > *       O/S: AIX V7.2 7200-04-03-2038
> >
> > I configured GCC with
> >
> > --with-as=/usr/bin/as --with-ld=/usr/bin/ld
> > --enable-version-specific-runtime-libs --disable-nls
> > --enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
> > --enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
> > --with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
> > --with-local-prefix=/opt/freeware --enable-languages=c,c++,go
> >
> > I got
> >
> > g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
> > -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
> > tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
> > overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
> > c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
> >     build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
> > 4.0/libiberty/libiberty.a
> > ld: 0711-317 ERROR: Undefined symbol: lexer_line
> > ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
> > ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
> > ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
> > ld: 0711-317 ERROR: Undefined symbol: .yyend()
> > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
> > collect2: error: ld returned 8 exit status
> > Makefile:3000: recipe for target 'build/gengtype' failed
> > gmake[5]: *** [build/gengtype] Error 1
> >
> > David, is there an instruction to bootstrap GCC on AIX?
>
> The CompileFarm page in the GCC wiki has instructions under "build tips":
>
> https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
>
> The error that you show might be due to not having /opt/freeware/bin
> first in your path and the bootstrap used the AIX version of lex or
> sed or some other command.
>

Hi David,

I made some progress.  I am trying to verify my libffi sync branch:

https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master

on powerpc64-aix.  Go is the only user of libffi.  But compiler farm
suggestion is

.../src/configure --disable-werror --enable-languages=c,c++
--with-gmp=/opt/cfarm --with-libiconv-prefix=/opt/cfarm
--disable-libstdcxx-pch --with-included-gettext

When I added Go with --enable-languages=c,c++,go, I got

/opt/freeware/bin/bash: missing-objcopy: command not found
/opt/freeware/bin/bash: missing-objcopy: command not found
/opt/freeware/bin/bash /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh build
cfg.go.tmp buildcfg.go
mv: 0653-401 Cannot rename internal/unsafeheader.s-gox.tmp to internal/unsafehea
der.gox:
             A file or directory in the path name does not exist.
mv: 0653-401 Cannot rename runtime/internal/atomic.s-gox.tmp to runtime/internal
/atomic.gox:
             A file or directory in the path name does not exist.
mv: 0653-401 Cannot rename internal/race.s-gox.tmp to internal/race.gox:
             A file or directory in the path name does not exist.
Makefile:3019: recipe for target 'runtime/internal/atomic.s-gox' failed
gmake[10]: *** [runtime/internal/atomic.s-gox] Error 1

Is Go supported on AIX? If yes, what did I do wrong?
David Edelsohn Oct. 16, 2021, 5:04 p.m. UTC | #9
On Sat, Oct 16, 2021 at 7:48 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Fri, Oct 15, 2021 at 5:22 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> >
> > On Fri, Oct 15, 2021 at 8:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> > > > <richard.guenther@gmail.com> wrote:
> > > > >
> > > > > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > >
> > > > > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > >
> > > > > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > >
> > > > > > > > Change in the v2 patch:
> > > > > > > >
> > > > > > > > 1. Disable static trampolines by default.
> > > > > > > >
> > > > > > > >
> > > > > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > > > > has been changed significantly with new features, bug fixes and new target
> > > > > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > > > > make it easier to sync with libffi upstream:
> > > > > > > >
> > > > > > > > 1. Document how to sync with upstream.
> > > > > > > > 2. Add scripts to help sync with upstream.
> > > > > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > > > > >
> > > > > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > > > > 4. Integrate libffi build and testsuite with GCC.
> > > > > > >
> > > > > > > How did you test this?  It looks like libgo is the only consumer of
> > > > > > > libffi these days.
> > > > > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > > > > darwin/windows - did you test cross and canadian configurations?
> > > > > >
> > > > > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > > > > the upstream libffi works on Darwin and Windows.
> > > > > >
> > > > > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > > > > of this massive diff.
> > > > > >
> > > > > > I believe that it should just work.  Our libffi is very much out of date.
> > > > >
> > > > > Yes, you can hope.  And yes, our libffi is out of date.
> > > > >
> > > > > Can you please do the extra step to test one weird architecture, namely
> > > > > powerpc64-aix which is available on the compile-farm?
> > > >
> > > > I will give it a try and report back.
> > > >
> > > > > If that goes well I think it's good to "hope" at this point (and plenty of
> > > > > time to fix fallout until the GCC 12 release).
> > > > >
> > > > > Thus OK after the extra testing dance and waiting until early next
> > > > > week so others can throw in a veto.
> > >
> > > I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:
> > >
> > > *  MT/MODEL: 8284-22A                                                         *
> > > * Partition: gcc119                                                           *
> > > *    System: power8-aix.osuosl.org                                            *
> > > *       O/S: AIX V7.2 7200-04-03-2038
> > >
> > > I configured GCC with
> > >
> > > --with-as=/usr/bin/as --with-ld=/usr/bin/ld
> > > --enable-version-specific-runtime-libs --disable-nls
> > > --enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
> > > --enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
> > > --with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
> > > --with-local-prefix=/opt/freeware --enable-languages=c,c++,go
> > >
> > > I got
> > >
> > > g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
> > > -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
> > > tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
> > > overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
> > > c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
> > >     build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
> > > 4.0/libiberty/libiberty.a
> > > ld: 0711-317 ERROR: Undefined symbol: lexer_line
> > > ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
> > > ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
> > > ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
> > > ld: 0711-317 ERROR: Undefined symbol: .yyend()
> > > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
> > > collect2: error: ld returned 8 exit status
> > > Makefile:3000: recipe for target 'build/gengtype' failed
> > > gmake[5]: *** [build/gengtype] Error 1
> > >
> > > David, is there an instruction to bootstrap GCC on AIX?
> >
> > The CompileFarm page in the GCC wiki has instructions under "build tips":
> >
> > https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> >
> > The error that you show might be due to not having /opt/freeware/bin
> > first in your path and the bootstrap used the AIX version of lex or
> > sed or some other command.
> >
>
> Hi David,
>
> I made some progress.  I am trying to verify my libffi sync branch:
>
> https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master
>
> on powerpc64-aix.  Go is the only user of libffi.  But compiler farm
> suggestion is
>
> .../src/configure --disable-werror --enable-languages=c,c++
> --with-gmp=/opt/cfarm --with-libiconv-prefix=/opt/cfarm
> --disable-libstdcxx-pch --with-included-gettext
>
> When I added Go with --enable-languages=c,c++,go, I got
>
> /opt/freeware/bin/bash: missing-objcopy: command not found
> /opt/freeware/bin/bash: missing-objcopy: command not found
> /opt/freeware/bin/bash /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh build
> cfg.go.tmp buildcfg.go
> mv: 0653-401 Cannot rename internal/unsafeheader.s-gox.tmp to internal/unsafehea
> der.gox:
>              A file or directory in the path name does not exist.
> mv: 0653-401 Cannot rename runtime/internal/atomic.s-gox.tmp to runtime/internal
> /atomic.gox:
>              A file or directory in the path name does not exist.
> mv: 0653-401 Cannot rename internal/race.s-gox.tmp to internal/race.gox:
>              A file or directory in the path name does not exist.
> Makefile:3019: recipe for target 'runtime/internal/atomic.s-gox' failed
> gmake[10]: *** [runtime/internal/atomic.s-gox] Error 1
>
> Is Go supported on AIX? If yes, what did I do wrong?

I believe that GCC Go works on AIX, but I have not been testing it
regularly.  There was more focus on GCC Go for AIX prior to the Golang
port to AIX.

It looks like the problem is that the objcopy command is not
installed.  There have been various issues with Binutils on AIX.  I'm
not certain if GCC Go had relied on objcopy or not.

Thanks, David
H.J. Lu Oct. 16, 2021, 5:13 p.m. UTC | #10
On Sat, Oct 16, 2021 at 10:04 AM David Edelsohn <dje.gcc@gmail.com> wrote:
>
> On Sat, Oct 16, 2021 at 7:48 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Fri, Oct 15, 2021 at 5:22 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> > >
> > > On Fri, Oct 15, 2021 at 8:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > >
> > > > > On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> > > > > <richard.guenther@gmail.com> wrote:
> > > > > >
> > > > > > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > >
> > > > > > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > >
> > > > > > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > Change in the v2 patch:
> > > > > > > > >
> > > > > > > > > 1. Disable static trampolines by default.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > > > > > has been changed significantly with new features, bug fixes and new target
> > > > > > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > > > > > make it easier to sync with libffi upstream:
> > > > > > > > >
> > > > > > > > > 1. Document how to sync with upstream.
> > > > > > > > > 2. Add scripts to help sync with upstream.
> > > > > > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > > > > > >
> > > > > > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > > > > > 4. Integrate libffi build and testsuite with GCC.
> > > > > > > >
> > > > > > > > How did you test this?  It looks like libgo is the only consumer of
> > > > > > > > libffi these days.
> > > > > > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > > > > > darwin/windows - did you test cross and canadian configurations?
> > > > > > >
> > > > > > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > > > > > the upstream libffi works on Darwin and Windows.
> > > > > > >
> > > > > > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > > > > > of this massive diff.
> > > > > > >
> > > > > > > I believe that it should just work.  Our libffi is very much out of date.
> > > > > >
> > > > > > Yes, you can hope.  And yes, our libffi is out of date.
> > > > > >
> > > > > > Can you please do the extra step to test one weird architecture, namely
> > > > > > powerpc64-aix which is available on the compile-farm?
> > > > >
> > > > > I will give it a try and report back.
> > > > >
> > > > > > If that goes well I think it's good to "hope" at this point (and plenty of
> > > > > > time to fix fallout until the GCC 12 release).
> > > > > >
> > > > > > Thus OK after the extra testing dance and waiting until early next
> > > > > > week so others can throw in a veto.
> > > >
> > > > I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:
> > > >
> > > > *  MT/MODEL: 8284-22A                                                         *
> > > > * Partition: gcc119                                                           *
> > > > *    System: power8-aix.osuosl.org                                            *
> > > > *       O/S: AIX V7.2 7200-04-03-2038
> > > >
> > > > I configured GCC with
> > > >
> > > > --with-as=/usr/bin/as --with-ld=/usr/bin/ld
> > > > --enable-version-specific-runtime-libs --disable-nls
> > > > --enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
> > > > --enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
> > > > --with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
> > > > --with-local-prefix=/opt/freeware --enable-languages=c,c++,go
> > > >
> > > > I got
> > > >
> > > > g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
> > > > -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
> > > > tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
> > > > overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
> > > > c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
> > > >     build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
> > > > 4.0/libiberty/libiberty.a
> > > > ld: 0711-317 ERROR: Undefined symbol: lexer_line
> > > > ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
> > > > ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
> > > > ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
> > > > ld: 0711-317 ERROR: Undefined symbol: .yyend()
> > > > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
> > > > collect2: error: ld returned 8 exit status
> > > > Makefile:3000: recipe for target 'build/gengtype' failed
> > > > gmake[5]: *** [build/gengtype] Error 1
> > > >
> > > > David, is there an instruction to bootstrap GCC on AIX?
> > >
> > > The CompileFarm page in the GCC wiki has instructions under "build tips":
> > >
> > > https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> > >
> > > The error that you show might be due to not having /opt/freeware/bin
> > > first in your path and the bootstrap used the AIX version of lex or
> > > sed or some other command.
> > >
> >
> > Hi David,
> >
> > I made some progress.  I am trying to verify my libffi sync branch:
> >
> > https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master
> >
> > on powerpc64-aix.  Go is the only user of libffi.  But compiler farm
> > suggestion is
> >
> > .../src/configure --disable-werror --enable-languages=c,c++
> > --with-gmp=/opt/cfarm --with-libiconv-prefix=/opt/cfarm
> > --disable-libstdcxx-pch --with-included-gettext
> >
> > When I added Go with --enable-languages=c,c++,go, I got
> >
> > /opt/freeware/bin/bash: missing-objcopy: command not found
> > /opt/freeware/bin/bash: missing-objcopy: command not found
> > /opt/freeware/bin/bash /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh build
> > cfg.go.tmp buildcfg.go
> > mv: 0653-401 Cannot rename internal/unsafeheader.s-gox.tmp to internal/unsafehea
> > der.gox:
> >              A file or directory in the path name does not exist.
> > mv: 0653-401 Cannot rename runtime/internal/atomic.s-gox.tmp to runtime/internal
> > /atomic.gox:
> >              A file or directory in the path name does not exist.
> > mv: 0653-401 Cannot rename internal/race.s-gox.tmp to internal/race.gox:
> >              A file or directory in the path name does not exist.
> > Makefile:3019: recipe for target 'runtime/internal/atomic.s-gox' failed
> > gmake[10]: *** [runtime/internal/atomic.s-gox] Error 1
> >
> > Is Go supported on AIX? If yes, what did I do wrong?
>
> I believe that GCC Go works on AIX, but I have not been testing it
> regularly.  There was more focus on GCC Go for AIX prior to the Golang
> port to AIX.
>
> It looks like the problem is that the objcopy command is not
> installed.  There have been various issues with Binutils on AIX.  I'm
> not certain if GCC Go had relied on objcopy or not.
>

Hi Richard,

Go on master branch isn't buildable on AIX.  What should I do
next to get my libffi sync patches into master branch?

Thanks.
Ian Lance Taylor Oct. 16, 2021, 7:21 p.m. UTC | #11
On Sat, Oct 16, 2021 at 10:14 AM H.J. Lu via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Go on master branch isn't buildable on AIX.  What should I do
> next to get my libffi sync patches into master branch?

Is the only problem you are having the missing-objcopy problem?  To
fix that one, install the GNU binutils.

There are people who regularly use gccgo on AIX and send fixes for it,
I don't think it could be very badly broken.

Ian
David Edelsohn Oct. 16, 2021, 7:53 p.m. UTC | #12
On Sat, Oct 16, 2021 at 1:13 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Sat, Oct 16, 2021 at 10:04 AM David Edelsohn <dje.gcc@gmail.com> wrote:
> >
> > On Sat, Oct 16, 2021 at 7:48 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Fri, Oct 15, 2021 at 5:22 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > >
> > > > On Fri, Oct 15, 2021 at 8:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > >
> > > > > On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > >
> > > > > > On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > >
> > > > > > > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > >
> > > > > > > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > >
> > > > > > > > > > Change in the v2 patch:
> > > > > > > > > >
> > > > > > > > > > 1. Disable static trampolines by default.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > > > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > > > > > > has been changed significantly with new features, bug fixes and new target
> > > > > > > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > > > > > > make it easier to sync with libffi upstream:
> > > > > > > > > >
> > > > > > > > > > 1. Document how to sync with upstream.
> > > > > > > > > > 2. Add scripts to help sync with upstream.
> > > > > > > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > > > > > > >
> > > > > > > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > > > > > > 4. Integrate libffi build and testsuite with GCC.
> > > > > > > > >
> > > > > > > > > How did you test this?  It looks like libgo is the only consumer of
> > > > > > > > > libffi these days.
> > > > > > > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > > > > > > darwin/windows - did you test cross and canadian configurations?
> > > > > > > >
> > > > > > > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > > > > > > the upstream libffi works on Darwin and Windows.
> > > > > > > >
> > > > > > > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > > > > > > of this massive diff.
> > > > > > > >
> > > > > > > > I believe that it should just work.  Our libffi is very much out of date.
> > > > > > >
> > > > > > > Yes, you can hope.  And yes, our libffi is out of date.
> > > > > > >
> > > > > > > Can you please do the extra step to test one weird architecture, namely
> > > > > > > powerpc64-aix which is available on the compile-farm?
> > > > > >
> > > > > > I will give it a try and report back.
> > > > > >
> > > > > > > If that goes well I think it's good to "hope" at this point (and plenty of
> > > > > > > time to fix fallout until the GCC 12 release).
> > > > > > >
> > > > > > > Thus OK after the extra testing dance and waiting until early next
> > > > > > > week so others can throw in a veto.
> > > > >
> > > > > I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:
> > > > >
> > > > > *  MT/MODEL: 8284-22A                                                         *
> > > > > * Partition: gcc119                                                           *
> > > > > *    System: power8-aix.osuosl.org                                            *
> > > > > *       O/S: AIX V7.2 7200-04-03-2038
> > > > >
> > > > > I configured GCC with
> > > > >
> > > > > --with-as=/usr/bin/as --with-ld=/usr/bin/ld
> > > > > --enable-version-specific-runtime-libs --disable-nls
> > > > > --enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
> > > > > --enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
> > > > > --with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
> > > > > --with-local-prefix=/opt/freeware --enable-languages=c,c++,go
> > > > >
> > > > > I got
> > > > >
> > > > > g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
> > > > > -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
> > > > > tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
> > > > > overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
> > > > > c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
> > > > >     build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
> > > > > 4.0/libiberty/libiberty.a
> > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_line
> > > > > ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
> > > > > ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
> > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
> > > > > ld: 0711-317 ERROR: Undefined symbol: .yyend()
> > > > > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
> > > > > collect2: error: ld returned 8 exit status
> > > > > Makefile:3000: recipe for target 'build/gengtype' failed
> > > > > gmake[5]: *** [build/gengtype] Error 1
> > > > >
> > > > > David, is there an instruction to bootstrap GCC on AIX?
> > > >
> > > > The CompileFarm page in the GCC wiki has instructions under "build tips":
> > > >
> > > > https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> > > >
> > > > The error that you show might be due to not having /opt/freeware/bin
> > > > first in your path and the bootstrap used the AIX version of lex or
> > > > sed or some other command.
> > > >
> > >
> > > Hi David,
> > >
> > > I made some progress.  I am trying to verify my libffi sync branch:
> > >
> > > https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master
> > >
> > > on powerpc64-aix.  Go is the only user of libffi.  But compiler farm
> > > suggestion is
> > >
> > > .../src/configure --disable-werror --enable-languages=c,c++
> > > --with-gmp=/opt/cfarm --with-libiconv-prefix=/opt/cfarm
> > > --disable-libstdcxx-pch --with-included-gettext
> > >
> > > When I added Go with --enable-languages=c,c++,go, I got
> > >
> > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > /opt/freeware/bin/bash /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh build
> > > cfg.go.tmp buildcfg.go
> > > mv: 0653-401 Cannot rename internal/unsafeheader.s-gox.tmp to internal/unsafehea
> > > der.gox:
> > >              A file or directory in the path name does not exist.
> > > mv: 0653-401 Cannot rename runtime/internal/atomic.s-gox.tmp to runtime/internal
> > > /atomic.gox:
> > >              A file or directory in the path name does not exist.
> > > mv: 0653-401 Cannot rename internal/race.s-gox.tmp to internal/race.gox:
> > >              A file or directory in the path name does not exist.
> > > Makefile:3019: recipe for target 'runtime/internal/atomic.s-gox' failed
> > > gmake[10]: *** [runtime/internal/atomic.s-gox] Error 1
> > >
> > > Is Go supported on AIX? If yes, what did I do wrong?
> >
> > I believe that GCC Go works on AIX, but I have not been testing it
> > regularly.  There was more focus on GCC Go for AIX prior to the Golang
> > port to AIX.
> >
> > It looks like the problem is that the objcopy command is not
> > installed.  There have been various issues with Binutils on AIX.  I'm
> > not certain if GCC Go had relied on objcopy or not.
> >
>
> Hi Richard,
>
> Go on master branch isn't buildable on AIX.  What should I do
> next to get my libffi sync patches into master branch?

H.J.,

You have mischaracterized and misrepresented the issue.  No one stated
that GCC Go is not buildable, only that GCC Go requires objcopy, which
is not currently installed on gcc119.

Thanks, David
H.J. Lu Oct. 16, 2021, 7:58 p.m. UTC | #13
On Sat, Oct 16, 2021 at 12:53 PM David Edelsohn <dje.gcc@gmail.com> wrote:
>
> On Sat, Oct 16, 2021 at 1:13 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Sat, Oct 16, 2021 at 10:04 AM David Edelsohn <dje.gcc@gmail.com> wrote:
> > >
> > > On Sat, Oct 16, 2021 at 7:48 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > On Fri, Oct 15, 2021 at 5:22 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > > >
> > > > > On Fri, Oct 15, 2021 at 8:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > >
> > > > > > On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > >
> > > > > > > On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > >
> > > > > > > > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > > >
> > > > > > > > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > > >
> > > > > > > > > > > Change in the v2 patch:
> > > > > > > > > > >
> > > > > > > > > > > 1. Disable static trampolines by default.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > > > > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > > > > > > > has been changed significantly with new features, bug fixes and new target
> > > > > > > > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > > > > > > > make it easier to sync with libffi upstream:
> > > > > > > > > > >
> > > > > > > > > > > 1. Document how to sync with upstream.
> > > > > > > > > > > 2. Add scripts to help sync with upstream.
> > > > > > > > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > > > > > > > >
> > > > > > > > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > > > > > > > 4. Integrate libffi build and testsuite with GCC.
> > > > > > > > > >
> > > > > > > > > > How did you test this?  It looks like libgo is the only consumer of
> > > > > > > > > > libffi these days.
> > > > > > > > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > > > > > > > darwin/windows - did you test cross and canadian configurations?
> > > > > > > > >
> > > > > > > > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > > > > > > > the upstream libffi works on Darwin and Windows.
> > > > > > > > >
> > > > > > > > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > > > > > > > of this massive diff.
> > > > > > > > >
> > > > > > > > > I believe that it should just work.  Our libffi is very much out of date.
> > > > > > > >
> > > > > > > > Yes, you can hope.  And yes, our libffi is out of date.
> > > > > > > >
> > > > > > > > Can you please do the extra step to test one weird architecture, namely
> > > > > > > > powerpc64-aix which is available on the compile-farm?
> > > > > > >
> > > > > > > I will give it a try and report back.
> > > > > > >
> > > > > > > > If that goes well I think it's good to "hope" at this point (and plenty of
> > > > > > > > time to fix fallout until the GCC 12 release).
> > > > > > > >
> > > > > > > > Thus OK after the extra testing dance and waiting until early next
> > > > > > > > week so others can throw in a veto.
> > > > > >
> > > > > > I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:
> > > > > >
> > > > > > *  MT/MODEL: 8284-22A                                                         *
> > > > > > * Partition: gcc119                                                           *
> > > > > > *    System: power8-aix.osuosl.org                                            *
> > > > > > *       O/S: AIX V7.2 7200-04-03-2038
> > > > > >
> > > > > > I configured GCC with
> > > > > >
> > > > > > --with-as=/usr/bin/as --with-ld=/usr/bin/ld
> > > > > > --enable-version-specific-runtime-libs --disable-nls
> > > > > > --enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
> > > > > > --enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
> > > > > > --with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
> > > > > > --with-local-prefix=/opt/freeware --enable-languages=c,c++,go
> > > > > >
> > > > > > I got
> > > > > >
> > > > > > g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
> > > > > > -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
> > > > > > tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
> > > > > > overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
> > > > > > c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
> > > > > >     build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
> > > > > > 4.0/libiberty/libiberty.a
> > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_line
> > > > > > ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
> > > > > > ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
> > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
> > > > > > ld: 0711-317 ERROR: Undefined symbol: .yyend()
> > > > > > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
> > > > > > collect2: error: ld returned 8 exit status
> > > > > > Makefile:3000: recipe for target 'build/gengtype' failed
> > > > > > gmake[5]: *** [build/gengtype] Error 1
> > > > > >
> > > > > > David, is there an instruction to bootstrap GCC on AIX?
> > > > >
> > > > > The CompileFarm page in the GCC wiki has instructions under "build tips":
> > > > >
> > > > > https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> > > > >
> > > > > The error that you show might be due to not having /opt/freeware/bin
> > > > > first in your path and the bootstrap used the AIX version of lex or
> > > > > sed or some other command.
> > > > >
> > > >
> > > > Hi David,
> > > >
> > > > I made some progress.  I am trying to verify my libffi sync branch:
> > > >
> > > > https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master
> > > >
> > > > on powerpc64-aix.  Go is the only user of libffi.  But compiler farm
> > > > suggestion is
> > > >
> > > > .../src/configure --disable-werror --enable-languages=c,c++
> > > > --with-gmp=/opt/cfarm --with-libiconv-prefix=/opt/cfarm
> > > > --disable-libstdcxx-pch --with-included-gettext
> > > >
> > > > When I added Go with --enable-languages=c,c++,go, I got
> > > >
> > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > /opt/freeware/bin/bash /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh build
> > > > cfg.go.tmp buildcfg.go
> > > > mv: 0653-401 Cannot rename internal/unsafeheader.s-gox.tmp to internal/unsafehea
> > > > der.gox:
> > > >              A file or directory in the path name does not exist.
> > > > mv: 0653-401 Cannot rename runtime/internal/atomic.s-gox.tmp to runtime/internal
> > > > /atomic.gox:
> > > >              A file or directory in the path name does not exist.
> > > > mv: 0653-401 Cannot rename internal/race.s-gox.tmp to internal/race.gox:
> > > >              A file or directory in the path name does not exist.
> > > > Makefile:3019: recipe for target 'runtime/internal/atomic.s-gox' failed
> > > > gmake[10]: *** [runtime/internal/atomic.s-gox] Error 1
> > > >
> > > > Is Go supported on AIX? If yes, what did I do wrong?
> > >
> > > I believe that GCC Go works on AIX, but I have not been testing it
> > > regularly.  There was more focus on GCC Go for AIX prior to the Golang
> > > port to AIX.
> > >
> > > It looks like the problem is that the objcopy command is not
> > > installed.  There have been various issues with Binutils on AIX.  I'm
> > > not certain if GCC Go had relied on objcopy or not.
> > >
> >
> > Hi Richard,
> >
> > Go on master branch isn't buildable on AIX.  What should I do
> > next to get my libffi sync patches into master branch?
>
> H.J.,
>
> You have mischaracterized and misrepresented the issue.  No one stated
> that GCC Go is not buildable, only that GCC Go requires objcopy, which
> is not currently installed on gcc119.
>
> Thanks, David

I installed GNU binutils and got


/home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
error: ./internal/unsafeheader.gox exists but does not contain any Go
export data
   17 |         "internal/unsafeheader"
      |                              ^
/home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
error: internal/unsafeheader.gox exists but does not contain any Go
export data
/home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
error: import file 'internal/unsafeheader' not found
/home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:42:
error: reference to undefined name 'unsafeheader'
  146 |                         ptr :=
(*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
      |                                          ^
/home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:41:
error: expected pointer
  146 |                         ptr :=
(*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
      |                                         ^
gmake[8]: Entering directory
'/home/hjl/work/build/gnu/tools-build/gcc-gitlab/build-powerpc64-aix7.2/powerpc-ibm-aix7.2.4.0/pthread/libgo'
f="internal/itoa.o"; if test ! -f $f; then f="internal/.libs/itoa.o";
fi; objcopy -j .go_export $f internal/itoa.s-gox.tmp;
/opt/freeware/bin/bash
/home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh
internal/itoa.s-gox.tmp `echo internal/itoa.s-gox | sed -e
's/s-gox/gox/'`
echo timestamp > internal/itoa.s-gox
Makefile:3019: recipe for target 'hash/maphash.lo' failed
gmake[6]: *** [hash/maphash.lo] Error 1

and there were more errors like this.
David Edelsohn Oct. 16, 2021, 8:07 p.m. UTC | #14
On Sat, Oct 16, 2021 at 3:59 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Sat, Oct 16, 2021 at 12:53 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> >
> > On Sat, Oct 16, 2021 at 1:13 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Sat, Oct 16, 2021 at 10:04 AM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > >
> > > > On Sat, Oct 16, 2021 at 7:48 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > >
> > > > > On Fri, Oct 15, 2021 at 5:22 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > > > >
> > > > > > On Fri, Oct 15, 2021 at 8:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > >
> > > > > > > On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > >
> > > > > > > > On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > >
> > > > > > > > > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > > > >
> > > > > > > > > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > Change in the v2 patch:
> > > > > > > > > > > >
> > > > > > > > > > > > 1. Disable static trampolines by default.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > > > > > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > > > > > > > > has been changed significantly with new features, bug fixes and new target
> > > > > > > > > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > > > > > > > > make it easier to sync with libffi upstream:
> > > > > > > > > > > >
> > > > > > > > > > > > 1. Document how to sync with upstream.
> > > > > > > > > > > > 2. Add scripts to help sync with upstream.
> > > > > > > > > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > > > > > > > > >
> > > > > > > > > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > > > > > > > > 4. Integrate libffi build and testsuite with GCC.
> > > > > > > > > > >
> > > > > > > > > > > How did you test this?  It looks like libgo is the only consumer of
> > > > > > > > > > > libffi these days.
> > > > > > > > > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > > > > > > > > darwin/windows - did you test cross and canadian configurations?
> > > > > > > > > >
> > > > > > > > > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > > > > > > > > the upstream libffi works on Darwin and Windows.
> > > > > > > > > >
> > > > > > > > > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > > > > > > > > of this massive diff.
> > > > > > > > > >
> > > > > > > > > > I believe that it should just work.  Our libffi is very much out of date.
> > > > > > > > >
> > > > > > > > > Yes, you can hope.  And yes, our libffi is out of date.
> > > > > > > > >
> > > > > > > > > Can you please do the extra step to test one weird architecture, namely
> > > > > > > > > powerpc64-aix which is available on the compile-farm?
> > > > > > > >
> > > > > > > > I will give it a try and report back.
> > > > > > > >
> > > > > > > > > If that goes well I think it's good to "hope" at this point (and plenty of
> > > > > > > > > time to fix fallout until the GCC 12 release).
> > > > > > > > >
> > > > > > > > > Thus OK after the extra testing dance and waiting until early next
> > > > > > > > > week so others can throw in a veto.
> > > > > > >
> > > > > > > I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:
> > > > > > >
> > > > > > > *  MT/MODEL: 8284-22A                                                         *
> > > > > > > * Partition: gcc119                                                           *
> > > > > > > *    System: power8-aix.osuosl.org                                            *
> > > > > > > *       O/S: AIX V7.2 7200-04-03-2038
> > > > > > >
> > > > > > > I configured GCC with
> > > > > > >
> > > > > > > --with-as=/usr/bin/as --with-ld=/usr/bin/ld
> > > > > > > --enable-version-specific-runtime-libs --disable-nls
> > > > > > > --enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
> > > > > > > --enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
> > > > > > > --with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
> > > > > > > --with-local-prefix=/opt/freeware --enable-languages=c,c++,go
> > > > > > >
> > > > > > > I got
> > > > > > >
> > > > > > > g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
> > > > > > > -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
> > > > > > > tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
> > > > > > > overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
> > > > > > > c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
> > > > > > >     build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
> > > > > > > 4.0/libiberty/libiberty.a
> > > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_line
> > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
> > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
> > > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
> > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yyend()
> > > > > > > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
> > > > > > > collect2: error: ld returned 8 exit status
> > > > > > > Makefile:3000: recipe for target 'build/gengtype' failed
> > > > > > > gmake[5]: *** [build/gengtype] Error 1
> > > > > > >
> > > > > > > David, is there an instruction to bootstrap GCC on AIX?
> > > > > >
> > > > > > The CompileFarm page in the GCC wiki has instructions under "build tips":
> > > > > >
> > > > > > https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> > > > > >
> > > > > > The error that you show might be due to not having /opt/freeware/bin
> > > > > > first in your path and the bootstrap used the AIX version of lex or
> > > > > > sed or some other command.
> > > > > >
> > > > >
> > > > > Hi David,
> > > > >
> > > > > I made some progress.  I am trying to verify my libffi sync branch:
> > > > >
> > > > > https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master
> > > > >
> > > > > on powerpc64-aix.  Go is the only user of libffi.  But compiler farm
> > > > > suggestion is
> > > > >
> > > > > .../src/configure --disable-werror --enable-languages=c,c++
> > > > > --with-gmp=/opt/cfarm --with-libiconv-prefix=/opt/cfarm
> > > > > --disable-libstdcxx-pch --with-included-gettext
> > > > >
> > > > > When I added Go with --enable-languages=c,c++,go, I got
> > > > >
> > > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > > /opt/freeware/bin/bash /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh build
> > > > > cfg.go.tmp buildcfg.go
> > > > > mv: 0653-401 Cannot rename internal/unsafeheader.s-gox.tmp to internal/unsafehea
> > > > > der.gox:
> > > > >              A file or directory in the path name does not exist.
> > > > > mv: 0653-401 Cannot rename runtime/internal/atomic.s-gox.tmp to runtime/internal
> > > > > /atomic.gox:
> > > > >              A file or directory in the path name does not exist.
> > > > > mv: 0653-401 Cannot rename internal/race.s-gox.tmp to internal/race.gox:
> > > > >              A file or directory in the path name does not exist.
> > > > > Makefile:3019: recipe for target 'runtime/internal/atomic.s-gox' failed
> > > > > gmake[10]: *** [runtime/internal/atomic.s-gox] Error 1
> > > > >
> > > > > Is Go supported on AIX? If yes, what did I do wrong?
> > > >
> > > > I believe that GCC Go works on AIX, but I have not been testing it
> > > > regularly.  There was more focus on GCC Go for AIX prior to the Golang
> > > > port to AIX.
> > > >
> > > > It looks like the problem is that the objcopy command is not
> > > > installed.  There have been various issues with Binutils on AIX.  I'm
> > > > not certain if GCC Go had relied on objcopy or not.
> > > >
> > >
> > > Hi Richard,
> > >
> > > Go on master branch isn't buildable on AIX.  What should I do
> > > next to get my libffi sync patches into master branch?
> >
> > H.J.,
> >
> > You have mischaracterized and misrepresented the issue.  No one stated
> > that GCC Go is not buildable, only that GCC Go requires objcopy, which
> > is not currently installed on gcc119.
> >
> > Thanks, David
>
> I installed GNU binutils and got
>
>
> /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> error: ./internal/unsafeheader.gox exists but does not contain any Go
> export data
>    17 |         "internal/unsafeheader"
>       |                              ^
> /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> error: internal/unsafeheader.gox exists but does not contain any Go
> export data
> /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> error: import file 'internal/unsafeheader' not found
> /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:42:
> error: reference to undefined name 'unsafeheader'
>   146 |                         ptr :=
> (*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
>       |                                          ^
> /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:41:
> error: expected pointer
>   146 |                         ptr :=
> (*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
>       |                                         ^
> gmake[8]: Entering directory
> '/home/hjl/work/build/gnu/tools-build/gcc-gitlab/build-powerpc64-aix7.2/powerpc-ibm-aix7.2.4.0/pthread/libgo'
> f="internal/itoa.o"; if test ! -f $f; then f="internal/.libs/itoa.o";
> fi; objcopy -j .go_export $f internal/itoa.s-gox.tmp;
> /opt/freeware/bin/bash
> /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh
> internal/itoa.s-gox.tmp `echo internal/itoa.s-gox | sed -e
> 's/s-gox/gox/'`
> echo timestamp > internal/itoa.s-gox
> Makefile:3019: recipe for target 'hash/maphash.lo' failed
> gmake[6]: *** [hash/maphash.lo] Error 1
>
> and there were more errors like this.

I have asked my colleagues who work on Go for AIX about the status. I
will let you know when I receive a reply.

libffi trunk works on AIX.

Is Go the only usage of libffi within GCC?  If so, then it seems that
the issue for the AIX build of GCC is to ensure that the update of
libffi doesn't break the rest of the build and that the in-tree build
of libffi succeeds.  Does the in-tree build of libffi pass its
self-tests, or at least the same results as libffi out of the tree?

Thanks, David
H.J. Lu Oct. 17, 2021, 1:26 p.m. UTC | #15
On Sat, Oct 16, 2021 at 1:07 PM David Edelsohn <dje.gcc@gmail.com> wrote:
>
> On Sat, Oct 16, 2021 at 3:59 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Sat, Oct 16, 2021 at 12:53 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> > >
> > > On Sat, Oct 16, 2021 at 1:13 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > On Sat, Oct 16, 2021 at 10:04 AM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > > >
> > > > > On Sat, Oct 16, 2021 at 7:48 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > >
> > > > > > On Fri, Oct 15, 2021 at 5:22 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > > > > >
> > > > > > > On Fri, Oct 15, 2021 at 8:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > >
> > > > > > > > On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> > > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > > >
> > > > > > > > > > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > > >
> > > > > > > > > > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > > > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > Change in the v2 patch:
> > > > > > > > > > > > >
> > > > > > > > > > > > > 1. Disable static trampolines by default.
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > > > > > > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > > > > > > > > > has been changed significantly with new features, bug fixes and new target
> > > > > > > > > > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > > > > > > > > > make it easier to sync with libffi upstream:
> > > > > > > > > > > > >
> > > > > > > > > > > > > 1. Document how to sync with upstream.
> > > > > > > > > > > > > 2. Add scripts to help sync with upstream.
> > > > > > > > > > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > > > > > > > > > >
> > > > > > > > > > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > > > > > > > > > 4. Integrate libffi build and testsuite with GCC.
> > > > > > > > > > > >
> > > > > > > > > > > > How did you test this?  It looks like libgo is the only consumer of
> > > > > > > > > > > > libffi these days.
> > > > > > > > > > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > > > > > > > > > darwin/windows - did you test cross and canadian configurations?
> > > > > > > > > > >
> > > > > > > > > > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > > > > > > > > > the upstream libffi works on Darwin and Windows.
> > > > > > > > > > >
> > > > > > > > > > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > > > > > > > > > of this massive diff.
> > > > > > > > > > >
> > > > > > > > > > > I believe that it should just work.  Our libffi is very much out of date.
> > > > > > > > > >
> > > > > > > > > > Yes, you can hope.  And yes, our libffi is out of date.
> > > > > > > > > >
> > > > > > > > > > Can you please do the extra step to test one weird architecture, namely
> > > > > > > > > > powerpc64-aix which is available on the compile-farm?
> > > > > > > > >
> > > > > > > > > I will give it a try and report back.
> > > > > > > > >
> > > > > > > > > > If that goes well I think it's good to "hope" at this point (and plenty of
> > > > > > > > > > time to fix fallout until the GCC 12 release).
> > > > > > > > > >
> > > > > > > > > > Thus OK after the extra testing dance and waiting until early next
> > > > > > > > > > week so others can throw in a veto.
> > > > > > > >
> > > > > > > > I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:
> > > > > > > >
> > > > > > > > *  MT/MODEL: 8284-22A                                                         *
> > > > > > > > * Partition: gcc119                                                           *
> > > > > > > > *    System: power8-aix.osuosl.org                                            *
> > > > > > > > *       O/S: AIX V7.2 7200-04-03-2038
> > > > > > > >
> > > > > > > > I configured GCC with
> > > > > > > >
> > > > > > > > --with-as=/usr/bin/as --with-ld=/usr/bin/ld
> > > > > > > > --enable-version-specific-runtime-libs --disable-nls
> > > > > > > > --enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
> > > > > > > > --enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
> > > > > > > > --with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
> > > > > > > > --with-local-prefix=/opt/freeware --enable-languages=c,c++,go
> > > > > > > >
> > > > > > > > I got
> > > > > > > >
> > > > > > > > g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
> > > > > > > > -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
> > > > > > > > tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
> > > > > > > > overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
> > > > > > > > c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
> > > > > > > >     build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
> > > > > > > > 4.0/libiberty/libiberty.a
> > > > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_line
> > > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
> > > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
> > > > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
> > > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yyend()
> > > > > > > > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
> > > > > > > > collect2: error: ld returned 8 exit status
> > > > > > > > Makefile:3000: recipe for target 'build/gengtype' failed
> > > > > > > > gmake[5]: *** [build/gengtype] Error 1
> > > > > > > >
> > > > > > > > David, is there an instruction to bootstrap GCC on AIX?
> > > > > > >
> > > > > > > The CompileFarm page in the GCC wiki has instructions under "build tips":
> > > > > > >
> > > > > > > https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> > > > > > >
> > > > > > > The error that you show might be due to not having /opt/freeware/bin
> > > > > > > first in your path and the bootstrap used the AIX version of lex or
> > > > > > > sed or some other command.
> > > > > > >
> > > > > >
> > > > > > Hi David,
> > > > > >
> > > > > > I made some progress.  I am trying to verify my libffi sync branch:
> > > > > >
> > > > > > https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master
> > > > > >
> > > > > > on powerpc64-aix.  Go is the only user of libffi.  But compiler farm
> > > > > > suggestion is
> > > > > >
> > > > > > .../src/configure --disable-werror --enable-languages=c,c++
> > > > > > --with-gmp=/opt/cfarm --with-libiconv-prefix=/opt/cfarm
> > > > > > --disable-libstdcxx-pch --with-included-gettext
> > > > > >
> > > > > > When I added Go with --enable-languages=c,c++,go, I got
> > > > > >
> > > > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > > > /opt/freeware/bin/bash /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh build
> > > > > > cfg.go.tmp buildcfg.go
> > > > > > mv: 0653-401 Cannot rename internal/unsafeheader.s-gox.tmp to internal/unsafehea
> > > > > > der.gox:
> > > > > >              A file or directory in the path name does not exist.
> > > > > > mv: 0653-401 Cannot rename runtime/internal/atomic.s-gox.tmp to runtime/internal
> > > > > > /atomic.gox:
> > > > > >              A file or directory in the path name does not exist.
> > > > > > mv: 0653-401 Cannot rename internal/race.s-gox.tmp to internal/race.gox:
> > > > > >              A file or directory in the path name does not exist.
> > > > > > Makefile:3019: recipe for target 'runtime/internal/atomic.s-gox' failed
> > > > > > gmake[10]: *** [runtime/internal/atomic.s-gox] Error 1
> > > > > >
> > > > > > Is Go supported on AIX? If yes, what did I do wrong?
> > > > >
> > > > > I believe that GCC Go works on AIX, but I have not been testing it
> > > > > regularly.  There was more focus on GCC Go for AIX prior to the Golang
> > > > > port to AIX.
> > > > >
> > > > > It looks like the problem is that the objcopy command is not
> > > > > installed.  There have been various issues with Binutils on AIX.  I'm
> > > > > not certain if GCC Go had relied on objcopy or not.
> > > > >
> > > >
> > > > Hi Richard,
> > > >
> > > > Go on master branch isn't buildable on AIX.  What should I do
> > > > next to get my libffi sync patches into master branch?
> > >
> > > H.J.,
> > >
> > > You have mischaracterized and misrepresented the issue.  No one stated
> > > that GCC Go is not buildable, only that GCC Go requires objcopy, which
> > > is not currently installed on gcc119.
> > >
> > > Thanks, David
> >
> > I installed GNU binutils and got
> >
> >
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> > error: ./internal/unsafeheader.gox exists but does not contain any Go
> > export data
> >    17 |         "internal/unsafeheader"
> >       |                              ^
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> > error: internal/unsafeheader.gox exists but does not contain any Go
> > export data
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> > error: import file 'internal/unsafeheader' not found
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:42:
> > error: reference to undefined name 'unsafeheader'
> >   146 |                         ptr :=
> > (*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
> >       |                                          ^
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:41:
> > error: expected pointer
> >   146 |                         ptr :=
> > (*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
> >       |                                         ^
> > gmake[8]: Entering directory
> > '/home/hjl/work/build/gnu/tools-build/gcc-gitlab/build-powerpc64-aix7.2/powerpc-ibm-aix7.2.4.0/pthread/libgo'
> > f="internal/itoa.o"; if test ! -f $f; then f="internal/.libs/itoa.o";
> > fi; objcopy -j .go_export $f internal/itoa.s-gox.tmp;
> > /opt/freeware/bin/bash
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh
> > internal/itoa.s-gox.tmp `echo internal/itoa.s-gox | sed -e
> > 's/s-gox/gox/'`
> > echo timestamp > internal/itoa.s-gox
> > Makefile:3019: recipe for target 'hash/maphash.lo' failed
> > gmake[6]: *** [hash/maphash.lo] Error 1
> >
> > and there were more errors like this.
>
> I have asked my colleagues who work on Go for AIX about the status. I
> will let you know when I receive a reply.
>
> libffi trunk works on AIX.
>
> Is Go the only usage of libffi within GCC?  If so, then it seems that

Yes.

> the issue for the AIX build of GCC is to ensure that the update of
> libffi doesn't break the rest of the build and that the in-tree build
> of libffi succeeds.  Does the in-tree build of libffi pass its
> self-tests, or at least the same results as libffi out of the tree?

The test results of the in-tree libffi from libffi 3.4.2 are

FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=12
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O0 execution test
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=12
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O2 execution test
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=13
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O0 execution test
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=13
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O2 execution test
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=55
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O0 execution test
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=55
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O2 execution test
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=56
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O0 execution test
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=56
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O2 execution test
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=57
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O0 execution test
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=57
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O2 execution test
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=68
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O0 execution test
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=68
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O2 execution test
FAIL: libffi.bhaible/test-callback.c -W -Wall -Wno-psabi -DDGTEST=54
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O0 execution test
FAIL: libffi.bhaible/test-callback.c -W -Wall -Wno-psabi -DDGTEST=54
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O2 execution test
FAIL: libffi.bhaible/test-callback.c -W -Wall -Wno-psabi -DDGTEST=55
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O0 execution test
FAIL: libffi.bhaible/test-callback.c -W -Wall -Wno-psabi -DDGTEST=55
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O2 execution test
FAIL: libffi.bhaible/test-callback.c -W -Wall -Wno-psabi -DDGTEST=56
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O0 execution test
FAIL: libffi.bhaible/test-callback.c -W -Wall -Wno-psabi -DDGTEST=56
-Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O2 execution test

=== libffi Summary ===

# of expected passes 1444
# of unexpected failures 18
# of unsupported tests 28

which are identical to the upstream libffi 3.4.2.

Thanks.
David Edelsohn Oct. 18, 2021, 3:04 p.m. UTC | #16
Hi, H.J.

My colleague responded that GCC Go builds and works on AIX, but it
currently requires a special, custom version of GNU objcopy that adds
support for the types of features that Go requires to operate on AIX
XCOFF files.  Those changes have not yet been updated and contributed
to GNU Binutils.

I will see if I can install that version of objcopy standalone.  We
also can ask Clement and ATOS to test GCC Go build with your proposed
libffi patch, or is it vanilla libffi trunk?

Thanks, David


On Sat, Oct 16, 2021 at 3:59 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Sat, Oct 16, 2021 at 12:53 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> >
> > On Sat, Oct 16, 2021 at 1:13 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Sat, Oct 16, 2021 at 10:04 AM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > >
> > > > On Sat, Oct 16, 2021 at 7:48 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > >
> > > > > On Fri, Oct 15, 2021 at 5:22 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > > > >
> > > > > > On Fri, Oct 15, 2021 at 8:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > >
> > > > > > > On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > >
> > > > > > > > On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > >
> > > > > > > > > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > > > >
> > > > > > > > > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > Change in the v2 patch:
> > > > > > > > > > > >
> > > > > > > > > > > > 1. Disable static trampolines by default.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > > > > > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > > > > > > > > has been changed significantly with new features, bug fixes and new target
> > > > > > > > > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > > > > > > > > make it easier to sync with libffi upstream:
> > > > > > > > > > > >
> > > > > > > > > > > > 1. Document how to sync with upstream.
> > > > > > > > > > > > 2. Add scripts to help sync with upstream.
> > > > > > > > > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > > > > > > > > >
> > > > > > > > > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > > > > > > > > 4. Integrate libffi build and testsuite with GCC.
> > > > > > > > > > >
> > > > > > > > > > > How did you test this?  It looks like libgo is the only consumer of
> > > > > > > > > > > libffi these days.
> > > > > > > > > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > > > > > > > > darwin/windows - did you test cross and canadian configurations?
> > > > > > > > > >
> > > > > > > > > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > > > > > > > > the upstream libffi works on Darwin and Windows.
> > > > > > > > > >
> > > > > > > > > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > > > > > > > > of this massive diff.
> > > > > > > > > >
> > > > > > > > > > I believe that it should just work.  Our libffi is very much out of date.
> > > > > > > > >
> > > > > > > > > Yes, you can hope.  And yes, our libffi is out of date.
> > > > > > > > >
> > > > > > > > > Can you please do the extra step to test one weird architecture, namely
> > > > > > > > > powerpc64-aix which is available on the compile-farm?
> > > > > > > >
> > > > > > > > I will give it a try and report back.
> > > > > > > >
> > > > > > > > > If that goes well I think it's good to "hope" at this point (and plenty of
> > > > > > > > > time to fix fallout until the GCC 12 release).
> > > > > > > > >
> > > > > > > > > Thus OK after the extra testing dance and waiting until early next
> > > > > > > > > week so others can throw in a veto.
> > > > > > >
> > > > > > > I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:
> > > > > > >
> > > > > > > *  MT/MODEL: 8284-22A                                                         *
> > > > > > > * Partition: gcc119                                                           *
> > > > > > > *    System: power8-aix.osuosl.org                                            *
> > > > > > > *       O/S: AIX V7.2 7200-04-03-2038
> > > > > > >
> > > > > > > I configured GCC with
> > > > > > >
> > > > > > > --with-as=/usr/bin/as --with-ld=/usr/bin/ld
> > > > > > > --enable-version-specific-runtime-libs --disable-nls
> > > > > > > --enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
> > > > > > > --enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
> > > > > > > --with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
> > > > > > > --with-local-prefix=/opt/freeware --enable-languages=c,c++,go
> > > > > > >
> > > > > > > I got
> > > > > > >
> > > > > > > g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
> > > > > > > -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
> > > > > > > tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
> > > > > > > overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
> > > > > > > c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
> > > > > > >     build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
> > > > > > > 4.0/libiberty/libiberty.a
> > > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_line
> > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
> > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
> > > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
> > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yyend()
> > > > > > > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
> > > > > > > collect2: error: ld returned 8 exit status
> > > > > > > Makefile:3000: recipe for target 'build/gengtype' failed
> > > > > > > gmake[5]: *** [build/gengtype] Error 1
> > > > > > >
> > > > > > > David, is there an instruction to bootstrap GCC on AIX?
> > > > > >
> > > > > > The CompileFarm page in the GCC wiki has instructions under "build tips":
> > > > > >
> > > > > > https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> > > > > >
> > > > > > The error that you show might be due to not having /opt/freeware/bin
> > > > > > first in your path and the bootstrap used the AIX version of lex or
> > > > > > sed or some other command.
> > > > > >
> > > > >
> > > > > Hi David,
> > > > >
> > > > > I made some progress.  I am trying to verify my libffi sync branch:
> > > > >
> > > > > https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master
> > > > >
> > > > > on powerpc64-aix.  Go is the only user of libffi.  But compiler farm
> > > > > suggestion is
> > > > >
> > > > > .../src/configure --disable-werror --enable-languages=c,c++
> > > > > --with-gmp=/opt/cfarm --with-libiconv-prefix=/opt/cfarm
> > > > > --disable-libstdcxx-pch --with-included-gettext
> > > > >
> > > > > When I added Go with --enable-languages=c,c++,go, I got
> > > > >
> > > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > > /opt/freeware/bin/bash /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh build
> > > > > cfg.go.tmp buildcfg.go
> > > > > mv: 0653-401 Cannot rename internal/unsafeheader.s-gox.tmp to internal/unsafehea
> > > > > der.gox:
> > > > >              A file or directory in the path name does not exist.
> > > > > mv: 0653-401 Cannot rename runtime/internal/atomic.s-gox.tmp to runtime/internal
> > > > > /atomic.gox:
> > > > >              A file or directory in the path name does not exist.
> > > > > mv: 0653-401 Cannot rename internal/race.s-gox.tmp to internal/race.gox:
> > > > >              A file or directory in the path name does not exist.
> > > > > Makefile:3019: recipe for target 'runtime/internal/atomic.s-gox' failed
> > > > > gmake[10]: *** [runtime/internal/atomic.s-gox] Error 1
> > > > >
> > > > > Is Go supported on AIX? If yes, what did I do wrong?
> > > >
> > > > I believe that GCC Go works on AIX, but I have not been testing it
> > > > regularly.  There was more focus on GCC Go for AIX prior to the Golang
> > > > port to AIX.
> > > >
> > > > It looks like the problem is that the objcopy command is not
> > > > installed.  There have been various issues with Binutils on AIX.  I'm
> > > > not certain if GCC Go had relied on objcopy or not.
> > > >
> > >
> > > Hi Richard,
> > >
> > > Go on master branch isn't buildable on AIX.  What should I do
> > > next to get my libffi sync patches into master branch?
> >
> > H.J.,
> >
> > You have mischaracterized and misrepresented the issue.  No one stated
> > that GCC Go is not buildable, only that GCC Go requires objcopy, which
> > is not currently installed on gcc119.
> >
> > Thanks, David
>
> I installed GNU binutils and got
>
>
> /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> error: ./internal/unsafeheader.gox exists but does not contain any Go
> export data
>    17 |         "internal/unsafeheader"
>       |                              ^
> /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> error: internal/unsafeheader.gox exists but does not contain any Go
> export data
> /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> error: import file 'internal/unsafeheader' not found
> /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:42:
> error: reference to undefined name 'unsafeheader'
>   146 |                         ptr :=
> (*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
>       |                                          ^
> /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:41:
> error: expected pointer
>   146 |                         ptr :=
> (*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
>       |                                         ^
> gmake[8]: Entering directory
> '/home/hjl/work/build/gnu/tools-build/gcc-gitlab/build-powerpc64-aix7.2/powerpc-ibm-aix7.2.4.0/pthread/libgo'
> f="internal/itoa.o"; if test ! -f $f; then f="internal/.libs/itoa.o";
> fi; objcopy -j .go_export $f internal/itoa.s-gox.tmp;
> /opt/freeware/bin/bash
> /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh
> internal/itoa.s-gox.tmp `echo internal/itoa.s-gox | sed -e
> 's/s-gox/gox/'`
> echo timestamp > internal/itoa.s-gox
> Makefile:3019: recipe for target 'hash/maphash.lo' failed
> gmake[6]: *** [hash/maphash.lo] Error 1
>
> and there were more errors like this.
>
> --
> H.J.
H.J. Lu Oct. 18, 2021, 3:08 p.m. UTC | #17
On Mon, Oct 18, 2021 at 8:04 AM David Edelsohn <dje.gcc@gmail.com> wrote:
>
> Hi, H.J.
>
> My colleague responded that GCC Go builds and works on AIX, but it
> currently requires a special, custom version of GNU objcopy that adds
> support for the types of features that Go requires to operate on AIX
> XCOFF files.  Those changes have not yet been updated and contributed
> to GNU Binutils.
>
> I will see if I can install that version of objcopy standalone.  We
> also can ask Clement and ATOS to test GCC Go build with your proposed
> libffi patch, or is it vanilla libffi trunk?

My libffi branch:

https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master

synced with libffi v3.4.2, not master.

BTW, the current master branch won't build libgo:

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

Thanks.

> Thanks, David
>
>
> On Sat, Oct 16, 2021 at 3:59 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Sat, Oct 16, 2021 at 12:53 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> > >
> > > On Sat, Oct 16, 2021 at 1:13 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > On Sat, Oct 16, 2021 at 10:04 AM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > > >
> > > > > On Sat, Oct 16, 2021 at 7:48 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > >
> > > > > > On Fri, Oct 15, 2021 at 5:22 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > > > > >
> > > > > > > On Fri, Oct 15, 2021 at 8:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > >
> > > > > > > > On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> > > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > > >
> > > > > > > > > > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > > >
> > > > > > > > > > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > > > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > Change in the v2 patch:
> > > > > > > > > > > > >
> > > > > > > > > > > > > 1. Disable static trampolines by default.
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > > > > > > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > > > > > > > > > has been changed significantly with new features, bug fixes and new target
> > > > > > > > > > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > > > > > > > > > make it easier to sync with libffi upstream:
> > > > > > > > > > > > >
> > > > > > > > > > > > > 1. Document how to sync with upstream.
> > > > > > > > > > > > > 2. Add scripts to help sync with upstream.
> > > > > > > > > > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > > > > > > > > > >
> > > > > > > > > > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > > > > > > > > > 4. Integrate libffi build and testsuite with GCC.
> > > > > > > > > > > >
> > > > > > > > > > > > How did you test this?  It looks like libgo is the only consumer of
> > > > > > > > > > > > libffi these days.
> > > > > > > > > > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > > > > > > > > > darwin/windows - did you test cross and canadian configurations?
> > > > > > > > > > >
> > > > > > > > > > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > > > > > > > > > the upstream libffi works on Darwin and Windows.
> > > > > > > > > > >
> > > > > > > > > > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > > > > > > > > > of this massive diff.
> > > > > > > > > > >
> > > > > > > > > > > I believe that it should just work.  Our libffi is very much out of date.
> > > > > > > > > >
> > > > > > > > > > Yes, you can hope.  And yes, our libffi is out of date.
> > > > > > > > > >
> > > > > > > > > > Can you please do the extra step to test one weird architecture, namely
> > > > > > > > > > powerpc64-aix which is available on the compile-farm?
> > > > > > > > >
> > > > > > > > > I will give it a try and report back.
> > > > > > > > >
> > > > > > > > > > If that goes well I think it's good to "hope" at this point (and plenty of
> > > > > > > > > > time to fix fallout until the GCC 12 release).
> > > > > > > > > >
> > > > > > > > > > Thus OK after the extra testing dance and waiting until early next
> > > > > > > > > > week so others can throw in a veto.
> > > > > > > >
> > > > > > > > I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:
> > > > > > > >
> > > > > > > > *  MT/MODEL: 8284-22A                                                         *
> > > > > > > > * Partition: gcc119                                                           *
> > > > > > > > *    System: power8-aix.osuosl.org                                            *
> > > > > > > > *       O/S: AIX V7.2 7200-04-03-2038
> > > > > > > >
> > > > > > > > I configured GCC with
> > > > > > > >
> > > > > > > > --with-as=/usr/bin/as --with-ld=/usr/bin/ld
> > > > > > > > --enable-version-specific-runtime-libs --disable-nls
> > > > > > > > --enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
> > > > > > > > --enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
> > > > > > > > --with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
> > > > > > > > --with-local-prefix=/opt/freeware --enable-languages=c,c++,go
> > > > > > > >
> > > > > > > > I got
> > > > > > > >
> > > > > > > > g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
> > > > > > > > -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
> > > > > > > > tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
> > > > > > > > overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
> > > > > > > > c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
> > > > > > > >     build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
> > > > > > > > 4.0/libiberty/libiberty.a
> > > > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_line
> > > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
> > > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
> > > > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
> > > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yyend()
> > > > > > > > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
> > > > > > > > collect2: error: ld returned 8 exit status
> > > > > > > > Makefile:3000: recipe for target 'build/gengtype' failed
> > > > > > > > gmake[5]: *** [build/gengtype] Error 1
> > > > > > > >
> > > > > > > > David, is there an instruction to bootstrap GCC on AIX?
> > > > > > >
> > > > > > > The CompileFarm page in the GCC wiki has instructions under "build tips":
> > > > > > >
> > > > > > > https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> > > > > > >
> > > > > > > The error that you show might be due to not having /opt/freeware/bin
> > > > > > > first in your path and the bootstrap used the AIX version of lex or
> > > > > > > sed or some other command.
> > > > > > >
> > > > > >
> > > > > > Hi David,
> > > > > >
> > > > > > I made some progress.  I am trying to verify my libffi sync branch:
> > > > > >
> > > > > > https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master
> > > > > >
> > > > > > on powerpc64-aix.  Go is the only user of libffi.  But compiler farm
> > > > > > suggestion is
> > > > > >
> > > > > > .../src/configure --disable-werror --enable-languages=c,c++
> > > > > > --with-gmp=/opt/cfarm --with-libiconv-prefix=/opt/cfarm
> > > > > > --disable-libstdcxx-pch --with-included-gettext
> > > > > >
> > > > > > When I added Go with --enable-languages=c,c++,go, I got
> > > > > >
> > > > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > > > /opt/freeware/bin/bash /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh build
> > > > > > cfg.go.tmp buildcfg.go
> > > > > > mv: 0653-401 Cannot rename internal/unsafeheader.s-gox.tmp to internal/unsafehea
> > > > > > der.gox:
> > > > > >              A file or directory in the path name does not exist.
> > > > > > mv: 0653-401 Cannot rename runtime/internal/atomic.s-gox.tmp to runtime/internal
> > > > > > /atomic.gox:
> > > > > >              A file or directory in the path name does not exist.
> > > > > > mv: 0653-401 Cannot rename internal/race.s-gox.tmp to internal/race.gox:
> > > > > >              A file or directory in the path name does not exist.
> > > > > > Makefile:3019: recipe for target 'runtime/internal/atomic.s-gox' failed
> > > > > > gmake[10]: *** [runtime/internal/atomic.s-gox] Error 1
> > > > > >
> > > > > > Is Go supported on AIX? If yes, what did I do wrong?
> > > > >
> > > > > I believe that GCC Go works on AIX, but I have not been testing it
> > > > > regularly.  There was more focus on GCC Go for AIX prior to the Golang
> > > > > port to AIX.
> > > > >
> > > > > It looks like the problem is that the objcopy command is not
> > > > > installed.  There have been various issues with Binutils on AIX.  I'm
> > > > > not certain if GCC Go had relied on objcopy or not.
> > > > >
> > > >
> > > > Hi Richard,
> > > >
> > > > Go on master branch isn't buildable on AIX.  What should I do
> > > > next to get my libffi sync patches into master branch?
> > >
> > > H.J.,
> > >
> > > You have mischaracterized and misrepresented the issue.  No one stated
> > > that GCC Go is not buildable, only that GCC Go requires objcopy, which
> > > is not currently installed on gcc119.
> > >
> > > Thanks, David
> >
> > I installed GNU binutils and got
> >
> >
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> > error: ./internal/unsafeheader.gox exists but does not contain any Go
> > export data
> >    17 |         "internal/unsafeheader"
> >       |                              ^
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> > error: internal/unsafeheader.gox exists but does not contain any Go
> > export data
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> > error: import file 'internal/unsafeheader' not found
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:42:
> > error: reference to undefined name 'unsafeheader'
> >   146 |                         ptr :=
> > (*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
> >       |                                          ^
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:41:
> > error: expected pointer
> >   146 |                         ptr :=
> > (*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
> >       |                                         ^
> > gmake[8]: Entering directory
> > '/home/hjl/work/build/gnu/tools-build/gcc-gitlab/build-powerpc64-aix7.2/powerpc-ibm-aix7.2.4.0/pthread/libgo'
> > f="internal/itoa.o"; if test ! -f $f; then f="internal/.libs/itoa.o";
> > fi; objcopy -j .go_export $f internal/itoa.s-gox.tmp;
> > /opt/freeware/bin/bash
> > /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh
> > internal/itoa.s-gox.tmp `echo internal/itoa.s-gox | sed -e
> > 's/s-gox/gox/'`
> > echo timestamp > internal/itoa.s-gox
> > Makefile:3019: recipe for target 'hash/maphash.lo' failed
> > gmake[6]: *** [hash/maphash.lo] Error 1
> >
> > and there were more errors like this.
> >
> > --
> > H.J.
David Edelsohn Oct. 19, 2021, 3:02 p.m. UTC | #18
Hi, H.J.

My colleague built GCC, including GCC Go, with your patch:

"I was able to build libgo and test it partially.  The results are
similar to the current master without libffi updates. But 64bit tests
aren't working in both cases. It's related to LIBPATH issues..."

- David

On Mon, Oct 18, 2021 at 11:09 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Mon, Oct 18, 2021 at 8:04 AM David Edelsohn <dje.gcc@gmail.com> wrote:
> >
> > Hi, H.J.
> >
> > My colleague responded that GCC Go builds and works on AIX, but it
> > currently requires a special, custom version of GNU objcopy that adds
> > support for the types of features that Go requires to operate on AIX
> > XCOFF files.  Those changes have not yet been updated and contributed
> > to GNU Binutils.
> >
> > I will see if I can install that version of objcopy standalone.  We
> > also can ask Clement and ATOS to test GCC Go build with your proposed
> > libffi patch, or is it vanilla libffi trunk?
>
> My libffi branch:
>
> https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master
>
> synced with libffi v3.4.2, not master.
>
> BTW, the current master branch won't build libgo:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102796
>
> Thanks.
>
> > Thanks, David
> >
> >
> > On Sat, Oct 16, 2021 at 3:59 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Sat, Oct 16, 2021 at 12:53 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > >
> > > > On Sat, Oct 16, 2021 at 1:13 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > >
> > > > > On Sat, Oct 16, 2021 at 10:04 AM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > > > >
> > > > > > On Sat, Oct 16, 2021 at 7:48 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > >
> > > > > > > On Fri, Oct 15, 2021 at 5:22 PM David Edelsohn <dje.gcc@gmail.com> wrote:
> > > > > > > >
> > > > > > > > On Fri, Oct 15, 2021 at 8:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > On Wed, Oct 13, 2021 at 6:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > >
> > > > > > > > > > On Wed, Oct 13, 2021 at 6:03 AM Richard Biener
> > > > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > > > >
> > > > > > > > > > > On Wed, Oct 13, 2021 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > On Wed, Oct 13, 2021 at 5:45 AM Richard Biener
> > > > > > > > > > > > <richard.guenther@gmail.com> wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > On Thu, Sep 2, 2021 at 5:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Change in the v2 patch:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > 1. Disable static trampolines by default.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > GCC maintained a copy of libffi snapshot from 2009 and cherry-picked fixes
> > > > > > > > > > > > > > from upstream over the last 10+ years.  In the meantime, libffi upstream
> > > > > > > > > > > > > > has been changed significantly with new features, bug fixes and new target
> > > > > > > > > > > > > > support.  Here is a set of patches to sync with libffi 3.4.2 release and
> > > > > > > > > > > > > > make it easier to sync with libffi upstream:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > 1. Document how to sync with upstream.
> > > > > > > > > > > > > > 2. Add scripts to help sync with upstream.
> > > > > > > > > > > > > > 3. Sync with libffi 3.4.2. This patch is quite big.  It is availale at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > https://gitlab.com/x86-gcc/gcc/-/commit/15e80c879c571f79a0e57702848a9df5fba5be2f
> > > > > > > > > > > > > > 4. Integrate libffi build and testsuite with GCC.
> > > > > > > > > > > > >
> > > > > > > > > > > > > How did you test this?  It looks like libgo is the only consumer of
> > > > > > > > > > > > > libffi these days.
> > > > > > > > > > > > > In particular go/libgo seems to be supported on almost all targets besides
> > > > > > > > > > > > > darwin/windows - did you test cross and canadian configurations?
> > > > > > > > > > > >
> > > > > > > > > > > > I only tested it on Linux/i686 and Linux/x86-64.   My understanding is that
> > > > > > > > > > > > the upstream libffi works on Darwin and Windows.
> > > > > > > > > > > >
> > > > > > > > > > > > > I applaud the attempt to sync to upsteam but I fear you won't get any "review"
> > > > > > > > > > > > > of this massive diff.
> > > > > > > > > > > >
> > > > > > > > > > > > I believe that it should just work.  Our libffi is very much out of date.
> > > > > > > > > > >
> > > > > > > > > > > Yes, you can hope.  And yes, our libffi is out of date.
> > > > > > > > > > >
> > > > > > > > > > > Can you please do the extra step to test one weird architecture, namely
> > > > > > > > > > > powerpc64-aix which is available on the compile-farm?
> > > > > > > > > >
> > > > > > > > > > I will give it a try and report back.
> > > > > > > > > >
> > > > > > > > > > > If that goes well I think it's good to "hope" at this point (and plenty of
> > > > > > > > > > > time to fix fallout until the GCC 12 release).
> > > > > > > > > > >
> > > > > > > > > > > Thus OK after the extra testing dance and waiting until early next
> > > > > > > > > > > week so others can throw in a veto.
> > > > > > > > >
> > > > > > > > > I tried to bootstrap GCC master branch on  gcc119.fsffrance.org:
> > > > > > > > >
> > > > > > > > > *  MT/MODEL: 8284-22A                                                         *
> > > > > > > > > * Partition: gcc119                                                           *
> > > > > > > > > *    System: power8-aix.osuosl.org                                            *
> > > > > > > > > *       O/S: AIX V7.2 7200-04-03-2038
> > > > > > > > >
> > > > > > > > > I configured GCC with
> > > > > > > > >
> > > > > > > > > --with-as=/usr/bin/as --with-ld=/usr/bin/ld
> > > > > > > > > --enable-version-specific-runtime-libs --disable-nls
> > > > > > > > > --enable-decimal-float=dpd --disable-libstdcxx-pch --disable-werror
> > > > > > > > > --enable-__cxa_atexit --with-gmp=/opt/cfarm --with-mpfr=/opt/cfarm
> > > > > > > > > --with-mpc=/opt/cfarm --with-isl=/opt/cfarm --prefix=/opt/freeware
> > > > > > > > > --with-local-prefix=/opt/freeware --enable-languages=c,c++,go
> > > > > > > > >
> > > > > > > > > I got
> > > > > > > > >
> > > > > > > > > g++   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
> > > > > > > > > -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-at
> > > > > > > > > tribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
> > > > > > > > > overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstd
> > > > > > > > > c++ -static-libgcc -Wl,-bbigtoc -Wl,-bmaxdata:0x40000000 -o build/genenums \
> > > > > > > > >     build/genenums.o build/read-md.o build/errors.o ../build-powerpc-ibm-aix7.2.
> > > > > > > > > 4.0/libiberty/libiberty.a
> > > > > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_line
> > > > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
> > > > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
> > > > > > > > > ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
> > > > > > > > > ld: 0711-317 ERROR: Undefined symbol: .yyend()
> > > > > > > > > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
> > > > > > > > > collect2: error: ld returned 8 exit status
> > > > > > > > > Makefile:3000: recipe for target 'build/gengtype' failed
> > > > > > > > > gmake[5]: *** [build/gengtype] Error 1
> > > > > > > > >
> > > > > > > > > David, is there an instruction to bootstrap GCC on AIX?
> > > > > > > >
> > > > > > > > The CompileFarm page in the GCC wiki has instructions under "build tips":
> > > > > > > >
> > > > > > > > https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> > > > > > > >
> > > > > > > > The error that you show might be due to not having /opt/freeware/bin
> > > > > > > > first in your path and the bootstrap used the AIX version of lex or
> > > > > > > > sed or some other command.
> > > > > > > >
> > > > > > >
> > > > > > > Hi David,
> > > > > > >
> > > > > > > I made some progress.  I am trying to verify my libffi sync branch:
> > > > > > >
> > > > > > > https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/libffi/master
> > > > > > >
> > > > > > > on powerpc64-aix.  Go is the only user of libffi.  But compiler farm
> > > > > > > suggestion is
> > > > > > >
> > > > > > > .../src/configure --disable-werror --enable-languages=c,c++
> > > > > > > --with-gmp=/opt/cfarm --with-libiconv-prefix=/opt/cfarm
> > > > > > > --disable-libstdcxx-pch --with-included-gettext
> > > > > > >
> > > > > > > When I added Go with --enable-languages=c,c++,go, I got
> > > > > > >
> > > > > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > > > > /opt/freeware/bin/bash: missing-objcopy: command not found
> > > > > > > /opt/freeware/bin/bash /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh build
> > > > > > > cfg.go.tmp buildcfg.go
> > > > > > > mv: 0653-401 Cannot rename internal/unsafeheader.s-gox.tmp to internal/unsafehea
> > > > > > > der.gox:
> > > > > > >              A file or directory in the path name does not exist.
> > > > > > > mv: 0653-401 Cannot rename runtime/internal/atomic.s-gox.tmp to runtime/internal
> > > > > > > /atomic.gox:
> > > > > > >              A file or directory in the path name does not exist.
> > > > > > > mv: 0653-401 Cannot rename internal/race.s-gox.tmp to internal/race.gox:
> > > > > > >              A file or directory in the path name does not exist.
> > > > > > > Makefile:3019: recipe for target 'runtime/internal/atomic.s-gox' failed
> > > > > > > gmake[10]: *** [runtime/internal/atomic.s-gox] Error 1
> > > > > > >
> > > > > > > Is Go supported on AIX? If yes, what did I do wrong?
> > > > > >
> > > > > > I believe that GCC Go works on AIX, but I have not been testing it
> > > > > > regularly.  There was more focus on GCC Go for AIX prior to the Golang
> > > > > > port to AIX.
> > > > > >
> > > > > > It looks like the problem is that the objcopy command is not
> > > > > > installed.  There have been various issues with Binutils on AIX.  I'm
> > > > > > not certain if GCC Go had relied on objcopy or not.
> > > > > >
> > > > >
> > > > > Hi Richard,
> > > > >
> > > > > Go on master branch isn't buildable on AIX.  What should I do
> > > > > next to get my libffi sync patches into master branch?
> > > >
> > > > H.J.,
> > > >
> > > > You have mischaracterized and misrepresented the issue.  No one stated
> > > > that GCC Go is not buildable, only that GCC Go requires objcopy, which
> > > > is not currently installed on gcc119.
> > > >
> > > > Thanks, David
> > >
> > > I installed GNU binutils and got
> > >
> > >
> > > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> > > error: ./internal/unsafeheader.gox exists but does not contain any Go
> > > export data
> > >    17 |         "internal/unsafeheader"
> > >       |                              ^
> > > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> > > error: internal/unsafeheader.gox exists but does not contain any Go
> > > export data
> > > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:17:30:
> > > error: import file 'internal/unsafeheader' not found
> > > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:42:
> > > error: reference to undefined name 'unsafeheader'
> > >   146 |                         ptr :=
> > > (*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
> > >       |                                          ^
> > > /home/hjl/work/git/gitlab/x86-gcc/libgo/go/hash/maphash/maphash.go:146:41:
> > > error: expected pointer
> > >   146 |                         ptr :=
> > > (*byte)((*unsafeheader.String)(unsafe.Pointer(&s)).Data)
> > >       |                                         ^
> > > gmake[8]: Entering directory
> > > '/home/hjl/work/build/gnu/tools-build/gcc-gitlab/build-powerpc64-aix7.2/powerpc-ibm-aix7.2.4.0/pthread/libgo'
> > > f="internal/itoa.o"; if test ! -f $f; then f="internal/.libs/itoa.o";
> > > fi; objcopy -j .go_export $f internal/itoa.s-gox.tmp;
> > > /opt/freeware/bin/bash
> > > /home/hjl/work/git/gitlab/x86-gcc/libgo/mvifdiff.sh
> > > internal/itoa.s-gox.tmp `echo internal/itoa.s-gox | sed -e
> > > 's/s-gox/gox/'`
> > > echo timestamp > internal/itoa.s-gox
> > > Makefile:3019: recipe for target 'hash/maphash.lo' failed
> > > gmake[6]: *** [hash/maphash.lo] Error 1
> > >
> > > and there were more errors like this.
> > >
> > > --
> > > H.J.
>
>
>
> --
> H.J.
H.J. Lu Oct. 19, 2021, 6:01 p.m. UTC | #19
On Tue, Oct 19, 2021 at 8:03 AM David Edelsohn <dje.gcc@gmail.com> wrote:
>
> Hi, H.J.
>
> My colleague built GCC, including GCC Go, with your patch:
>
> "I was able to build libgo and test it partially.  The results are
> similar to the current master without libffi updates. But 64bit tests
> aren't working in both cases. It's related to LIBPATH issues..."
>

Thanks for checking.  I will rebase and retest.  If there is no regression,
I will check them in.

Thanks.
Iain Sandoe Oct. 24, 2021, 8:36 p.m. UTC | #20
Hi H.J.

> On 19 Oct 2021, at 19:01, H.J. Lu via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> On Tue, Oct 19, 2021 at 8:03 AM David Edelsohn <dje.gcc@gmail.com> wrote:
>> 

>> My colleague built GCC, including GCC Go, with your patch:
>> 
>> "I was able to build libgo and test it partially.  The results are
>> similar to the current master without libffi updates. But 64bit tests
>> aren't working in both cases. It's related to LIBPATH issues..."
>> 
> 
> Thanks for checking.  I will rebase and retest.  If there is no regression,
> I will check them in.

At r12-4638.

It seems that there are quite a few m32 libffi fails on x86_64-linux-gnu [gcc123].

It seems that all-languages bootstrap is broken on BE powerpc64-linux-gnu [gcc110]:

../../../src-patched/libffi/src/powerpc/linux64_closure.S:404: Error: unrecognized opcode: `lvx'
make[4]: *** [src/powerpc/linux64_closure.lo] Error 1

could you take a look please?
thanks
Iain
H.J. Lu Oct. 24, 2021, 8:40 p.m. UTC | #21
On Sun, Oct 24, 2021 at 1:36 PM Iain Sandoe <idsandoe@googlemail.com> wrote:
>
> Hi H.J.
>
> > On 19 Oct 2021, at 19:01, H.J. Lu via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> >
> > On Tue, Oct 19, 2021 at 8:03 AM David Edelsohn <dje.gcc@gmail.com> wrote:
> >>
>
> >> My colleague built GCC, including GCC Go, with your patch:
> >>
> >> "I was able to build libgo and test it partially.  The results are
> >> similar to the current master without libffi updates. But 64bit tests
> >> aren't working in both cases. It's related to LIBPATH issues..."
> >>
> >
> > Thanks for checking.  I will rebase and retest.  If there is no regression,
> > I will check them in.
>
> At r12-4638.
>
> It seems that there are quite a few m32 libffi fails on x86_64-linux-gnu [gcc123].
>
> It seems that all-languages bootstrap is broken on BE powerpc64-linux-gnu [gcc110]:
>
> ../../../src-patched/libffi/src/powerpc/linux64_closure.S:404: Error: unrecognized opcode: `lvx'
> make[4]: *** [src/powerpc/linux64_closure.lo] Error 1
>
> could you take a look please?

Does it fail in libffi upstream? If yes, please open an issue in libffi
upstream.  If not, why does it fail in GCC?
Iain Sandoe Oct. 25, 2021, 6:58 a.m. UTC | #22
> On 24 Oct 2021, at 21:40, H.J. Lu via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> On Sun, Oct 24, 2021 at 1:36 PM Iain Sandoe <idsandoe@googlemail.com> wrote:
>> 
>> Hi H.J.
>> 
>>> On 19 Oct 2021, at 19:01, H.J. Lu via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>>> 
>>> On Tue, Oct 19, 2021 at 8:03 AM David Edelsohn <dje.gcc@gmail.com> wrote:
>>>> 
>> 
>>>> My colleague built GCC, including GCC Go, with your patch:
>>>> 
>>>> "I was able to build libgo and test it partially.  The results are
>>>> similar to the current master without libffi updates. But 64bit tests
>>>> aren't working in both cases. It's related to LIBPATH issues..."
>>>> 
>>> 
>>> Thanks for checking.  I will rebase and retest.  If there is no regression,
>>> I will check them in.
>> 
>> At r12-4638.
>> 
>> It seems that there are quite a few m32 libffi fails on x86_64-linux-gnu [gcc123].
>> 
>> It seems that all-languages bootstrap is broken on BE powerpc64-linux-gnu [gcc110]:
>> 
>> ../../../src-patched/libffi/src/powerpc/linux64_closure.S:404: Error: unrecognized opcode: `lvx'
>> make[4]: *** [src/powerpc/linux64_closure.lo] Error 1
>> 
>> could you take a look please?
> 
> Does it fail in libffi upstream? If yes, please open an issue in libffi
> upstream.  If not, why does it fail in GCC?

I do not have spare resources to debug this for you - the problems occur on cfarm machines
so you do not need special resources to do it.
Iain