Date: Mon, 22 Oct 2012 13:29:45 +0200 From: Dimitry Andric <dim@FreeBSD.org> To: Garrett Cooper <yanegomi@gmail.com> Cc: Marcel Moolenaar <marcel@freebsd.org>, Howard Hinnant <hhinnant@apple.com>, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org, Jan Beich <jbeich@tormail.org> Subject: Re: svn commit: r241823 - in head: . etc etc/atf etc/mtree lib lib/atf lib/atf/libatf-c lib/atf/libatf-c++ libexec libexec/atf libexec/atf/atf-check share share/atf share/doc share/doc/atf share/exampl... Message-ID: <50852E29.1050905@FreeBSD.org> In-Reply-To: <CAGH67wTgsk6UJBvSNtR6Vux=Aa-QcsB-3vqZLjGvX-LKbHxZ4w@mail.gmail.com> References: <201210220118.q9M1Ifh5098857__14926.3614825488$1350868751$gmane$org@svn.freebsd.org> <1TQC0L-000AZG-Q5@internal.tormail.org> <CAGH67wTgsk6UJBvSNtR6Vux=Aa-QcsB-3vqZLjGvX-LKbHxZ4w@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2012-10-22 09:24, Garrett Cooper wrote: > On Mon, Oct 22, 2012 at 12:00 AM, Jan Beich <jbeich@tormail.org> wrote: ... >> atf-run fails to link when using -stdlib=libc++. It works if I remove >> `throw' from check_stream(). Any clue? >> >> test-program.o: In function `(anonymous namespace)::check_stream(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)': >> /usr/src/usr.bin/atf/atf-run/../../../contrib/atf/atf-run/test-program.cpp:76: undefined reference to `std::__1::basic_ios<char, std::__1::char_traits<char> >::clear(unsigned int)' >> clang++: error: linker command failed with exit code 1 (use -v to see invocation) > > Is it a bug in libc++ where it's doing the wrong thing inlining some > values for basic_ios (my guess is based on the snippet example at: > http://www.cplusplus.com/reference/iostream/ios/clear/ ): > > $ p4 diff -du ios > --- //depot/user/gcooper/atf-head/src/contrib/libc++/include/ios > 2012-05-20 04:37:04.000000000 0000 > +++ /scratch/p4/user/gcooper/atf-head/src/contrib/libc++/include/ios > 2012-05-20 04:37:04.000000000 0000 > @@ -575,10 +575,10 @@ > _LIBCPP_ALWAYS_INLINE > _LIBCPP_EXPLICIT > operator bool() const {return !fail();} > - _LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();} > - _LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();} > - _LIBCPP_ALWAYS_INLINE void clear(iostate __state = goodbit) {ios_base::clear(__state);} > - _LIBCPP_ALWAYS_INLINE void setstate(iostate __state) {ios_base::setstate(__state);} > + _LIBCPP_INLINE_VISIBILITY bool operator!() const {return fail();} > + _LIBCPP_INLINE_VISIBILITY iostate rdstate() const {return ios_base::rdstate();} > + void clear(iostate __state = goodbit) {ios_base::clear(__state);} > + _LIBCPP_INLINE_VISIBILITY void setstate(iostate __state) {ios_base::setstate(__state);} > _LIBCPP_ALWAYS_INLINE bool good() const {return ios_base::good();} > _LIBCPP_ALWAYS_INLINE bool eof() const {return ios_base::eof();} > _LIBCPP_ALWAYS_INLINE bool fail() const {return ios_base::fail();} > > I'm building clang and libc++ in my VM to confirm. I don't think so, as these member functions are supposed to be always inlined. E.g. basic_ios::clear() should always be expanded inline to ios_base::clear(), which is a normal (out of line) function. However, the visibility stuff is always terribly confusing, so you might have a found a real issue. Note that in libc++ trunk, the attributes of these member functions have not changed. In any case, I cannot reproduce the link error on my system. -Dimitry
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50852E29.1050905>