Linker error while trying to build ARCv3 native toolchains
Closed this issue · 5 comments
Same error for arc32-native-uclibc and arc64-snps-native-gnu
[arcoss@cc7c5af962b0 gcc]$ pwd
/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/build/build-cc-gcc-final/gcc
[arcoss@cc7c5af962b0 gcc]$ /home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/bin/arc32-host_unknown-linux-gnu-g++ -no-pie -O2 -g -pipe -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/include -O1 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -no-pie -static-libstdc++ -static-libgcc -L/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/lib -o cc1plus cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o cp/coroutines.o cp/cp-gimplify.o cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o cp/contracts.o cp/cxx-pretty-print.o cp/decl.o cp/decl2.o cp/dump.o cp/error.o cp/except.o cp/expr.o cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o cp/mangle.o cp/mapper-client.o cp/mapper-resolver.o cp/method.o cp/module.o cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/rtti.o cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o cp/vtable-class-hierarchy.o attribs.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o arc64-c.o glibc-c.o cc1plus-checksum.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcody/libcody.a libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/lib -L/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/lib -L/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/lib -lmpc -lmpfr -lgmp -L./../zlib -lz -lzstd
/home/arcoss/crosstool-ng/arc32-linux-uclibc/bin/../lib/gcc/arc32-snps-linux-uclibc/14.1.0/../../../../arc32-snps-linux-uclibc/lib/libstdc++.a(functexcept.o): in function `std::__throw_bad_exception()':
/SCRATCH/arcjenkins2/slaves/us01-odc-custom-arcoss1/workspace/arcoss_verification/arc_gnu_toolchain_verification/build_toolchain-4/crosstool-ng/.build/arc32-snps-linux-uclibc/src/gcc/libstdc++-v3/src/c++11/functexcept.cc:50:(.text.unlikely._ZSt21__throw_bad_exceptionv+0x2): relocation truncated to fit: R_ARC_S25W_PCREL_PLT against symbol `__cxa_allocate_exception' defined in .text.__cxa_allocate_exception section in /home/arcoss/crosstool-ng/arc32-linux-uclibc/bin/../lib/gcc/arc32-snps-linux-uclibc/14.1.0/../../../../arc32-snps-linux-uclibc/lib/libstdc++.a(eh_alloc.o)
collect2: error: ld returned 1 exit status
All components' branches are arc-2024.06
. Test case to follow shortly.
Configure command lines from the log:
[DEBUG] Configured with: /workspace/crosstool-ng/arc32-linux-uclibc/arc32-snps-linux-uclibc/sysroot --enable-languages=c,c++ --with-pkgversion='ARCv3 Linux uclibc toolchain - build 6846'
--enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx --with-gmp=/workspace/crosstool-ng/arc32-linux-uclibc/arc32-snps-linux-uclibc/sysroot --enable-long-long --with-gnu-as --with-gnu-ld
[DEBUG] ==> Executing: CC_FOR_BUILD='x86_64-build_pc-linux-gnu-gcc'
CFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
CXXFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
LDFLAGS_FOR_BUILD='-L/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/lib '
CFLAGS='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
CXXFLAGS='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
LDFLAGS='-L/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/lib '
'/usr/bin/bash'
'/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/src/binutils/configure'
'--build=x86_64-build_pc-linux-gnu'
'--host=x86_64-build_pc-linux-gnu'
'--target=arc32-snps-linux-uclibc'
'--prefix=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools'
'--disable-werror'
'--enable-ld=yes'
'--enable-gold=no'
'--enable-deterministic-archives'
'--with-pkgversion=ARCv3 Native uclibc toolchain - build 6846'
'--disable-multilib'
'--disable-sim'
'--disable-gdb'
'--disable-nls'
'--without-zstd'
'--with-sysroot=/home/arcoss/crosstool-ng/arc32-native-uclibc/arc32-snps-linux-uclibc/sysroot'
[DEBUG] ==> Executing: CC_FOR_BUILD='x86_64-build_pc-linux-gnu-gcc'
CFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
CXXFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
LDFLAGS_FOR_BUILD='-L/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/lib '
CFLAGS='-O2 -g -pipe -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/include -O1'
CXXFLAGS='-O2 -g -pipe -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/include -O1 '
LDFLAGS='-L/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/lib '
'/usr/bin/bash'
'/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/src/binutils/configure'
'--build=x86_64-build_pc-linux-gnu'
'--host=arc32-host_unknown-linux-gnu'
'--target=arc32-snps-linux-uclibc'
'--prefix=/home/arcoss/crosstool-ng/arc32-native-uclibc'
'--disable-werror'
'--enable-ld=yes'
'--enable-gold=no'
'--enable-deterministic-archives'
'--with-pkgversion=ARCv3 Native uclibc toolchain - build 6846'
'--disable-multilib'
'--disable-sim'
'--disable-gdb'
'--disable-nls'
'--without-zstd'
'--with-sysroot=/home/arcoss/crosstool-ng/arc32-native-uclibc/arc32-snps-linux-uclibc/sysroot'
[DEBUG] ==> Executing: CC_FOR_BUILD='x86_64-build_pc-linux-gnu-gcc'
CFLAGS='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
CFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
CXXFLAGS='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
CXXFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
LDFLAGS='-L/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/lib '
CFLAGS_FOR_TARGET='-g -O2 -g -O2 -ffunction-sections -fdata-sections'
CXXFLAGS_FOR_TARGET='-g -O2 -g -O2 -ffunction-sections -fdata-sections'
LDFLAGS_FOR_TARGET=''
'/usr/bin/bash'
'/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/src/gcc/configure'
'--build=x86_64-build_pc-linux-gnu'
'--host=x86_64-build_pc-linux-gnu'
'--target=arc32-snps-linux-uclibc'
'--prefix=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools'
'--exec_prefix=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools'
'--with-local-prefix=/home/arcoss/crosstool-ng/arc32-native-uclibc/arc32-snps-linux-uclibc/sysroot'
'--with-sysroot=/home/arcoss/crosstool-ng/arc32-native-uclibc/arc32-snps-linux-uclibc/sysroot'
'--with-newlib'
'--enable-threads=no'
'--disable-shared'
'--with-pkgversion=ARCv3 Native uclibc toolchain - build 6846'
'--enable-__cxa_atexit'
'--disable-libgomp'
'--disable-libmudflap'
'--disable-libmpx'
'--disable-libssp'
'--disable-libquadmath'
'--disable-libquadmath-support'
'--disable-libstdcxx'
'--with-gmp=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools'
'--with-mpfr=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools'
'--with-mpc=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools'
'--with-isl=no'
'--with-cloog=no'
'--enable-lto'
'--disable-nls'
'--disable-multilib'
'--enable-languages=c'
[DEBUG] ==> Executing: CC_FOR_BUILD='x86_64-build_pc-linux-gnu-gcc'
CFLAGS='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
CFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
CXXFLAGS='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
CXXFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/include '
LDFLAGS='-L/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/lib '
CFLAGS_FOR_TARGET='-g -O2 -g -O2 -ffunction-sections -fdata-sections'
CXXFLAGS_FOR_TARGET='-g -O2 -g -O2 -ffunction-sections -fdata-sections'
LDFLAGS_FOR_TARGET=''
'/usr/bin/bash'
'/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/src/gcc/configure'
'--build=x86_64-build_pc-linux-gnu'
'--host=x86_64-build_pc-linux-gnu'
'--target=arc32-snps-linux-uclibc'
'--prefix=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools'
'--exec_prefix=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools'
'--with-sysroot=/home/arcoss/crosstool-ng/arc32-native-uclibc/arc32-snps-linux-uclibc/sysroot'
'--enable-languages=c,c++,fortran'
'--with-pkgversion=ARCv3 Native uclibc toolchain - build 6846'
'--enable-__cxa_atexit'
'--disable-libmudflap'
'--disable-libgomp'
'--disable-libssp'
'--disable-libquadmath'
'--disable-libquadmath-support'
'--disable-libsanitizer'
'--disable-libmpx'
'--with-gmp=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools'
'--with-mpfr=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools'
'--with-mpc=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools'
'--with-isl=no'
'--with-cloog=no'
'--enable-lto'
'--enable-threads=posix'
'--disable-plugin'
'--disable-nls'
'--disable-multilib'
'--with-local-prefix=/home/arcoss/crosstool-ng/arc32-native-uclibc/arc32-snps-linux-uclibc/sysroot'
'--enable-long-long'
[DEBUG] ==> Executing: CC_FOR_BUILD='x86_64-build_pc-linux-gnu-gcc'
CFLAGS='-O2 -g -pipe -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/include -O1'
CFLAGS_FOR_BUILD='-O2 -g -pipe -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/include -O1'
CXXFLAGS='-O2 -g -pipe -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/include -O1 '
CXXFLAGS_FOR_BUILD='-O2 -g -pipe -I/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/include -O1 '
LDFLAGS='-L/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host/lib '
CFLAGS_FOR_TARGET='-g -O2 -g -O2 -ffunction-sections -fdata-sections'
CXXFLAGS_FOR_TARGET='-g -O2 -g -O2 -ffunction-sections -fdata-sections'
LDFLAGS_FOR_TARGET=''
'/usr/bin/bash'
'/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/src/gcc/configure'
'--build=x86_64-build_pc-linux-gnu'
'--host=arc32-host_unknown-linux-gnu'
'--target=arc32-snps-linux-uclibc'
'--prefix=/home/arcoss/crosstool-ng/arc32-native-uclibc'
'--exec_prefix=/home/arcoss/crosstool-ng/arc32-native-uclibc'
'--with-sysroot=/home/arcoss/crosstool-ng/arc32-native-uclibc/arc32-snps-linux-uclibc/sysroot'
'--enable-languages=c,c++,fortran'
'--with-pkgversion=ARCv3 Native uclibc toolchain - build 6846'
'--enable-__cxa_atexit'
'--disable-libmudflap'
'--disable-libgomp'
'--disable-libssp'
'--disable-libquadmath'
'--disable-libquadmath-support'
'--disable-libsanitizer'
'--disable-libmpx'
'--with-gmp=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host'
'--with-mpfr=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host'
'--with-mpc=/home/arcoss/crosstool-ng/.build/HOST-arc32-linux/arc32-snps-linux-uclibc/buildtools/complibs-host'
'--with-isl=no'
'--with-cloog=no'
'--enable-lto'
'--enable-threads=posix'
'--disable-plugin'
'--disable-nls'
'--disable-multilib'
'--with-local-prefix=/home/arcoss/crosstool-ng/arc32-native-uclibc/arc32-snps-linux-uclibc/sysroot'
'--enable-long-long'
@kolerov I got the test case which reproduces the issue with the corresponding cross toolchain, but it's huge as this link command has many dependencies. Pls text me if you'll need this, I'll give you pointers on where to find it.
@yaroslavsadin I have created a merge request for our building scripts. It is necessary to build native toolchains for ARC Classic with -Os
instead of -O1
because since GCC 14 binaries became too large for ARC Classic relocations.
However, building of native toolchain are blocked with another bug in GCC 14. I have created a PR with a hot fix for this bug.
@yaroslavsadin A patch is pushed to arc-2024.06
and arc64
. Please, confirm that native toolchains build successfully.
This is fixed.