diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2019-09-01 14:59:59 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2019-09-01 14:59:59 +0200 |
commit | 5eafc37e95736508f7e44705b7ca4a1876c09e2e (patch) | |
tree | 6d5f786af761618cb1338f6b71b1609b69e98d9b | |
parent | 5fc27aac6f47aaf06f454805f77c942c5a08393b (diff) | |
download | libgit2-cmn/pcre2.tar.gz |
regex: make sure to link against PCRE2's regex functionscmn/pcre2
PCRE2's header defines just the basic names but that means that we'll link
against libc's version while using PCRE2's struct definitions, leading to
crashes. To work around this, package maintainers have added prefixes to the
exported functions so we can link against them.
But the definitions in the header are still of the basic names so we need to
tell the compiler/linker to replace these names when linking.
-rw-r--r-- | src/posix_regex.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/posix_regex.h b/src/posix_regex.h index 421ffeba1..9b9ca94e8 100644 --- a/src/posix_regex.h +++ b/src/posix_regex.h @@ -37,8 +37,21 @@ #else +/* + * PCRE2's header defines just the basic names but that means that we'll link + * against libc's version while using PCRE2's struct definitions, leading to + * crashes. To work around this, package maintainers have added prefixes to the + * exported functions so we can link against them. + * + * But the definitions in the header are still of the basic names so we need to + * tell the compiler/linker to replace these names when linking. + */ # if defined(GIT_REGEX_PCRE2) # include <pcre2posix.h> +# pragma redefine_extname regerror PCRE2regerror +# pragma redefine_extname regexec PCRE2regexec +# pragma redefine_extname regfree PCRE2regfree +# pragma redefine_extname regcomp PCRE2regcomp # elif defined(GIT_REGEX_PCRE) # include <pcreposix.h> # else |