[Mac] Use realpath for dlopen_preflight
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 May 2019 02:25:56 +0000 (02:25 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 May 2019 02:25:56 +0000 (02:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197803

Reviewed by Eric Carlson.

* wtf/cocoa/SoftLinking.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245269 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WTF/wtf/cocoa/SoftLinking.h

index 167c1a1..1331f23 100644 (file)
@@ -1,3 +1,12 @@
+2019-05-13  Youenn Fablet  <youenn@apple.com>
+
+        [Mac] Use realpath for dlopen_preflight
+        https://bugs.webkit.org/show_bug.cgi?id=197803
+
+        Reviewed by Eric Carlson.
+
+        * wtf/cocoa/SoftLinking.h:
+
 2019-05-13  Yusuke Suzuki  <ysuzuki@apple.com>
 
         Unreviewed, wrokaround for MACH_VM_MAX_ADDRESS in ARM32_64
index 7afb7ed..9973a4d 100644 (file)
 #define HAVE_ROUTE_SHARING_POLICY_LONG_FORM_VIDEO 1
 #endif
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED < 101500
+#define USE_REALPATH_FOR_DLOPEN_PREFLIGHT 1
+#endif
+
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 60000) || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 130000)
 #define HAVE_AVPLAYER_RESOURCE_CONSERVATION_LEVEL 1
 #endif
index 47fb78a..b890ede 100644 (file)
 
 #pragma once
 
-#import <wtf/Assertions.h>
 #import <dlfcn.h>
 #import <objc/runtime.h>
+#import <wtf/Assertions.h>
+#import <wtf/FileSystem.h>
 
 #pragma mark - Soft-link macros for use within a single source file
 
         return frameworkLibrary; \
     }
 
+#if USE(REALPATH_FOR_DLOPEN_PREFLIGHT)
+#define DLOPEN_PREFLIGHT(path) dlopen_preflight(FileSystem::realPath(path##_s).utf8().data())
+#else
+#define DLOPEN_PREFLIGHT(path) dlopen_preflight(path)
+#endif
+
 #define SOFT_LINK_FRAMEWORK_OPTIONAL_PREFLIGHT(framework) \
     static bool framework##LibraryIsAvailable() \
     { \
-        static bool frameworkLibraryIsAvailable = dlopen_preflight("/System/Library/Frameworks/" #framework ".framework/" #framework); \
+        static bool frameworkLibraryIsAvailable = DLOPEN_PREFLIGHT("/System/Library/Frameworks/" #framework ".framework/" #framework); \
         return frameworkLibraryIsAvailable; \
     }