This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Don't rename char_traits::eq in libstdc++.a or user code (was Re: [v3] symbol versioning fixups)


On Thu, Jun 16, 2005 at 04:31:49AM -0400, Jakub Jelinek wrote:
> 2) _GLIBCXX_SYMVER is I guess going to be defined in
>    <c++config.h>, do you really mean to rename char_traits::eq
>    even for user code?  Do you mean to rename it for libstdc++.a
>    as well?  I'd say either you want to rename it only in
>    compatibility.cc when defined _GLIBCXX_SYMVER && defined PIC,
>    then define a macro in compatibility.cc in that case before
>    including the headers, say _GLIBCXX_SYMVER_COMPATIBILITY,
>    and use it in bits/char_traits.h, or you want to rename
>    it for the whole libstdc++.so (but not libstdc++.a), then
>    libstdc++-v3 configury should set some new define
>    in libstdc++-v3's src/ CFLAGS, say _GLIBCXX_IN_LIBSTDCXX
>    or something like that, and guard the renaming in
>    bits/char_traits.h with
> #if defined _GLIBCXX_IN_LIBSTDCXX && defined _GLIBCXX_SYMVER && defined PIC

This works for me just fine.
I have verified it can be linked back to ld
GNU ld version 2.15.90.0.1.1 20040326
but
GNU ld version 2.14.90.0.8 20040114
fails on it, so the 21590 ld requirement is in order.

2005-06-16  Jakub Jelinek  <jakub@redhat.com>

	* src/compatibility.cc: Include bits/c++config.h first.
	(_GLIBCXX_SYMVER_COMPATIBILITY): Define if _GLIBCXX_SYMVER
	and PIC are both defined.
	* include/bits/char_traits.h (char_traits::eq): Rename
	only if _GLIBCXX_SYMVER_COMPATIBILITY is defined.

--- libstdc++-v3/src/compatibility.cc	2005-06-16 06:33:41.121672000 -0400
+++ libstdc++-v3/src/compatibility.cc	2005-06-16 09:09:29.181644344 -0400
@@ -28,6 +28,12 @@
 // invalidate any other reasons why the executable file might be covered by
 // the GNU General Public License.
 
+#include <bits/c++config.h>
+
+#if defined(_GLIBCXX_SYMVER) && defined(PIC)
+# define _GLIBCXX_SYMVER_COMPATIBILITY 1
+#endif
+
 #include <string>
 #include <istream>
 #include <fstream>
--- libstdc++-v3/include/bits/char_traits.h	2005-06-16 06:18:51.286925000 -0400
+++ libstdc++-v3/include/bits/char_traits.h	2005-06-16 09:01:25.203986624 -0400
@@ -242,7 +242,7 @@ namespace std
 
       static bool
       eq(const char_type& __c1, const char_type& __c2)
-#ifdef _GLIBCXX_SYMVER
+#ifdef _GLIBCXX_SYMVER_COMPATIBILITY
       asm ("_W_ZNSt11char_traitsIcE2eqERKcS2_");
 #endif
       ;
@@ -318,7 +318,7 @@ namespace std
 
       static bool
       eq(const char_type& __c1, const char_type& __c2) 
-#ifdef _GLIBCXX_SYMVER
+#ifdef _GLIBCXX_SYMVER_COMPATIBILITY
       asm ("_W_ZNSt11char_traitsIwE2eqERKwS2_")
 #endif
       ;


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]