Many of the unit test for dev-lang/swig (~20%) fail to link on sparc with the error "relocation truncated to fit: R_SPARC_GOT13". One example (linking against c++ std library): checking tcl testcase primitive_types (with run test) primitive_types_wrap.o: in function `var_init()': primitive_types_wrap.cxx:(.text+0x4be8): relocation truncated to fit: R_SPARC_GOT13 against symbol `var_pchar' defined in .bss section in primitive_types_wrap.o primitive_types_wrap.cxx:(.text+0x4bf0): relocation truncated to fit: R_SPARC_GOT13 against symbol `var_pcharc' defined in .bss section in primitive_types_wrap.o primitive_types_wrap.cxx:(.text+0x4bf8): relocation truncated to fit: R_SPARC_GOT13 against symbol `var_pint' defined in .bss section in primitive_types_wrap.o primitive_types_wrap.cxx:(.text+0x4c00): relocation truncated to fit: R_SPARC_GOT13 against symbol `var_namet' defined in .bss section in primitive_types_wrap.o primitive_types_wrap.o: in function `v_check()': primitive_types_wrap.cxx:(.text+0x5c48): relocation truncated to fit: R_SPARC_GOT13 against symbol `std::cout@@GLIBCXX_3.4' defined in .bss section in /usr/lib/gcc/sparc64-unknown-linux-gnu/12/libstdc++.so primitive_types_wrap.cxx:(.text+0x5cd4): relocation truncated to fit: R_SPARC_GOT13 against symbol `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<ch ar> >&)@@GLIBCXX_3.4' defined in .text section in /usr/lib/gcc/sparc64-unknown-linux-gnu/12/libstdc++.so primitive_types_wrap.cxx:(.text+0x5e44): relocation truncated to fit: R_SPARC_GOT13 against symbol `std::cout@@GLIBCXX_3.4' defined in .bss section in /usr/lib/gcc/sparc64-unknown-linux-gnu/12/libstdc++.so primitive_types_wrap.cxx:(.text+0x5ed0): relocation truncated to fit: R_SPARC_GOT13 against symbol `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)@@GLIBCXX_3.4' defined in .text section in /usr/lib/gcc/sparc64-unknown-linux-gnu/12/libstdc++.so primitive_types_wrap.cxx:(.text+0x6044): relocation truncated to fit: R_SPARC_GOT13 against symbol `std::cout@@GLIBCXX_3.4' defined in .bss section in /usr/lib/gcc/sparc64-unknown-linux-gnu/12/libstdc++.so primitive_types_wrap.cxx:(.text+0x60d0): relocation truncated to fit: R_SPARC_GOT13 against symbol `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)@@GLIBCXX_3.4' defined in .text section in /usr/lib/gcc/sparc64-unknown-linux-gnu/12/libstdc++.so primitive_types_wrap.cxx:(.text+0x624c): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status make[2]: *** [../../../Examples/Makefile:1577: tcl_cpp] Error 1 make[1]: *** [Makefile:36: primitive_types.cpptest] Error 2 Another example, linking against libpython: checking python testcase li_std_pair_extra (with run test) li_std_pair_extra_wrap.o: in function `SWIG_Python_ErrorType(int)': li_std_pair_extra_wrap.cxx:(.text+0x12fc): relocation truncated to fit: R_SPARC_GOT13 against undefined symbol `PyExc_MemoryError' li_std_pair_extra_wrap.cxx:(.text+0x1310): relocation truncated to fit: R_SPARC_GOT13 against undefined symbol `PyExc_IOError' li_std_pair_extra_wrap.cxx:(.text+0x1324): relocation truncated to fit: R_SPARC_GOT13 against undefined symbol `PyExc_RuntimeError' li_std_pair_extra_wrap.cxx:(.text+0x1338): relocation truncated to fit: R_SPARC_GOT13 against undefined symbol `PyExc_IndexError' li_std_pair_extra_wrap.cxx:(.text+0x134c): relocation truncated to fit: R_SPARC_GOT13 against undefined symbol `PyExc_TypeError' li_std_pair_extra_wrap.cxx:(.text+0x1360): relocation truncated to fit: R_SPARC_GOT13 against undefined symbol `PyExc_ZeroDivisionError' li_std_pair_extra_wrap.cxx:(.text+0x1374): relocation truncated to fit: R_SPARC_GOT13 against undefined symbol `PyExc_OverflowError' li_std_pair_extra_wrap.cxx:(.text+0x1388): relocation truncated to fit: R_SPARC_GOT13 against undefined symbol `PyExc_SyntaxError' li_std_pair_extra_wrap.cxx:(.text+0x139c): relocation truncated to fit: R_SPARC_GOT13 against undefined symbol `PyExc_ValueError' li_std_pair_extra_wrap.cxx:(.text+0x13b0): relocation truncated to fit: R_SPARC_GOT13 against undefined symbol `PyExc_SystemError' li_std_pair_extra_wrap.cxx:(.text+0x13c4): additional relocation overflows omitted from the output checking python testcase python_abstractbase (with run test) collect2: error: ld returned 1 exit status make[2]: *** [../../../Examples/Makefile:1283: python_cpp] Error 1 make[1]: *** [Makefile:120: li_std_pair_extra.cpptest] Error 2 Reproducible: Always Portage 3.0.44 (python 3.10.10-final-0, default/linux/sparc/17.0/64ul, gcc-12, glibc-2.36-r5, 6.2.3-gentoo-sparc64 sparc64) ================================================================= System uname: Linux-6.2.3-gentoo-sparc64-sparc64-sun4v-with-glibc2.36 KiB Mem: 32650568 total, 29354920 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Sat, 11 Mar 2023 00:45:01 +0000 Head commit of repository gentoo: 53e7eb032401e1f10a5248c5f214082a8f0f47b9 sh bash 5.1_p16-r2 ld GNU ld (Gentoo 2.39 p5) 2.39.0 app-misc/pax-utils: 1.3.5::gentoo app-shells/bash: 5.1_p16-r2::gentoo dev-lang/perl: 5.36.0-r1::gentoo dev-lang/python: 3.10.10_p2::gentoo, 3.11.2_p1::gentoo dev-util/cmake: 3.25.2::gentoo dev-util/meson: 1.0.0::gentoo sys-apps/baselayout: 2.13-r1::gentoo sys-apps/openrc: 0.45.2-r2::gentoo sys-apps/sandbox: 2.29::gentoo sys-devel/autoconf: 2.71-r5::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/binutils: 2.39-r4::gentoo sys-devel/binutils-config: 5.4.1::gentoo sys-devel/clang: 15.0.7-r1::gentoo sys-devel/gcc: 12.2.1_p20230121-r1::gentoo sys-devel/gcc-config: 2.8::gentoo sys-devel/libtool: 2.4.7::gentoo sys-devel/llvm: 15.0.7::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 6.1::gentoo (virtual/os-headers) sys-libs/glibc: 2.36-r5::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 volatile: True sync-rsync-extra-opts: sync-rsync-verify-metamanifest: yes sync-rsync-verify-max-age: 24 sync-rsync-verify-jobs: 1 ACCEPT_KEYWORDS="sparc" ACCEPT_LICENSE="@FREE" CBUILD="sparc64-unknown-linux-gnu" CFLAGS="-O2 -mcpu=ultrasparc -pipe" CHOST="sparc64-unknown-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -mcpu=ultrasparc -pipe" DISTDIR="/var/cache/distfiles" EMERGE_DEFAULT_OPTS="--autounmask=y --autounmask-continue=y" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME" FCFLAGS="-O2 -mcpu=ultrasparc -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -mcpu=ultrasparc -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LEX="flex" MAKEOPTS="-j36" PKGDIR="/var/cache/binpkgs" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" SHELL="/sbin/nologin" USE="acl big-endian bzip2 cli crypt dri fortran gdbm iconv ipv6 libglvnd libtirpc llvm-libunwind ncurses nls nptl openmp pam pcre readline sparc split-usr ssl test-rust unicode xattr zlib" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27 ruby30" USERLAND="GNU" VIDEO_CARDS="fbdev mga r128 radeon dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Created attachment 857253 [details] build.log
Any better with binutils-2.40?
(In reply to Sam James from comment #2) > Any better with binutils-2.40? No, unfortunately.
We didn't run the tests before, so I'm not worried about this as a regression at least.
Created attachment 896741 [details] build.log and emerge --info Still an issue here: swig-4.2.1, binutils-2.42-r1
For this and the hppa bug, I think we need to first try extract it to be standalone (figure out what it's calling gcc or g++ with, call it manually, then get the preprocessed sources, and so on), then minimise it and report to gcc/binutils.
Created attachment 898004 [details] cpp11_variadic_templates_wrap.ii Minimized source from cvise, this is as small as it could get it. $ sparc64-unknown-linux-gnu-g++ -fpic -shared -x c++ -o /dev/null cpp11_variadic_templates_wrap.ii -w /tmp/cc0FfoHu.o: in function `_wrap_VariadicParms3_ParmsFuncPtrPtrRValueRef()': cpp11_variadic_templates_wrap.ii:(.text+0x1bb4): relocation truncated to fit: R_SPARC_GOT13 against undefined symbol `vtable for C' /tmp/cc0FfoHu.o: in function `__static_initialization_and_destruction_0()': cpp11_variadic_templates_wrap.ii:(.text+0x2360): relocation truncated to fit: R_SPARC_GOT13 against symbol `_wrap_VariadicParms2_ParmsVal_argp2' defined in .data.rel section in /tmp/cc0FfoHu.o collect2: error: ld returned 1 exit status
Thank you! Nice job.
See the attached upstream PR for fix.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=228410dfe66b2f9b6c738675c1ad5656d9235aed commit 228410dfe66b2f9b6c738675c1ad5656d9235aed Author: Sam James <sam@gentoo.org> AuthorDate: 2024-09-22 13:58:22 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-09-22 13:58:22 +0000 dev-lang/swig: build with -fPIC, not -fpic This fixes tests on hppa, sparc. Closes: https://bugs.gentoo.org/900769 Closes: https://bugs.gentoo.org/935318 Signed-off-by: Sam James <sam@gentoo.org> dev-lang/swig/swig-4.2.1.ebuild | 11 +++++++++++ 1 file changed, 11 insertions(+)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a014002fbb31da31fe6914a3c8e00b0b8f666f46 commit a014002fbb31da31fe6914a3c8e00b0b8f666f46 Author: Joonas Niilola <juippis@gentoo.org> AuthorDate: 2024-09-22 18:43:49 +0000 Commit: Joonas Niilola <juippis@gentoo.org> CommitDate: 2024-09-22 18:45:09 +0000 dev-lang/swig: add missing patch file from upstream PR#2969 Bug: https://bugs.gentoo.org/900769 Bug: https://bugs.gentoo.org/935318 Signed-off-by: Joonas Niilola <juippis@gentoo.org> dev-lang/swig/files/swig-4.2.1-tests-fpic.patch | 115 ++++++++++++++++++++++++ 1 file changed, 115 insertions(+)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=70712e467abc2e7e112e973197d04866ba3a9117 commit 70712e467abc2e7e112e973197d04866ba3a9117 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-09-23 00:35:04 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-09-23 00:35:04 +0000 dev-lang/swig: drop leftover patch I switched it to a sed in the end because eautoreconf didn't work and I didn't want to spend time debugging it. Sorry! Bug: https://bugs.gentoo.org/935318 Bug: https://bugs.gentoo.org/900769 Closes: https://bugs.gentoo.org/940064 Signed-off-by: Sam James <sam@gentoo.org> dev-lang/swig/files/swig-4.2.1-tests-fpic.patch | 115 ------------------------ dev-lang/swig/swig-4.2.1.ebuild | 4 - 2 files changed, 119 deletions(-)