[build, v3] Enable COMDAT group support on Solaris 10
Rainer Orth
ro@CeBiTec.Uni-Bielefeld.DE
Mon Jan 29 14:26:00 GMT 2018
While investigating PR bootstrap/84017, it turned out that it *is*
possible to enable COMDAT group support on Solaris 10 with Solaris ld in
some circumstances. I'm posting my findings and the resulting patch
here for reference only; this is certainly not GCC 8 material.
Besides, there's a abi_check failure in libstdc++ which makes it unclear
if this desirable at all.
So here's the deal: I remembered that Solaris ld has a -z relaxreloc
option, documented as
-z relaxreloc
ld normally issues a fatal error upon encountering a
relocation using a symbol that references an eliminated
COMDAT section. If -z relaxreloc is enabled, ld instead
redirects such relocations to the equivalent symbol in
the COMDAT section that was kept. -z relaxreloc is a
specialized option, mainly of interest to compiler
authors, and is not intended for general use.
It was only introduced in Solaris 10 Update 10, so won't help on earlier
versions.
When ld supports that option, I always pass it when linking and enable
comdat_group (and hidden_linkonce) in configure.ac.
Test results are astonishingly good:
* On Solaris 10/x86, I get three tests where ld SEGVs with -flto
(skipped/xfailed in the present patch).
* On both Solaris 10/SPARC and x86, libstdc++-abi/abi_check FAILs:
# of added symbols: 2
# of missing symbols: 0
# of undesignated symbols: 0
# of incompatible symbols: 2
2 added symbols
0
_ZNSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEED2Ev
std::__cxx11::basic_stringbuf<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::~basic_stringbuf()
version status: incompatible
GLIBCXX_3.4.21
type: function
status: added
1
_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED2Ev
std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::~basic_stringbuf()
version status: incompatible
GLIBCXX_3.4.21
type: function
status: added
2 incompatible symbols
0
_ZNSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEED2Ev
std::__cxx11::basic_stringbuf<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::~basic_stringbuf()
version status: incompatible
GLIBCXX_3.4.21
type: function
status: added
1
_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED2Ev
std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::~basic_stringbuf()
version status: incompatible
GLIBCXX_3.4.21
type: function
status: added
Those symbols are present in the Solaris 11 baselines (where COMDAT
group always works), which is also used with Solaris 10 and GNU ld.
I'm not yet sure how to deal with this: we'd have to introduce 3
baselines:
* Solaris 10 without COMDAT group support
* Solaris 10 with COMDAT group support
* Solaris 11
Seems like a lot of trouble to me actually. I've not done anything
about this yet, so as is the patch shows the abi_check failures.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2018-01-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gcc/testsuite:
* g++.dg/lto/pr65475c_0.C: Skip on Solaris 10/x86 with ld/comdat.
* g++.dg/lto/pr68057_0.C: Likewise.
* gcc.dg/debug/pr41893-1.c: Xfail on Solaris 10/x86 with ld/comdat
for -gdwarf-2 -g3.
gcc:
* configure.ac (gcc_cv_ld_relaxreloc): New test.
(comdat_group): Enable on Solaris 10 if ld -z relaxreloc is present.
(hidden_linkonce): Enable on Solaris 10 if COMDAT group support is
present.
* configure: Regenerate.
* config.in: Regenerate.
* config/sol2.h (LINK_RELAXRELOC_SPEC): Define.
(LINK_SPEC): Use it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol10-comdat.patch
Type: text/x-patch
Size: 4940 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180129/72bfe798/attachment.bin>
More information about the Libstdc++
mailing list