public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/95194] New: bootstrap-lto fails on musl (bundled libintl uses asm aliases)
@ 2020-05-18 22:37 slyfox at inbox dot ru
2020-05-18 22:38 ` [Bug lto/95194] " slyfox at inbox dot ru
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: slyfox at inbox dot ru @ 2020-05-18 22:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95194
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 libc.
It's slightly different from glibc as libintl relies on glibc-specific gettext
symbols like '_nl_msg_cat_cntr'.
The bug:
$ /var/tmp/portage/sys-devel/gcc-10.1.0/work/gcc-10.1.0/configure
--host=x86_64-gentoo-linux-musl --build=x86_64-gentoo-linux-musl --prefix=/usr
--bindir=/usr/x86_64-gentoo-linux-musl/gcc-bin/10.1.0
--includedir=/usr/lib/gcc/x86_64-gentoo-linux-musl/10.1.0/include
--datadir=/usr/share/gcc-data/x86_64-gentoo-linux-musl/10.1.0
--mandir=/usr/share/gcc-data/x86_64-gentoo-linux-musl/10.1.0/man
--infodir=/usr/share/gcc-data/x86_64-gentoo-linux-musl/10.1.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-gentoo-linux-musl/10.1.0/include/g++-v10
--with-python-dir=/share/gcc-data/x86_64-gentoo-linux-musl/10.1.0/python
--enable-languages=c,c++ --enable-obsolete --enable-secureplt --disable-werror
--with-system-zlib --enable-nls --without-included-gettext
--enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion=Gentoo Hardened 10.1.0 p1 --enable-esp
--enable-libstdcxx-time --with-build-config=bootstrap-lto
--disable-libstdcxx-pch --enable-shared --enable-threads=posix
--enable-__cxa_atexit --disable-multilib --with-multilib-list=m64
--disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp
--disable-libmudflap --disable-libssp --disable-libada --disable-systemtap
--disable-vtable-verify --disable-libvtv --without-zstd --disable-libquadmath
--enable-lto --without-isl --disable-libsanitizer --enable-default-pie
--enable-default-ssp
$ make -j8 -l10 'LDFLAGS=-march=native -pipe
-Wl,-O1,--as-needed,--sort-common,-z,combreloc,-z,relro,-z,now,--relax,--hash-style=gnu'
STAGE1_CFLAGS= LIBPATH=/usr/lib/gcc/x86_64-gentoo-linux-musl/10.1.0
'BOOT_CFLAGS=-m64 -march=native -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-musl/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-musl/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=native -pipe -O2 -fno-checking -flto=jobserver
-frandom-seed=1 -DIN_GCC -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wno-error=format-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/errors.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':
<artificial>:(.text.startup+0x94ba): undefined reference to `libintl_dgettext'
/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_reason,
char const*, __va_list_tag (*) [1])':
<artificial>:(.text+0x2732): undefined reference to `libintl_dgettext'
...
Mechanically it fails because 'libintl_dgettext' is decclared as an asm alias:
"""
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=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__ >= 2 && !defined __APPLE_CC__ && (defined __STDC__ || defined
__cplusplus)
+# if __GNUC__ >= 2 && !defined __APPLE_CC__ && (defined __STDC__ || defined
__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))
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug lto/95194] bootstrap-lto fails on musl (bundled libintl uses asm aliases)
2020-05-18 22:37 [Bug lto/95194] New: bootstrap-lto fails on musl (bundled libintl uses asm aliases) slyfox at inbox dot ru
@ 2020-05-18 22:38 ` slyfox at inbox dot ru
2020-05-19 6:42 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: slyfox at inbox dot ru @ 2020-05-18 22:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95194
--- Comment #1 from Sergei Trofimovich <slyfox at inbox dot ru> ---
https://gcc.gnu.org/PR48200 touches on why asm aliases are problematic.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug lto/95194] bootstrap-lto fails on musl (bundled libintl uses asm aliases)
2020-05-18 22:37 [Bug lto/95194] New: bootstrap-lto fails on musl (bundled libintl uses asm aliases) slyfox at inbox dot ru
2020-05-18 22:38 ` [Bug lto/95194] " slyfox at inbox dot ru
@ 2020-05-19 6:42 ` rguenth at gcc dot gnu.org
2023-11-14 7:17 ` sjames at gcc dot gnu.org
2023-11-14 7:48 ` slyfox at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-19 6:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95194
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2020-05-19
Status|UNCONFIRMED |NEW
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug lto/95194] bootstrap-lto fails on musl (bundled libintl uses asm aliases)
2020-05-18 22:37 [Bug lto/95194] New: bootstrap-lto fails on musl (bundled libintl uses asm aliases) slyfox at inbox dot ru
2020-05-18 22:38 ` [Bug lto/95194] " slyfox at inbox dot ru
2020-05-19 6:42 ` rguenth at gcc dot gnu.org
@ 2023-11-14 7:17 ` sjames at gcc dot gnu.org
2023-11-14 7:48 ` slyfox at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-14 7:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95194
Sam James <sjames at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |arsen at gcc dot gnu.org
--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
I think this is fixed for 14 (although not tried a musl build) as the bundled
old intl/ is now gone as of r14-5423-gfbe4e64365ec7f.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug lto/95194] bootstrap-lto fails on musl (bundled libintl uses asm aliases)
2020-05-18 22:37 [Bug lto/95194] New: bootstrap-lto fails on musl (bundled libintl uses asm aliases) slyfox at inbox dot ru
` (2 preceding siblings ...)
2023-11-14 7:17 ` sjames at gcc dot gnu.org
@ 2023-11-14 7:48 ` slyfox at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-11-14 7:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95194
Sergei Trofimovich <slyfox at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |slyfox at gcc dot gnu.org
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Sounds good. Let's declared it FIXED for 14.0.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-11-14 7:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 22:37 [Bug lto/95194] New: bootstrap-lto fails on musl (bundled libintl uses asm aliases) slyfox at inbox dot ru
2020-05-18 22:38 ` [Bug lto/95194] " slyfox at inbox dot ru
2020-05-19 6:42 ` rguenth at gcc dot gnu.org
2023-11-14 7:17 ` sjames at gcc dot gnu.org
2023-11-14 7:48 ` slyfox at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).