iains / gcc-14-branch

GCC 14 for Darwin with experimental Arm64 support. Current release 14.2-darwin-r0 [August 2024]
GNU General Public License v2.0
4 stars 2 forks source link

Possible incompatibility with the latest Apple linker? #5

Closed ilg-ul closed 2 months ago

ilg-ul commented 2 months ago

I have a successful build of GCC 14.1 on a macOS arm64 11.7 machine with CLT 13.2, and the tests pass on this machine, but when performed on a GitHub 14.5 runner, some tests fail (the macOS Intel binaries were ok on multiple versions).

The failing GitHub machine identifies itself as:

[uname -a]
Darwin Mac-1717151772876.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:12:39 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_VMAPPLE arm64

[sw_vers ]
ProductName:        macOS
ProductVersion:     14.5
BuildVersion:       23F79

[xcode-select --print-path]
/Applications/Xcode_15.0.1.app/Contents/Developer

[pkgutil --pkg-info=com.apple.pkg.CLTools_Executables]
package-id: com.apple.pkg.CLTools_Executables
version: 15.3.0.0.1.1708646388
volume: /
location: /
install-time: 1716757668

The tests summary is:

Tests summary for gcc 14.1.0-1 on darwin-arm64 (macOS 14.5)

144 test(s) passed, 130 failed:

- FAIL: simple-exception (XBB_IGNORE_TEST_SIMPLE_EXCEPTION)
- FAIL: simple-str-exception (XBB_IGNORE_TEST_SIMPLE_STR_EXCEPTION)
- FAIL: simple-int-exception (XBB_IGNORE_TEST_SIMPLE_INT_EXCEPTION)
- FAIL: sleepy-threads-cv (XBB_IGNORE_TEST_SLEEPY_THREADS_CV)
- FAIL: hello-cpp (XBB_IGNORE_TEST_HELLO_CPP)
- FAIL: longjmp-cleanup (XBB_IGNORE_TEST_LONGJMP_CLEANUP)
- FAIL: hello-exception (XBB_IGNORE_TEST_HELLO_EXCEPTION)
- FAIL: exception-locale (XBB_IGNORE_TEST_EXCEPTION_LOCALE)
- FAIL: exception-reduced (XBB_IGNORE_TEST_EXCEPTION_REDUCED)
- fail: weak-undef-c
- FAIL: unwind-weak-cpp (XBB_IGNORE_TEST_UNWIND_WEAK_CPP)
- FAIL: unwind-strong-cpp (XBB_IGNORE_TEST_UNWIND_STRONG_CPP)
- FAIL: throwcatch-main (XBB_IGNORE_TEST_THROWCATCH_MAIN)
- FAIL: gc-simple-exception (XBB_IGNORE_TEST_GC_SIMPLE_EXCEPTION)
- FAIL: gc-simple-str-exception (XBB_IGNORE_TEST_GC_SIMPLE_STR_EXCEPTION)
- FAIL: gc-simple-int-exception (XBB_IGNORE_TEST_GC_SIMPLE_INT_EXCEPTION)
- FAIL: gc-sleepy-threads-cv (XBB_IGNORE_TEST_GC_SLEEPY_THREADS_CV)
- FAIL: gc-hello-cpp (XBB_IGNORE_TEST_GC_HELLO_CPP)
- FAIL: gc-longjmp-cleanup (XBB_IGNORE_TEST_GC_LONGJMP_CLEANUP)
- FAIL: gc-hello-exception (XBB_IGNORE_TEST_GC_HELLO_EXCEPTION)
- FAIL: gc-exception-locale (XBB_IGNORE_TEST_GC_EXCEPTION_LOCALE)
- FAIL: gc-exception-reduced (XBB_IGNORE_TEST_GC_EXCEPTION_REDUCED)
- fail: gc-weak-undef-c
- fail: gc-overload-new-cpp
- FAIL: gc-unwind-weak-cpp (XBB_IGNORE_TEST_GC_UNWIND_WEAK_CPP)
- FAIL: gc-unwind-strong-cpp (XBB_IGNORE_TEST_GC_UNWIND_STRONG_CPP)
- FAIL: gc-throwcatch-main (XBB_IGNORE_TEST_GC_THROWCATCH_MAIN)
- FAIL: lto-simple-exception (XBB_IGNORE_TEST_LTO_SIMPLE_EXCEPTION)
- FAIL: lto-simple-str-exception (XBB_IGNORE_TEST_LTO_SIMPLE_STR_EXCEPTION)
- FAIL: lto-simple-int-exception (XBB_IGNORE_TEST_LTO_SIMPLE_INT_EXCEPTION)
- FAIL: lto-sleepy-threads-cv (XBB_IGNORE_TEST_LTO_SLEEPY_THREADS_CV)
- FAIL: lto-hello-cpp (XBB_IGNORE_TEST_LTO_HELLO_CPP)
- FAIL: lto-longjmp-cleanup (XBB_IGNORE_TEST_LTO_LONGJMP_CLEANUP)
- FAIL: lto-hello-exception (XBB_IGNORE_TEST_LTO_HELLO_EXCEPTION)
- FAIL: lto-exception-locale (XBB_IGNORE_TEST_LTO_EXCEPTION_LOCALE)
- FAIL: lto-exception-reduced (XBB_IGNORE_TEST_LTO_EXCEPTION_REDUCED)
- fail: lto-weak-undef-c
- FAIL: lto-unwind-weak-cpp (XBB_IGNORE_TEST_LTO_UNWIND_WEAK_CPP)
- FAIL: lto-unwind-strong-cpp (XBB_IGNORE_TEST_LTO_UNWIND_STRONG_CPP)
- FAIL: lto-throwcatch-main (XBB_IGNORE_TEST_LTO_THROWCATCH_MAIN)
- FAIL: gc-lto-simple-exception (XBB_IGNORE_TEST_GC_LTO_SIMPLE_EXCEPTION)
- FAIL: gc-lto-simple-str-exception (XBB_IGNORE_TEST_GC_LTO_SIMPLE_STR_EXCEPTION)
- FAIL: gc-lto-simple-int-exception (XBB_IGNORE_TEST_GC_LTO_SIMPLE_INT_EXCEPTION)
- FAIL: gc-lto-sleepy-threads-cv (XBB_IGNORE_TEST_GC_LTO_SLEEPY_THREADS_CV)
- FAIL: gc-lto-hello-cpp (XBB_IGNORE_TEST_GC_LTO_HELLO_CPP)
- FAIL: gc-lto-longjmp-cleanup (XBB_IGNORE_TEST_GC_LTO_LONGJMP_CLEANUP)
- FAIL: gc-lto-hello-exception (XBB_IGNORE_TEST_GC_LTO_HELLO_EXCEPTION)
- FAIL: gc-lto-exception-locale (XBB_IGNORE_TEST_GC_LTO_EXCEPTION_LOCALE)
- FAIL: gc-lto-exception-reduced (XBB_IGNORE_TEST_GC_LTO_EXCEPTION_REDUCED)
- fail: gc-lto-weak-undef-c
- fail: gc-lto-overload-new-cpp
- FAIL: gc-lto-unwind-weak-cpp (XBB_IGNORE_TEST_GC_LTO_UNWIND_WEAK_CPP)
- FAIL: gc-lto-unwind-strong-cpp (XBB_IGNORE_TEST_GC_LTO_UNWIND_STRONG_CPP)
- FAIL: gc-lto-throwcatch-main (XBB_IGNORE_TEST_GC_LTO_THROWCATCH_MAIN)
- FAIL: static-lib-simple-hello-cpp-one (XBB_IGNORE_TEST_STATIC_LIB_SIMPLE_HELLO_CPP_ONE)
- FAIL: static-lib-simple-hello-cpp-two (XBB_IGNORE_TEST_STATIC_LIB_SIMPLE_HELLO_CPP_TWO)
- FAIL: static-lib-simple-exception (XBB_IGNORE_TEST_STATIC_LIB_SIMPLE_EXCEPTION)
- FAIL: static-lib-simple-str-exception (XBB_IGNORE_TEST_STATIC_LIB_SIMPLE_STR_EXCEPTION)
- FAIL: static-lib-simple-int-exception (XBB_IGNORE_TEST_STATIC_LIB_SIMPLE_INT_EXCEPTION)
- FAIL: static-lib-sleepy-threads-cv (XBB_IGNORE_TEST_STATIC_LIB_SLEEPY_THREADS_CV)
- FAIL: static-lib-atomic (XBB_IGNORE_TEST_STATIC_LIB_ATOMIC)
- FAIL: static-lib-hello-cpp (XBB_IGNORE_TEST_STATIC_LIB_HELLO_CPP)
- FAIL: static-lib-global-terminate (XBB_IGNORE_TEST_STATIC_LIB_GLOBAL_TERMINATE)
- FAIL: static-lib-longjmp-cleanup (XBB_IGNORE_TEST_STATIC_LIB_LONGJMP_CLEANUP)
- FAIL: static-lib-hello-exception (XBB_IGNORE_TEST_STATIC_LIB_HELLO_EXCEPTION)
- FAIL: static-lib-exception-locale (XBB_IGNORE_TEST_STATIC_LIB_EXCEPTION_LOCALE)
- FAIL: static-lib-exception-reduced (XBB_IGNORE_TEST_STATIC_LIB_EXCEPTION_REDUCED)
- FAIL: static-lib-hello-weak-cpp (XBB_IGNORE_TEST_STATIC_LIB_HELLO_WEAK_CPP)
- fail: static-lib-weak-undef-c
- FAIL: static-lib-overload-new-cpp (XBB_IGNORE_TEST_STATIC_LIB_OVERLOAD_NEW_CPP)
- FAIL: static-lib-unwind-weak-cpp (XBB_IGNORE_TEST_STATIC_LIB_UNWIND_WEAK_CPP)
- FAIL: static-lib-unwind-strong-cpp (XBB_IGNORE_TEST_STATIC_LIB_UNWIND_STRONG_CPP)
- FAIL: static-lib-throwcatch-main (XBB_IGNORE_TEST_STATIC_LIB_THROWCATCH_MAIN)
- FAIL: static-lib-gc-simple-hello-cpp-one (XBB_IGNORE_TEST_STATIC_LIB_GC_SIMPLE_HELLO_CPP_ONE)
- FAIL: static-lib-gc-simple-hello-cpp-two (XBB_IGNORE_TEST_STATIC_LIB_GC_SIMPLE_HELLO_CPP_TWO)
- FAIL: static-lib-gc-simple-exception (XBB_IGNORE_TEST_STATIC_LIB_GC_SIMPLE_EXCEPTION)
- FAIL: static-lib-gc-simple-str-exception (XBB_IGNORE_TEST_STATIC_LIB_GC_SIMPLE_STR_EXCEPTION)
- FAIL: static-lib-gc-simple-int-exception (XBB_IGNORE_TEST_STATIC_LIB_GC_SIMPLE_INT_EXCEPTION)
- FAIL: static-lib-gc-sleepy-threads-cv (XBB_IGNORE_TEST_STATIC_LIB_GC_SLEEPY_THREADS_CV)
- FAIL: static-lib-gc-atomic (XBB_IGNORE_TEST_STATIC_LIB_GC_ATOMIC)
- FAIL: static-lib-gc-hello-cpp (XBB_IGNORE_TEST_STATIC_LIB_GC_HELLO_CPP)
- FAIL: static-lib-gc-global-terminate (XBB_IGNORE_TEST_STATIC_LIB_GC_GLOBAL_TERMINATE)
- FAIL: static-lib-gc-longjmp-cleanup (XBB_IGNORE_TEST_STATIC_LIB_GC_LONGJMP_CLEANUP)
- FAIL: static-lib-gc-hello-exception (XBB_IGNORE_TEST_STATIC_LIB_GC_HELLO_EXCEPTION)
- FAIL: static-lib-gc-exception-locale (XBB_IGNORE_TEST_STATIC_LIB_GC_EXCEPTION_LOCALE)
- FAIL: static-lib-gc-exception-reduced (XBB_IGNORE_TEST_STATIC_LIB_GC_EXCEPTION_REDUCED)
- FAIL: static-lib-gc-hello-weak-cpp (XBB_IGNORE_TEST_STATIC_LIB_GC_HELLO_WEAK_CPP)
- fail: static-lib-gc-weak-undef-c
- FAIL: static-lib-gc-overload-new-cpp (XBB_IGNORE_TEST_STATIC_LIB_GC_OVERLOAD_NEW_CPP)
- FAIL: static-lib-gc-unwind-weak-cpp (XBB_IGNORE_TEST_STATIC_LIB_GC_UNWIND_WEAK_CPP)
- FAIL: static-lib-gc-unwind-strong-cpp (XBB_IGNORE_TEST_STATIC_LIB_GC_UNWIND_STRONG_CPP)
- FAIL: static-lib-gc-throwcatch-main (XBB_IGNORE_TEST_STATIC_LIB_GC_THROWCATCH_MAIN)
- FAIL: static-lib-lto-simple-hello-cpp-one (XBB_IGNORE_TEST_STATIC_LIB_LTO_SIMPLE_HELLO_CPP_ONE)
- FAIL: static-lib-lto-simple-hello-cpp-two (XBB_IGNORE_TEST_STATIC_LIB_LTO_SIMPLE_HELLO_CPP_TWO)
- FAIL: static-lib-lto-simple-exception (XBB_IGNORE_TEST_STATIC_LIB_LTO_SIMPLE_EXCEPTION)
- FAIL: static-lib-lto-simple-str-exception (XBB_IGNORE_TEST_STATIC_LIB_LTO_SIMPLE_STR_EXCEPTION)
- FAIL: static-lib-lto-simple-int-exception (XBB_IGNORE_TEST_STATIC_LIB_LTO_SIMPLE_INT_EXCEPTION)
- FAIL: static-lib-lto-sleepy-threads-cv (XBB_IGNORE_TEST_STATIC_LIB_LTO_SLEEPY_THREADS_CV)
- FAIL: static-lib-lto-atomic (XBB_IGNORE_TEST_STATIC_LIB_LTO_ATOMIC)
- FAIL: static-lib-lto-hello-cpp (XBB_IGNORE_TEST_STATIC_LIB_LTO_HELLO_CPP)
- FAIL: static-lib-lto-global-terminate (XBB_IGNORE_TEST_STATIC_LIB_LTO_GLOBAL_TERMINATE)
- FAIL: static-lib-lto-longjmp-cleanup (XBB_IGNORE_TEST_STATIC_LIB_LTO_LONGJMP_CLEANUP)
- FAIL: static-lib-lto-hello-exception (XBB_IGNORE_TEST_STATIC_LIB_LTO_HELLO_EXCEPTION)
- FAIL: static-lib-lto-exception-locale (XBB_IGNORE_TEST_STATIC_LIB_LTO_EXCEPTION_LOCALE)
- FAIL: static-lib-lto-exception-reduced (XBB_IGNORE_TEST_STATIC_LIB_LTO_EXCEPTION_REDUCED)
- FAIL: static-lib-lto-hello-weak-cpp (XBB_IGNORE_TEST_STATIC_LIB_LTO_HELLO_WEAK_CPP)
- fail: static-lib-lto-weak-undef-c
- FAIL: static-lib-lto-overload-new-cpp (XBB_IGNORE_TEST_STATIC_LIB_LTO_OVERLOAD_NEW_CPP)
- FAIL: static-lib-lto-unwind-weak-cpp (XBB_IGNORE_TEST_STATIC_LIB_LTO_UNWIND_WEAK_CPP)
- FAIL: static-lib-lto-unwind-strong-cpp (XBB_IGNORE_TEST_STATIC_LIB_LTO_UNWIND_STRONG_CPP)
- FAIL: static-lib-lto-throwcatch-main (XBB_IGNORE_TEST_STATIC_LIB_LTO_THROWCATCH_MAIN)
- FAIL: static-lib-gc-lto-simple-hello-cpp-one (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_SIMPLE_HELLO_CPP_ONE)
- FAIL: static-lib-gc-lto-simple-hello-cpp-two (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_SIMPLE_HELLO_CPP_TWO)
- FAIL: static-lib-gc-lto-simple-exception (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_SIMPLE_EXCEPTION)
- FAIL: static-lib-gc-lto-simple-str-exception (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_SIMPLE_STR_EXCEPTION)
- FAIL: static-lib-gc-lto-simple-int-exception (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_SIMPLE_INT_EXCEPTION)
- FAIL: static-lib-gc-lto-sleepy-threads-cv (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_SLEEPY_THREADS_CV)
- FAIL: static-lib-gc-lto-atomic (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_ATOMIC)
- FAIL: static-lib-gc-lto-hello-cpp (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_HELLO_CPP)
- FAIL: static-lib-gc-lto-global-terminate (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_GLOBAL_TERMINATE)
- FAIL: static-lib-gc-lto-longjmp-cleanup (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_LONGJMP_CLEANUP)
- FAIL: static-lib-gc-lto-hello-exception (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_HELLO_EXCEPTION)
- FAIL: static-lib-gc-lto-exception-locale (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_EXCEPTION_LOCALE)
- FAIL: static-lib-gc-lto-exception-reduced (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_EXCEPTION_REDUCED)
- FAIL: static-lib-gc-lto-hello-weak-cpp (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_HELLO_WEAK_CPP)
- fail: static-lib-gc-lto-weak-undef-c
- FAIL: static-lib-gc-lto-overload-new-cpp (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_OVERLOAD_NEW_CPP)
- FAIL: static-lib-gc-lto-unwind-weak-cpp (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_UNWIND_WEAK_CPP)
- FAIL: static-lib-gc-lto-unwind-strong-cpp (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_UNWIND_STRONG_CPP)
- FAIL: static-lib-gc-lto-throwcatch-main (XBB_IGNORE_TEST_STATIC_LIB_GC_LTO_THROWCATCH_MAIN)

120 failed unexpectedly

However, a quick scan of the log shows a linker assert that occurs at most (all?) tests, for example:

[/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/g++ simple-exception.cpp -o simple-exception]
0  0x100147648  __assert_rtn + 72
1  0x10007bfac  ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1204
2  0x100091924  ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 15164
3  0x10009ee30  ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 420
4  0x199e1e428  _dispatch_client_callout2 + 20
5  0x199e32850  _dispatch_apply_invoke3 + 336
6  0x199e1e3e8  _dispatch_client_callout + 20
7  0x199e1fc68  _dispatch_once_callout + 32
8  0x199e32eec  _dispatch_apply_invoke_and_wait + 372
9  0x199e31e9c  _dispatch_apply_with_attr_f + 1212
10  0x199e3208c  dispatch_apply + 96
11  0x1001193b8  ld::AtomFileConsolidator::parseFiles(bool) + 292
12  0x1000ba170  main + 9048
ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336.
collect2: error: ld returned 1 exit status

I know that there were some changes in the linker behaviour in the recent SDKs, but I thought they were fixed.

Any suggestion how to proceed?

ilg-ul commented 2 months ago

Another run with more verbosity:

[/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/g++ simple-hello.cpp -o static-lib-simple-hello-cpp-one -static-libgcc -static-libstdc++ -v]
Using built-in specs.
COLLECT_GCC=/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/g++
COLLECT_LTO_WRAPPER=/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../libexec/gcc/aarch64-apple-darwin20.6.0/14.1.0/lto-wrapper
Target: aarch64-apple-darwin20.6.0
Configured with: /Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/sources/gcc-14.1.0/configure --prefix=/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/application --program-suffix= --infodir=/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/share/info --mandir=/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/share/man --htmldir=/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/share/html --pdfdir=/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/share/pdf --build=aarch64-apple-darwin20.6.0 --host=aarch64-apple-darwin20.6.0 --target=aarch64-apple-darwin20.6.0 --with-pkgversion='xPack GCC arm64' --with-dwarf2 --with-diagnostics-color=auto --with-libiconv-prefix=/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install --with-gmp=/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install --with-isl=/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install --with-mpc=/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install --with-mpfr=/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install --with-zstd=/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install --with-system-zlib --without-cuda-driver --enable-languages=c,c++,objc,obj-c++,lto,fortran --enable-objc-gc=auto --enable-checking=release --enable-lto --enable-plugin --enable-__cxa_atexit --enable-cet=auto --enable-cloog-backend=isl --enable-default-pie --enable-libgomp --enable-libssp --enable-default-ssp --enable-libatomic --enable-graphite --enable-libquadmath --enable-libquadmath-support --enable-libstdcxx --enable-libstdcxx-backtrace --enable-libstdcxx-time=yes --enable-libstdcxx-visibility --enable-libstdcxx-threads --enable-static --with-default-libstdcxx-abi=new --enable-pie-tools --enable-gold --disable-nls --disable-libstdcxx-debug --disable-libstdcxx-pch --disable-install-libiberty --disable-werror --enable-shared --enable-threads=posix --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk --enable-bootstrap --with-stage1-ldflags=' -L/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/16.0.6-1.1/.content/lib -L/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/16.0.6-1.1/.content/lib/clang/16/lib/darwin' --with-boot-ldflags=' -v -static-libstdc++ -static-libgcc  -O2 -v -Wl,-macosx_version_min,11.0 -Wl,-headerpad_max_install_names -Wl,-dead_strip -L/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib -Wl,-rpath,/Users/ilg/actions-runners/xpack-dev-tools/_work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib' --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.0 (xPack GCC arm64) 
COLLECT_GCC_OPTIONS='-o' 'static-lib-simple-hello-cpp-one' '-static-libgcc' '-static-libstdc++' '-v' '-mmacosx-version-min=14.0.0' '-asm_macosx_version_min=14.0' '-nodefaultexport' '-mcpu=apple-m1' '-mlittle-endian' '-mabi=lp64' '-dumpdir' 'static-lib-simple-hello-cpp-one-'
 /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../libexec/gcc/aarch64-apple-darwin20.6.0/14.1.0/cc1plus -quiet -v -iprefix /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/ -D__DYNAMIC__ simple-hello.cpp -fPIC -quiet -dumpdir static-lib-simple-hello-cpp-one- -dumpbase simple-hello.cpp -dumpbase-ext .cpp -mmacosx-version-min=14.0.0 -mcpu=apple-m1 -mlittle-endian -mabi=lp64 -version -o /var/folders/lr/439_fwvd3m76p9vy50d57kcc0000gn/T//ccgype5h.s
GNU C++17 (xPack GCC arm64) version 14.1.0 (aarch64-apple-darwin20.6.0)
    compiled by GNU C version 14.1.0, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.26-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/../../../../aarch64-apple-darwin20.6.0/include"
ignoring duplicate directory "/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/../../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/../../../../include/c++/14.1.0"
ignoring duplicate directory "/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/../../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/../../../../include/c++/14.1.0/aarch64-apple-darwin20.6.0"
ignoring duplicate directory "/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/../../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/../../../../include/c++/14.1.0/backward"
ignoring duplicate directory "/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/../../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring duplicate directory "/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/../../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/include-fixed"
ignoring nonexistent directory "/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/../../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/../../../../aarch64-apple-darwin20.6.0/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/../../../../include/c++/14.1.0
 /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/../../../../include/c++/14.1.0/aarch64-apple-darwin20.6.0
 /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/../../../../include/c++/14.1.0/backward
 /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/include
 /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/include-fixed
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks
End of search list.
Compiler executable checksum: 34e809d90a442e97cd1b81280669c6a0
COLLECT_GCC_OPTIONS='-o' 'static-lib-simple-hello-cpp-one' '-static-libgcc' '-static-libstdc++' '-v' '-mmacosx-version-min=14.0.0'  '-nodefaultexport' '-mcpu=apple-m1' '-mlittle-endian' '-mabi=lp64' '-dumpdir' 'static-lib-simple-hello-cpp-one-'
 as -arch arm64 -v -mmacosx-version-min=14.0 -o /var/folders/lr/439_fwvd3m76p9vy50d57kcc0000gn/T//ccvp46d6.o /var/folders/lr/439_fwvd3m76p9vy50d57kcc0000gn/T//ccgype5h.s
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1as -triple arm64-apple-macosx14.0.0 -filetype obj -main-file-name ccgype5h.s -target-cpu apple-m1 -target-feature +v8.5a -target-feature +crc -target-feature +lse -target-feature +rdm -target-feature +crypto -target-feature +dotprod -target-feature +fp-armv8 -target-feature +neon -target-feature +fp16fml -target-feature +ras -target-feature +rcpc -target-feature +zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sm4 -target-feature +sha3 -target-feature +sha2 -target-feature +aes -fdebug-compilation-dir=/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/gcc/c-cpp -dwarf-debug-producer "Apple clang version 15.0.0 (clang-1500.0.40.1)" -dwarf-version=4 -mrelocation-model pic --mrelax-relocations -mllvm -disable-aligned-alloc-awareness=1 -o /var/folders/lr/439_fwvd3m76p9vy50d57kcc0000gn/T//ccvp46d6.o /var/folders/lr/439_fwvd3m76p9vy50d57kcc0000gn/T//ccgype5h.s
COMPILER_PATH=/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../libexec/gcc/aarch64-apple-darwin20.6.0/14.1.0/:/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../libexec/gcc/
LIBRARY_PATH=/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/:/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/:/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/../../../
COLLECT_GCC_OPTIONS='-o' 'static-lib-simple-hello-cpp-one' '-static-libgcc' '-static-libstdc++' '-v' '-mmacosx-version-min=14.0.0'  '-nodefaultexport' '-mcpu=apple-m1' '-mlittle-endian' '-mabi=lp64' '-dumpdir' 'static-lib-simple-hello-cpp-one.'
 /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../libexec/gcc/aarch64-apple-darwin20.6.0/14.1.0/collect2 -demangle -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/ -dynamic -arch arm64 -platform_version macos 14.0.0 0.0 -o static-lib-simple-hello-cpp-one -L/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0 -L/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc -L/Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/../../.. -lemutls_w -lheapt_w /var/folders/lr/439_fwvd3m76p9vy50d57kcc0000gn/T//ccvp46d6.o /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/bin/../lib/gcc/aarch64-apple-darwin20.6.0/14.1.0/../../../libstdc++.a -lgcc -lSystem -no_compact_unwind -rpath @loader_path -rpath /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/lib/gcc/aarch64-apple-darwin20.6.0/14.1.0 -rpath /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/lib/gcc -rpath /Users/runner/work/gcc-xpack/gcc-xpack/build/darwin-arm64/aarch64-apple-darwin23.5.0/tests/xpack-gcc-14.1.0-1/lib
0  0x10432f648  __assert_rtn + 72
1  0x104263fac  ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1204
2  0x104279924  ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 15164
3  0x1042843f8  ld::InputFiles::SliceParser::parse() const + 2468
4  0x104286e30  ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 420
5  0x199e1e428  _dispatch_client_callout2 + 20
6  0x199e32850  _dispatch_apply_invoke3 + 336
7  0x199e1e3e8  _dispatch_client_callout + 20
8  0x199e1fc68  _dispatch_once_callout + 32
9  0x199e318a4  _dispatch_apply_invoke + 252
10  0x199e1e3e8  _dispatch_client_callout + 20
11  0x199e30080  _dispatch_root_queue_drain + 864
12  0x199e306b8  _dispatch_worker_thread2 + 156
13  0x199fcafd0  _pthread_wqthread + 228
ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336.
collect2: error: ld returned 1 exit status
iains commented 2 months ago

that looks like a new one to me - we need a stand-alone test case that fails; we can then try to figure out if it's our problem or the new linker.

@fxcoudert - have you seen this one?

edit : note that (for now) my testing on Darwin23 is x86_64 only - but I am expecting to be able to test on aarch64-darwin23 in the future.

ilg-ul commented 2 months ago

we need a stand-alone test case that fails

the one mentioned above is available from https://github.com/xpack-dev-tools/xbb-helper-xpack/tree/xpack/tests/c-cpp.

given the large number of failing tests, we can pick any of them.

the GitHub Actions run with all failing tests is: https://github.com/xpack-dev-tools/gcc-xpack/actions/runs/9317099859/job/25646715683.

my testing on Darwin23 is x86_64 only - but I am expecting to be able to test on aarch64-darwin23 in the future.

GitHub added recently the macos-14 actions runner, running on an arm64 machine.

in addition I also have access to a Mac Mini hosted by macStadium; I use it to build the arm64 images.

if I can do anything to help, please let me know, I'm currently stuck with the 14.1 release.

iains commented 2 months ago

please file something stand-alone here - I do not have the resources to figure out how to build xpack etc.

If it's an issue with the new linker, we might be able to work around it by using "ld-classic" but first let's get a reproducible test case outside of your harnesses etc.

fxcoudert commented 2 months ago

You say “the latest Apple linker”, but it is not the latest version:

[xcode-select --print-path]
/Applications/Xcode_15.0.1.app/Contents/Developer

[pkgutil --pkg-info=com.apple.pkg.CLTools_Executables]
package-id: com.apple.pkg.CLTools_Executables
version: 15.3.0.0.1.1708646388

Xcode is an old version, and I think it's being picked up. The error message and backtrace exactly match FB13038083, which I filed:

When compiling GCC (any recent version) on macOS Sonoma beta with Xcode or CLT beta, compilation errors out with a linker crash:

0  0x10073f668  __assert_rtn + 72
1  0x100673fcc  ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1204
2  0x100689944  ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 15164
3  0x100696e50  ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 420
4  0x1007113f8  ld::AtomFileConsolidator::parseFiles(bool) + 324
5  0x1006b2190  main + 9048
ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336.

The crash can be reproduced systematically by running “/usr/bin/ld -dynamic -o toto.dylib toto.o -v” on the attached file “toto.o”
That object file has been obtained by compiling the attached assembler toto.s file with the following command line:

"/Library/Developer/CommandLineTools/usr/bin/clang" -cc1as -triple arm64-apple-macosx14.0.0 -filetype obj -main-file-name toto.s -target-cpu apple-m1 -target-feature +v8.5a -target-feature +crc -target-feature +lse -target-feature +rdm -target-feature +crypto -target-feature +dotprod -target-feature +fp-armv8 -target-feature +neon -target-feature +fp16fml -target-feature +ras -target-feature +rcpc -target-feature +zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sm4 -target-feature +sha3 -target-feature +sha2 -target-feature +aes -fdebug-compilation-dir=/Users/fx/ibin/aarch64-apple-darwin23.0.0/libstdc++-v3/src -dwarf-debug-producer "Apple clang version 15.0.0 (clang-1500.0.40.1)" -dwarf-version=4 -mrelocation-model pic --mrelax-relocations -mllvm -disable-aligned-alloc-awareness=1 -o toto.o toto.s

That assembler file has itself been obtained by compiling libstdc++-v6 as part of the GCC bootstrap.

That was fixed with Xcode 15.1 and later.

iains commented 2 months ago

@fxcoudert thanks, I wonder why the GH runners have such an old CLT on them (especially since the OS is up to date).

edit: this might be the second reported issue from these GH runners (there's an Ada problem too)

fxcoudert commented 2 months ago

I have very little experience with the Github macOS runners, but they are not sufficiently stable (or frequently updated) for us (Homebrew) to use at large scale. We rely on our own machines.

ilg-ul commented 2 months ago

please file something stand-alone here

I provided a link to the simple-exception.cpp source file, the command that I used to invoke the compiler ([.../xpack-gcc-14.1.0-1/bin/g++ simple-exception.cpp -o simple-exception], and the output I got when the linker crashed.

What else would be needed to be considered a 'stand-alone' test?

iains commented 2 months ago

please file something stand-alone here

I provided a link to the simple-exception.cpp source file, the command that I used to invoke the compiler ([.../xpack-gcc-14.1.0-1/bin/g++ simple-exception.cpp -o simple-exception], and the output I got when the linker crashed.

What else would be needed to be considered a 'stand-alone' test?

OK. however, the question is answered - this is not a GCC issue and the Xcode CLT have been fixed - the problem here is that the runner has a buggy CLT install.

ilg-ul commented 2 months ago

That was fixed with Xcode 15.1 and later.

So this is basically an unfortunate choice of versions by GitHub, and the same test running on an up to date machine is expected to pass?

ilg-ul commented 2 months ago

I did some further research, and after some tweaks in the GitHub configuration, my tests also passed on macOS arm64 14.5 with Xcode 15.4! :-)

The trick was to explicitly set the desired Xcode version:

sudo xcode-select --switch /Applications/Xcode_15.4.app

After this, GCC picked the linker (actually it used clang) from the 15.4 folder (instead of the problematic one from the 15.0 folder), and the tests passed.

The explanation is that GitHub packs multiple Xcode versions in parallel, and the user can choose any of them:

lrwxr-xr-x   1 runner  admin   30 May 26 22:10 Xcode.app -> /Applications/Xcode_15.0.1.app
drwxr-xr-x   3 runner  staff   96 May 26 21:35 Xcode_14.3.1.app
lrwxr-xr-x   1 runner  admin   30 May 26 22:09 Xcode_14.3.app -> /Applications/Xcode_14.3.1.app
drwxr-xr-x   3 runner  staff   96 May 26 21:29 Xcode_15.0.1.app
lrwxr-xr-x   1 runner  admin   30 May 26 22:09 Xcode_15.0.app -> /Applications/Xcode_15.0.1.app
lrwxr-xr-x   1 runner  admin   28 May 26 22:09 Xcode_15.1.0.app -> /Applications/Xcode_15.1.app
drwxr-xr-x   3 runner  staff   96 May 26 21:30 Xcode_15.1.app
lrwxr-xr-x   1 runner  admin   28 May 26 22:09 Xcode_15.2.0.app -> /Applications/Xcode_15.2.app
drwxr-xr-x   3 runner  staff   96 May 26 21:29 Xcode_15.2.app
lrwxr-xr-x   1 runner  admin   28 May 26 22:09 Xcode_15.3.0.app -> /Applications/Xcode_15.3.app
drwxr-xr-x   3 runner  staff   96 May 26 21:29 Xcode_15.3.app
lrwxr-xr-x   1 runner  admin   28 May 26 22:09 Xcode_15.4.0.app -> /Applications/Xcode_15.4.app
drwxr-xr-x   3 runner  staff   96 May 26 21:36 Xcode_15.4.app

Unfortunately the default is 15.0.1, which does not play very well with GCC. :-(

For more details on the content of the macOS 14 image, please see:

So this issue can be closed, there is nothing wrong with GCC, and I can proceed with the 14.1 release.