From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7BAD03851C0B; Mon, 18 May 2020 22:37:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BAD03851C0B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589841458; bh=NcB3dH+pmi+ouudZllHR7Y9OnQiVbPWXp/oMl05dcWE=; h=From:To:Subject:Date:From; b=ED7VveHua93vG+aQ0zAO6A3nCdKXC6NWzj0Gyk36RZ5z+j7ffxI0uSQSBMkPunn7G ig6n+yVvZHihWx4LIKGmO4wWu4qCTW9EPKLCqDlP5X43TvDyz/5NsbRzdQu+PnCRIc VN2zZ/ZDh1xnmwVAuZrej/bPrmMdZsAnL9G1hxEg= From: "slyfox at inbox dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/95194] New: bootstrap-lto fails on musl (bundled libintl uses asm aliases) Date: Mon, 18 May 2020 22:37:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at inbox dot ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 May 2020 22:37:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95194 Bug ID: 95194 Summary: bootstrap-lto fails on musl (bundled libintl uses asm aliases) Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at inbox dot ru CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- The bug is originally reported by Andrew Savchenko as https://bugs.gentoo.org/723370. There gcc's bootstrap-lto fails on musl lib= c. It's slightly different from glibc as libintl relies on glibc-specific gett= ext symbols like '_nl_msg_cat_cntr'. The bug: $ /var/tmp/portage/sys-devel/gcc-10.1.0/work/gcc-10.1.0/configure --host=3Dx86_64-gentoo-linux-musl --build=3Dx86_64-gentoo-linux-musl --pref= ix=3D/usr --bindir=3D/usr/x86_64-gentoo-linux-musl/gcc-bin/10.1.0 --includedir=3D/usr/lib/gcc/x86_64-gentoo-linux-musl/10.1.0/include --datadir=3D/usr/share/gcc-data/x86_64-gentoo-linux-musl/10.1.0 --mandir=3D/usr/share/gcc-data/x86_64-gentoo-linux-musl/10.1.0/man --infodir=3D/usr/share/gcc-data/x86_64-gentoo-linux-musl/10.1.0/info --with-gxx-include-dir=3D/usr/lib/gcc/x86_64-gentoo-linux-musl/10.1.0/inclu= de/g++-v10 --with-python-dir=3D/share/gcc-data/x86_64-gentoo-linux-musl/10.1.0/python --enable-languages=3Dc,c++ --enable-obsolete --enable-secureplt --disable-w= error --with-system-zlib --enable-nls --without-included-gettext --enable-checking=3Drelease --with-bugurl=3Dhttps://bugs.gentoo.org/ --with-pkgversion=3DGentoo Hardened 10.1.0 p1 --enable-esp --enable-libstdcxx-time --with-build-config=3Dbootstrap-lto --disable-libstdcxx-pch --enable-shared --enable-threads=3Dposix --enable-__cxa_atexit --disable-multilib --with-multilib-list=3Dm64 --disable-altivec --disable-fixed-point --enable-targets=3Dall --enable-lib= gomp --disable-libmudflap --disable-libssp --disable-libada --disable-systemtap --disable-vtable-verify --disable-libvtv --without-zstd --disable-libquadma= th --enable-lto --without-isl --disable-libsanitizer --enable-default-pie --enable-default-ssp $ make -j8 -l10 'LDFLAGS=3D-march=3Dnative -pipe -Wl,-O1,--as-needed,--sort-common,-z,combreloc,-z,relro,-z,now,--relax,--ha= sh-style=3Dgnu' STAGE1_CFLAGS=3D LIBPATH=3D/usr/lib/gcc/x86_64-gentoo-linux-musl/10.1.0 'BOOT_CFLAGS=3D-m64 -march=3Dnative -pipe -O2' bootstrap-lean /var/tmp/portage/sys-devel/gcc-10.1.0/work/build/./prev-gcc/xg++ -B/var/tmp/portage/sys-devel/gcc-10.1.0/work/build/./prev-gcc/ -B/usr/x86_64-gentoo-linux-musl/bin/ -nostdinc++ -B/var/tmp/portage/sys-devel/gcc-10.1.0/work/build/prev-x86_64-gentoo-linux= -musl/libstdc++-v3/src/.libs -B/var/tmp/portage/sys-devel/gcc-10.1.0/work/build/prev-x86_64-gentoo-linux= -musl/libstdc++-v3/libsupc++/.libs -isystem /var/tmp/portage/sys-devel/gcc-10.1.0/work/build/prev-x86_64-gentoo-linux-m= usl/libstdc++-v3/include/x86_64-gentoo-linux-musl -isystem /var/tmp/portage/sys-devel/gcc-10.1.0/work/build/prev-x86_64-gentoo-linux-m= usl/libstdc++-v3/include -isystem /var/tmp/portage/sys-devel/gcc-10.1.0/work/gcc-10.1.0/libstdc++-v3/libsupc++ -L/var/tmp/portage/sys-devel/gcc-10.1.0/work/build/prev-x86_64-gentoo-linux= -musl/libstdc++-v3/src/.libs -L/var/tmp/portage/sys-devel/gcc-10.1.0/work/build/prev-x86_64-gentoo-linux= -musl/libstdc++-v3/libsupc++/.libs -DEXTRA_OPTIONS -m64 -march=3Dnative -pipe -O2 -fno-checking -flto=3Djo= bserver -frandom-seed=3D1 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=3Dformat-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -fno-PIE -static-libstdc++ -static-libgcc -no-pie -o build/genmatch \ build/genmatch.o ../libcpp/libcpp.a ../libiberty/libiberty.a build/erro= rs.o build/vec.o build/hash-table.o build/sort.o .././libiberty/libiberty.a ./../intl/libintl.a ... /usr/x86_64-gentoo-linux-musl/bin/ld: /var/tmp/portage/sys-devel/gcc-10.1.0/temp/genmatch.NlicMk.ltrans2.ltrans.o= : in function `main': :(.text.startup+0x94ba): undefined reference to `libintl_dgette= xt' /usr/x86_64-gentoo-linux-musl/bin/ld: /var/tmp/portage/sys-devel/gcc-10.1.0/temp/genmatch.NlicMk.ltrans3.ltrans.o= : in function `cpp_diagnostic(cpp_reader*, cpp_diagnostic_level, cpp_warning_rea= son, char const*, __va_list_tag (*) [1])': :(.text+0x2732): undefined reference to `libintl_dgettext' ... Mechanically it fails because 'libintl_dgettext' is decclared as an asm ali= as: """ extern char *dgettext (const char *__domainname, const char *__msgid) __asm__ ("" "libintl_dgettext") __attribute__ ((__format_arg__ (2))); $ ../prev-gcc/lto-dump -list errors.o | fgrep dgettext function default 0 *libintl_dgettext $ ../prev-gcc/lto-dump -demangle -list errors.o | fgrep dgettext function default 0 dgettext """ I'm not sure if gcc should be able to link such a use case for partition=3D= 1. Maybe? Otherwise maybe gcc should default to more portable macro/inline definition= of gettext wrappers. The following workaround helps musl target: --- a/intl/libgnuintl.h +++ b/intl/libgnuintl.h @@ -84,25 +84,25 @@ extern "C" { Since Solaris gettext() behaves differently than GNU gettext(), this would be unacceptable. The redirection happens by default through macros in C, so that &gettext is independent of the compilation unit, but through inline functions in C++, in order not to interfere with the name mangling of class fields or class methods called 'gettext'. */ /* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS. If he doesn't, we choose the method. A third possible method is _INTL_REDIRECT_ASM, supported only by GCC. */ #if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS) -# if __GNUC__ >=3D 2 && !defined __APPLE_CC__ && (defined __STDC__ || defi= ned __cplusplus) +# if __GNUC__ >=3D 2 && !defined __APPLE_CC__ && (defined __STDC__ || defi= ned __cplusplus) && USE_ASM_ALIASES_THAT_BREAK_LTO # define _INTL_REDIRECT_ASM # else # ifdef __cplusplus # define _INTL_REDIRECT_INLINE # else # define _INTL_REDIRECT_MACROS # endif # endif #endif /* Auxiliary macros. */ #ifdef _INTL_REDIRECT_ASM # define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))=