Revision: 328
http://vcs.pcre.org/viewvc?view=rev&revision=328
Author: ph10
Date: 2008-03-26 17:39:06 +0000 (Wed, 26 Mar 2008)
Log Message:
-----------
Patch to pcrecpp.cc to fix an OS X linking problem.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/pcrecpp.cc
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2008-03-08 19:38:30 UTC (rev 327)
+++ code/trunk/ChangeLog 2008-03-26 17:39:06 UTC (rev 328)
@@ -36,6 +36,9 @@
7. Added some missing "const"s to declarations of static tables in
pcre_compile.c and pcre_dfa_exec.c.
+
+8. Applied Craig's patch to pcrecpp.cc to fix a problem in OS X that was
+ caused by fix #2 above.
Version 7.6 28-Jan-08
Modified: code/trunk/pcrecpp.cc
===================================================================
--- code/trunk/pcrecpp.cc 2008-03-08 19:38:30 UTC (rev 327)
+++ code/trunk/pcrecpp.cc 2008-03-26 17:39:06 UTC (rev 328)
@@ -59,11 +59,23 @@
// This is for ABI compatibility with old versions of pcre (pre-7.6),
// which defined a global no_arg variable instead of putting it in the
-// RE class. This works on GCC >= 3, at least. We could probably have
-// a more inclusive test if we ever needed it.
+// RE class. This works on GCC >= 3, at least. We could probably
+// have a more inclusive test if we ever needed it. (Note that not
+// only the __attribute__ syntax, but also __USER_LABEL_PREFIX__, are
+// gnu-specific.)
#if defined(__GNUC__) && __GNUC__ >= 3
-extern Arg no_arg __attribute__((alias("_ZN7pcrecpp2RE6no_argE")));
+#if defined(__ELF__)
+extern Arg no_arg
+ __attribute__((alias(__USER_LABEL_PREFIX__ "_ZN7pcrecpp2RE6no_argE")));
+#else
+// While we know elf supports strong aliases, not all formats do (Mach
+// doesn't, for instance). So make aliases weak by default. This is
+// a smidge less safe in theory (conceivably, someone could override
+// this symbol in their own binary), but perfectly ok in practice.
+extern Arg no_arg
+ __attribute__((weak, alias(__USER_LABEL_PREFIX__ "_ZN7pcrecpp2RE6no_argE")));
#endif
+#endif
// If a regular expression has no error, its error_ field points here
static const string empty_string;