This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
eprintf, darwin, etc.
- From: gkeating at apple dot com (Geoffrey Keating)
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Mon, 14 Nov 2005 22:06:08 -0800 (PST)
- Subject: eprintf, darwin, etc.
You might, very vaguely, remember
<http://gcc.gnu.org/ml/libstdc++/2005-08/msg00012.html>
in which I proposed this patch. At the time I said I didn't think it
was very good but couldn't think of a better design. I still can't.
I'll give it one more day and then commit this.
Bootstrapped & tested on powerpc-darwin8.
--
- Geoffrey Keating <geoffk@apple.com>
===File ~/patches/libstdc++-darwin-eprintf-2.patch==========
Index: ChangeLog
2005-11-14 Geoffrey Keating <geoffk@apple.com>
* config/os/bsd/darwin/eprintf.ver: New.
* src/Makefile.am (libstdc++-symbol.ver): Move outside conditionals,
and make dependent on port symbol files.
(libstdc++-symbol.explist): Use the generated .ver file, not
the template.
* src/compatibility.cc [APPLE] (__eprintf): New.
* src/Makefile.in: Regenerate.
Index: src/compatibility.cc
===================================================================
--- src/compatibility.cc (revision 106937)
+++ src/compatibility.cc (working copy)
@@ -361,3 +361,28 @@
#undef _GLIBCXX_APPLY_SYMVER
#endif
+
+#ifdef __APPLE__
+#if (defined(__ppc__) || defined (__ppc64__)) && defined (PIC)
+/* __eprintf shouldn't have been made visible from libstdc++, or
+ anywhere, but on Mac OS X 10.4 it was defined in
+ libstdc++.6.0.3.dylib; so on that platform we have to keep defining
+ it to keep binary compatibility. We can't just put the libgcc
+ version in the export list, because that doesn't work; once a
+ symbol is marked as hidden, it stays that way. */
+
+#include <cstdio>
+#include <cstdlib>
+
+using namespace std;
+
+extern "C" void
+__eprintf (const char *string, const char *expression,
+ unsigned int line, const char *filename)
+{
+ fprintf (stderr, string, expression, line, filename);
+ fflush (stderr);
+ abort ();
+}
+#endif
+#endif /* __APPLE__ */
Index: src/Makefile.am
===================================================================
--- src/Makefile.am (revision 106937)
+++ src/Makefile.am (working copy)
@@ -28,10 +28,11 @@
toolexeclib_LTLIBRARIES = libstdc++.la
# Symbol versioning for shared libraries.
-if ENABLE_SYMVERS_GNU
-version_arg = -Wl,--version-script=libstdc++-symbol.ver
-version_dep = libstdc++-symbol.ver
-libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP)
+# This could be conditional on
+# ENABLE_SYMVERS_GNU || ENABLE_SYMVERS_DARWIN_EXPORT
+# but automake doesn't support OR operations in conditionals.
+libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) \
+ $(port_specific_symbol_files)
cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
if test "x$(port_specific_symbol_files)" != x; then \
sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
@@ -39,15 +40,19 @@
cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
rm tmp.top tmp.bottom; \
fi
+
+if ENABLE_SYMVERS_GNU
+version_arg = -Wl,--version-script=libstdc++-symbol.ver
+version_dep = libstdc++-symbol.ver
else
if ENABLE_SYMVERS_DARWIN_EXPORT
version_arg = -Wl,-exported_symbols_list,libstdc++-symbol.explist
version_dep = libstdc++-symbol.explist
-libstdc++-symbol.explist : ${glibcxx_srcdir}/$(SYMVER_MAP) \
+libstdc++-symbol.explist : libstdc++-symbol.ver \
${glibcxx_srcdir}/scripts/make_exports.pl \
$(libstdc___la_OBJECTS) $(libstdc___la_LIBADD)
perl ${glibcxx_srcdir}/scripts/make_exports.pl \
- ${glibcxx_srcdir}/$(SYMVER_MAP) \
+ libstdc++-symbol.ver \
$(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
`echo $(libstdc___la_LIBADD) | \
sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
@@ -169,7 +174,6 @@
libstdc___la_LDFLAGS = \
-version-info $(libtool_VERSION) ${version_arg} -lm
-
# Use special rules for the deprecated source files so that they find
# deprecated include files.
GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include
Index: config/os/bsd/darwin/eprintf.ver
===================================================================
--- config/os/bsd/darwin/eprintf.ver (revision 0)
+++ config/os/bsd/darwin/eprintf.ver (revision 0)
@@ -0,0 +1 @@
+ __eprintf;
============================================================