On 30/05/17 15:10 +0200, Rainer Orth wrote:
I recently tried a cross-build from sparc-sun-solaris2.12 to i386-pc-solaris2.12 (with cross-binutils and gas, but the native ld which has been a cross-linker for quite some time). The build failed in libstdc++-v3 like this:/vol/gcc/src/hg/trunk/local/libstdc++-v3/libsupc++/new_opa.cc:62:46: error: ‘void* aligned_alloc(std::size_t, std::size_t)’ conflicts with a previous declaration aligned_alloc (std::size_t al, std::size_t sz) ^ In file included from /var/gcc/sysroot/i386/usr/include/stdlib.h:13:0, from /var/gcc/cross/i386-pc-solaris2.12/obj/gcc-8.0.0-20170516/12-gcc-gas/i386-pc-solaris2.12/libstdc++-v3/include/cstdlib:75, from /var/gcc/cross/i386-pc-solaris2.12/obj/gcc-8.0.0-20170516/12-gcc-gas/i386-pc-solaris2.12/libstdc++-v3/include/stdlib.h:36, from /vol/gcc/src/hg/trunk/local/libstdc++-v3/libsupc++/new_opa.cc:27: /var/gcc/sysroot/i386/usr/include/iso/stdlib_c99.h:79:14: note: previous declaration ‘void* std::aligned_alloc(std::size_t, std::size_t)’ extern void *aligned_alloc(size_t, size_t); ^~~~~~~~~~~~~ /vol/gcc/src/hg/trunk/local/libstdc++-v3/libsupc++/new_opa.cc: In function ‘void* operator new(std::size_t, std::align_val_t)’: /vol/gcc/src/hg/trunk/local/libstdc++-v3/libsupc++/new_opa.cc:103:57: error: call of overloaded ‘aligned_alloc(std::size_t&, std::size_t&)’ is ambiguous while (__builtin_expect ((p = aligned_alloc (align, sz)) == 0, false)) ^ In file included from /var/gcc/sysroot/i386/usr/include/stdlib.h:13:0, from /var/gcc/cross/i386-pc-solaris2.12/obj/gcc-8.0.0-20170516/12-gcc-gas/i386-pc-solaris2.12/libstdc++-v3/include/cstdlib:75, from /var/gcc/cross/i386-pc-solaris2.12/obj/gcc-8.0.0-20170516/12-gcc-gas/i386-pc-solaris2.12/libstdc++-v3/include/stdlib.h:36, from /vol/gcc/src/hg/trunk/local/libstdc++-v3/libsupc++/new_opa.cc:27: /var/gcc/sysroot/i386/usr/include/iso/stdlib_c99.h:79:14: note: candidate: ‘void* std::aligned_alloc(std::size_t, std::size_t)’ extern void *aligned_alloc(size_t, size_t); ^~~~~~~~~~~~~ /vol/gcc/src/hg/trunk/local/libstdc++-v3/libsupc++/new_opa.cc:62:1: note: candidate: ‘void* aligned_alloc(std::size_t, std::size_t)’ aligned_alloc (std::size_t al, std::size_t sz) ^~~~~~~~~~~~~ make[4]: *** [Makefile:936: new_opa.lo] Error 1 It turns out that currently crossconfig.m4 has a static list of AC_DEFINEs for *-solaris*, which is obviously incomplete compared to the target's features. Instead of manually fixing this, it seems the way to go is follow the lead of the Linux etc. targets and just perform the link tests which are skipped in configure.ac for the !GLIBCXX_IS_NATIVE case since they *do* work reliably in this case. This is just what this patch does: treat Solaris like the Linux targets and remove the hardcoded feature list from crossconfig.m4. This way, config.h is identical between a native build and the cross above, with the exception of HAVE_SETENV which is equally guarded with GLIBCXX_IS_NATIVE in acinclude.m4 (GLIBCXX_CONFIGURE_TESTSUITE). Maybe it's time to somehow refine the GLIBCXX_IS_NATIVE check to allow cross configurations that *can* perform link tests to run them?
Sounds like a good idea, although I don't know how to do that.
With the patch, the cross-build succeeded without issues. Ok for mainline?
OK, thanks.
