[pcre-dev] [Bug 2769] New: r1315: apple_update_wx_flags() ca…

トップ ページ
このメッセージを削除
著者: admin
日付:  
To: pcre-dev
新しいトピック: [pcre-dev] [Bug 2769] r1315: apple_update_wx_flags() calls unavailable API when compiling to deploy on older macOS, [pcre-dev] [Bug 2769] r1315: apple_update_wx_flags() calls unavailable API when compiling to deploy on older macOS, [pcre-dev] [Bug 2769] r1315: apple_update_wx_flags() calls unavailable API when compiling to deploy on older macOS, [pcre-dev] [Bug 2769] r1315: apple_update_wx_flags() calls unavailable API when compiling to deploy on older macOS, [pcre-dev] [Bug 2769] r1315: apple_update_wx_flags() calls unavailable API when compiling to deploy on older macOS, [pcre-dev] [Bug 2769] r1315: apple_update_wx_flags() calls unavailable API when compiling to deploy on older macOS, [pcre-dev] [Bug 2769] r1315: apple_update_wx_flags() calls unavailable API when compiling to deploy on older macOS, [pcre-dev] [Bug 2769] r1315: apple_update_wx_flags() calls unavailable API when compiling to deploy on older macOS
題目: [pcre-dev] [Bug 2769] New: r1315: apple_update_wx_flags() calls unavailable API when compiling to deploy on older macOS
https://bugs.exim.org/show_bug.cgi?id=2769

            Bug ID: 2769
           Summary: r1315: apple_update_wx_flags() calls unavailable API
                    when compiling to deploy on older macOS
           Product: PCRE
           Version: 10.37 (PCRE2)
          Hardware: x86-64
                OS: All
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
          Assignee: Philip.Hazel@???
          Reporter: siegel@???
                CC: pcre-dev@???


I'm building r1315 as a "universal" library (x86_64 + arm64) for deployment on
macOS 10.14 and later.

During build, I get the following compiler warnings:

```
In file included from /Users/siegel/svn/pcre2/src/pcre2_jit_compile.c:79:
In file included from /Users/siegel/svn/pcre2/src/sljit/sljitLir.c:271:
/Users/siegel/svn/pcre2/src/sljit/sljitExecAllocator.c:152:2: warning:
'pthread_jit_write_protect_np' is only available on macOS 11.0 or newer
      [-Wunguarded-availability-new]
        pthread_jit_write_protect_np(enable_exec);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/pthread.h:561:6:
note: 
      'pthread_jit_write_protect_np' has been marked as being introduced in
macOS 11.0 here, but the deployment target is macOS 10.14.0
void pthread_jit_write_protect_np(int enabled);
     ^
/Users/siegel/svn/pcre2/src/sljit/sljitExecAllocator.c:152:2: note: enclose
'pthread_jit_write_protect_np' in a __builtin_available check to
      silence this warning
        pthread_jit_write_protect_np(enable_exec);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
```


I haven't tried yet, but I suspect that the JIT compiler will crash when run on
any version of macOS prior to 11.0.

The solution is as described in the warning; you can use a formulation like
this:

```
static SLJIT_INLINE void apple_update_wx_flags(sljit_s32 enable_exec)
{
    if (__builtin_available(macOS 11.0, *)) {
        pthread_jit_write_protect_np(enable_exec);
    }
}
```


--
You are receiving this mail because:
You are on the CC list for the bug.