summaryrefslogtreecommitdiff
path: root/pcrecpp.cc
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2008-03-26 17:39:06 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2008-03-26 17:39:06 +0000
commit7b07ed7033aa78a3c1b292ca34e3d764f4554513 (patch)
tree5a6b9dba01ee1ed3004200c52615a2d2da6bb0c0 /pcrecpp.cc
parent7198804ea6cfc68b245026dcf43bbff197cf7956 (diff)
downloadpcre-7b07ed7033aa78a3c1b292ca34e3d764f4554513.tar.gz
Patch to pcrecpp.cc to fix an OS X linking problem.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@328 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcrecpp.cc')
-rw-r--r--pcrecpp.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/pcrecpp.cc b/pcrecpp.cc
index 52187a7..ad1720a 100644
--- a/pcrecpp.cc
+++ b/pcrecpp.cc
@@ -59,10 +59,22 @@ Arg RE::no_arg((void*)NULL);
// 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