https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102426
Bug ID: 102426
Summary: [12 regression] Fix for PR 49664 breaks Solaris
bootstrap with gld
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: ro at gcc dot gnu.org
CC: marxin at gcc dot gnu.org, pinskia at gcc dot gnu.org
Target Milestone: ---
Host: *-*-solaris2.11
By rev 48b3caffcacc99adf72ba1be189a7d9ebc4190be, master bootstrap is broken on
Solaris when configured to use GNU ld:
The failure occurs trying to link lto-plugin.so:
libtool: link:
/var/gcc/regression/master/11.4-gcc-gas-gld/build/./prev-gcc/xgcc
-B/var/gcc/regression/master/11.4-gcc-gas-gld/build/./prev-gcc/
-B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/bin/
-B/vol/gcc/i386-pc-solaris2.11/lib/ -isystem
/vol/gcc/i386-pc-solaris2.11/include -isystem
/vol/gcc/i386-pc-solaris2.11/sys-include -fno-checking -shared -Wl,-z
-Wl,text -Wl,-M -Wl,.libs/liblto_plugin.so.exp -Wl,-h -Wl,liblto_plugin.so -o
.libs/liblto_plugin.so .libs/lto-plugin.o -static-libgcc -static-libstdc++
-static-libgcc ../libiberty/pic/libiberty.a
/vol/gcc/bin/gld-2.37:.libs/liblto_plugin.so.exp: file format not recognized;
treating as linker script
/vol/gcc/bin/gld-2.37:.libs/liblto_plugin.so.exp:1: syntax error
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:466: liblto_plugin.la] Error 1
liblto_plugin.so.exp contains
{ global:
onload;
local: *; };
AFAICT, the issue is caused by libtool assuming that gcc on Solaris always
uses the native linker, which is wrong: I regularly test both ld and gld
configurations and this is also documented in install.texi.
The invocation above stems from libtool.m4 after l.5035:
solaris*)
_LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
if test "$GCC" = yes; then
wlarc='${wl}'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h
${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat
$export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >>
$lib.exp~
$CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h
${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
The question is how to deal with this: libtool is unmaintained for 2 1/2 years
now.