| 59 |
|
|
| 60 |
// This is for ABI compatibility with old versions of pcre (pre-7.6), |
// This is for ABI compatibility with old versions of pcre (pre-7.6), |
| 61 |
// which defined a global no_arg variable instead of putting it in the |
// which defined a global no_arg variable instead of putting it in the |
| 62 |
// RE class. This works on GCC >= 3, at least. We could probably |
// RE class. This works on GCC >= 3, at least. It definitely works |
| 63 |
// have a more inclusive test if we ever needed it. (Note that not |
// for ELF, but may not for other object formats (Mach-O, for |
| 64 |
// only the __attribute__ syntax, but also __USER_LABEL_PREFIX__, are |
// instance, does not support aliases.) We could probably have a more |
| 65 |
|
// inclusive test if we ever needed it. (Note that not only the |
| 66 |
|
// __attribute__ syntax, but also __USER_LABEL_PREFIX__, are |
| 67 |
// gnu-specific.) |
// gnu-specific.) |
| 68 |
#if defined(__GNUC__) && __GNUC__ >= 3 |
#if defined(__GNUC__) && __GNUC__ >= 3 && defined(__ELF__) |
| 69 |
# define AS_STRING(x) AS_STRING_INTERNAL(x) |
# define ULP_AS_STRING(x) ULP_AS_STRING_INTERNAL(x) |
| 70 |
# define AS_STRING_INTERNAL(x) #x |
# define ULP_AS_STRING_INTERNAL(x) #x |
| 71 |
# define USER_LABEL_PREFIX AS_STRING(__USER_LABEL_PREFIX__) |
# define USER_LABEL_PREFIX_STR ULP_AS_STRING(__USER_LABEL_PREFIX__) |
|
# if defined(__ELF__) |
|
| 72 |
extern Arg no_arg |
extern Arg no_arg |
| 73 |
__attribute__((alias(USER_LABEL_PREFIX "_ZN7pcrecpp2RE6no_argE"))); |
__attribute__((alias(USER_LABEL_PREFIX_STR "_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 |
|
| 74 |
#endif |
#endif |
| 75 |
|
|
| 76 |
// If a regular expression has no error, its error_ field points here |
// If a regular expression has no error, its error_ field points here |