003 File Manager
Current Path:
/usr/src/contrib/llvm-project/compiler-rt/lib/builtins
usr
/
src
/
contrib
/
llvm-project
/
compiler-rt
/
lib
/
builtins
/
📁
..
📄
README.txt
(14.85 KB)
📁
aarch64
📄
absvdi2.c
(815 B)
📄
absvsi2.c
(815 B)
📄
absvti2.c
(864 B)
📄
adddf3.c
(859 B)
📄
addsf3.c
(853 B)
📄
addtf3.c
(730 B)
📄
addvdi3.c
(819 B)
📄
addvsi3.c
(819 B)
📄
addvti3.c
(868 B)
📄
apple_versioning.c
(13.1 KB)
📁
arm
📄
ashldi3.c
(1.17 KB)
📄
ashlti3.c
(1.15 KB)
📄
ashrdi3.c
(1.27 KB)
📄
ashrti3.c
(1.25 KB)
📄
assembly.h
(7.11 KB)
📄
atomic.c
(16.86 KB)
📄
atomic_flag_clear.c
(791 B)
📄
atomic_flag_clear_explicit.c
(859 B)
📄
atomic_flag_test_and_set.c
(823 B)
📄
atomic_flag_test_and_set_explicit.c
(898 B)
📄
atomic_signal_fence.c
(761 B)
📄
atomic_thread_fence.c
(761 B)
📄
bswapdi2.c
(958 B)
📄
bswapsi2.c
(743 B)
📄
clear_cache.c
(6.13 KB)
📄
clzdi2.c
(1.27 KB)
📄
clzsi2.c
(1.48 KB)
📄
clzti2.c
(884 B)
📄
cmpdi2.c
(1.12 KB)
📄
cmpti2.c
(974 B)
📄
comparedf2.c
(4.29 KB)
📄
comparesf2.c
(4.28 KB)
📄
comparetf2.c
(3.79 KB)
📄
cpu_model.c
(21.28 KB)
📄
ctzdi2.c
(1.27 KB)
📄
ctzsi2.c
(1.61 KB)
📄
ctzti2.c
(884 B)
📄
divdc3.c
(2.18 KB)
📄
divdf3.c
(7.55 KB)
📄
divdi3.c
(1.13 KB)
📄
divmoddi4.c
(712 B)
📄
divmodsi4.c
(715 B)
📄
divsc3.c
(2.14 KB)
📄
divsf3.c
(6.96 KB)
📄
divsi3.c
(1.32 KB)
📄
divtc3.c
(2.23 KB)
📄
divtf3.c
(8.01 KB)
📄
divti3.c
(1.18 KB)
📄
divxc3.c
(2.17 KB)
📄
emutls.c
(12.39 KB)
📄
enable_execute_stack.c
(2.08 KB)
📄
eprintf.c
(953 B)
📄
extenddftf2.c
(623 B)
📄
extendhfsf2.c
(946 B)
📄
extendsfdf2.c
(716 B)
📄
extendsftf2.c
(622 B)
📄
ffsdi2.c
(900 B)
📄
ffssi2.c
(776 B)
📄
ffsti2.c
(969 B)
📄
fixdfdi.c
(1.22 KB)
📄
fixdfsi.c
(755 B)
📄
fixdfti.c
(633 B)
📄
fixsfdi.c
(1.22 KB)
📄
fixsfsi.c
(755 B)
📄
fixsfti.c
(633 B)
📄
fixtfdi.c
(624 B)
📄
fixtfsi.c
(624 B)
📄
fixtfti.c
(624 B)
📄
fixunsdfdi.c
(1.29 KB)
📄
fixunsdfsi.c
(743 B)
📄
fixunsdfti.c
(611 B)
📄
fixunssfdi.c
(1.3 KB)
📄
fixunssfsi.c
(896 B)
📄
fixunssfti.c
(731 B)
📄
fixunstfdi.c
(604 B)
📄
fixunstfsi.c
(604 B)
📄
fixunstfti.c
(604 B)
📄
fixunsxfdi.c
(1.65 KB)
📄
fixunsxfsi.c
(1.62 KB)
📄
fixunsxfti.c
(1.41 KB)
📄
fixxfdi.c
(1.75 KB)
📄
fixxfti.c
(1.48 KB)
📄
floatdidf.c
(3.37 KB)
📄
floatdisf.c
(2.49 KB)
📄
floatditf.c
(1.5 KB)
📄
floatdixf.c
(1.37 KB)
📄
floatsidf.c
(1.7 KB)
📄
floatsisf.c
(1.89 KB)
📄
floatsitf.c
(1.5 KB)
📄
floattidf.c
(2.49 KB)
📄
floattisf.c
(2.33 KB)
📄
floattitf.c
(2.72 KB)
📄
floattixf.c
(2.53 KB)
📄
floatundidf.c
(3.43 KB)
📄
floatundisf.c
(2.4 KB)
📄
floatunditf.c
(1.27 KB)
📄
floatundixf.c
(1.24 KB)
📄
floatunsidf.c
(1.43 KB)
📄
floatunsisf.c
(1.75 KB)
📄
floatunsitf.c
(1.29 KB)
📄
floatuntidf.c
(2.38 KB)
📄
floatuntisf.c
(2.24 KB)
📄
floatuntitf.c
(2.6 KB)
📄
floatuntixf.c
(2.39 KB)
📄
fp_add_impl.inc
(5.4 KB)
📄
fp_extend.h
(2.36 KB)
📄
fp_extend_impl.inc
(4.53 KB)
📄
fp_fixint_impl.inc
(1.52 KB)
📄
fp_fixuint_impl.inc
(1.42 KB)
📄
fp_lib.h
(10.12 KB)
📄
fp_mode.c
(812 B)
📄
fp_mode.h
(824 B)
📄
fp_mul_impl.inc
(4.37 KB)
📄
fp_trunc.h
(2.01 KB)
📄
fp_trunc_impl.inc
(5.57 KB)
📄
gcc_personality_v0.c
(8.3 KB)
📁
hexagon
📁
i386
📄
int_div_impl.inc
(2.19 KB)
📄
int_endianness.h
(2.75 KB)
📄
int_lib.h
(4.57 KB)
📄
int_math.h
(3.6 KB)
📄
int_types.h
(4.16 KB)
📄
int_util.c
(1.95 KB)
📄
int_util.h
(1.32 KB)
📄
lshrdi3.c
(1.18 KB)
📄
lshrti3.c
(1.17 KB)
📄
mingw_fixfloat.c
(1.29 KB)
📄
moddi3.c
(1004 B)
📄
modsi3.c
(649 B)
📄
modti3.c
(1.03 KB)
📄
muldc3.c
(2.14 KB)
📄
muldf3.c
(918 B)
📄
muldi3.c
(1.55 KB)
📄
mulodi4.c
(1.31 KB)
📄
mulosi4.c
(1.31 KB)
📄
muloti4.c
(1.36 KB)
📄
mulsc3.c
(2.11 KB)
📄
mulsf3.c
(918 B)
📄
multc3.c
(2.02 KB)
📄
multf3.c
(799 B)
📄
multi3.c
(1.53 KB)
📄
mulvdi3.c
(1.26 KB)
📄
mulvsi3.c
(1.26 KB)
📄
mulvti3.c
(1.31 KB)
📄
mulxc3.c
(2.22 KB)
📄
negdf2.c
(832 B)
📄
negdi2.c
(719 B)
📄
negsf2.c
(832 B)
📄
negti2.c
(768 B)
📄
negvdi2.c
(768 B)
📄
negvsi2.c
(768 B)
📄
negvti2.c
(817 B)
📄
os_version_check.c
(8.07 KB)
📄
paritydi2.c
(712 B)
📄
paritysi2.c
(751 B)
📄
parityti2.c
(761 B)
📄
popcountdi2.c
(1.33 KB)
📄
popcountsi2.c
(1.13 KB)
📄
popcountti2.c
(1.69 KB)
📄
powidf2.c
(786 B)
📄
powisf2.c
(783 B)
📄
powitf2.c
(888 B)
📄
powixf2.c
(825 B)
📁
ppc
📁
riscv
📁
sparc64
📄
subdf3.c
(917 B)
📄
subsf3.c
(917 B)
📄
subtf3.c
(825 B)
📄
subvdi3.c
(819 B)
📄
subvsi3.c
(819 B)
📄
subvti3.c
(868 B)
📄
trampoline_setup.c
(1.75 KB)
📄
truncdfhf2.c
(715 B)
📄
truncdfsf2.c
(711 B)
📄
truncsfhf2.c
(940 B)
📄
trunctfdf2.c
(625 B)
📄
trunctfsf2.c
(624 B)
📄
ucmpdi2.c
(1.13 KB)
📄
ucmpti2.c
(978 B)
📄
udivdi3.c
(724 B)
📄
udivmoddi4.c
(5.4 KB)
📄
udivmodsi4.c
(715 B)
📄
udivmodti4.c
(4.87 KB)
📄
udivsi3.c
(802 B)
📄
udivti3.c
(699 B)
📄
umoddi3.c
(724 B)
📄
umodsi3.c
(724 B)
📄
umodti3.c
(717 B)
📄
unwind-ehabi-helpers.h
(1.86 KB)
📁
ve
📁
x86_64
Editing: os_version_check.c
//===-- os_version_check.c - OS version checking -------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements the function __isOSVersionAtLeast, used by // Objective-C's @available // //===----------------------------------------------------------------------===// #ifdef __APPLE__ #include <TargetConditionals.h> #include <dispatch/dispatch.h> #include <dlfcn.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> // These three variables hold the host's OS version. static int32_t GlobalMajor, GlobalMinor, GlobalSubminor; static dispatch_once_t DispatchOnceCounter; // We can't include <CoreFoundation/CoreFoundation.h> directly from here, so // just forward declare everything that we need from it. typedef const void *CFDataRef, *CFAllocatorRef, *CFPropertyListRef, *CFStringRef, *CFDictionaryRef, *CFTypeRef, *CFErrorRef; #if __LLP64__ typedef unsigned long long CFTypeID; typedef unsigned long long CFOptionFlags; typedef signed long long CFIndex; #else typedef unsigned long CFTypeID; typedef unsigned long CFOptionFlags; typedef signed long CFIndex; #endif typedef unsigned char UInt8; typedef _Bool Boolean; typedef CFIndex CFPropertyListFormat; typedef uint32_t CFStringEncoding; // kCFStringEncodingASCII analog. #define CF_STRING_ENCODING_ASCII 0x0600 // kCFStringEncodingUTF8 analog. #define CF_STRING_ENCODING_UTF8 0x08000100 #define CF_PROPERTY_LIST_IMMUTABLE 0 typedef CFDataRef (*CFDataCreateWithBytesNoCopyFuncTy)(CFAllocatorRef, const UInt8 *, CFIndex, CFAllocatorRef); typedef CFPropertyListRef (*CFPropertyListCreateWithDataFuncTy)( CFAllocatorRef, CFDataRef, CFOptionFlags, CFPropertyListFormat *, CFErrorRef *); typedef CFPropertyListRef (*CFPropertyListCreateFromXMLDataFuncTy)( CFAllocatorRef, CFDataRef, CFOptionFlags, CFStringRef *); typedef CFStringRef (*CFStringCreateWithCStringNoCopyFuncTy)(CFAllocatorRef, const char *, CFStringEncoding, CFAllocatorRef); typedef const void *(*CFDictionaryGetValueFuncTy)(CFDictionaryRef, const void *); typedef CFTypeID (*CFGetTypeIDFuncTy)(CFTypeRef); typedef CFTypeID (*CFStringGetTypeIDFuncTy)(void); typedef Boolean (*CFStringGetCStringFuncTy)(CFStringRef, char *, CFIndex, CFStringEncoding); typedef void (*CFReleaseFuncTy)(CFTypeRef); // Find and parse the SystemVersion.plist file. static void parseSystemVersionPList(void *Unused) { (void)Unused; // Load CoreFoundation dynamically const void *NullAllocator = dlsym(RTLD_DEFAULT, "kCFAllocatorNull"); if (!NullAllocator) return; const CFAllocatorRef AllocatorNull = *(const CFAllocatorRef *)NullAllocator; CFDataCreateWithBytesNoCopyFuncTy CFDataCreateWithBytesNoCopyFunc = (CFDataCreateWithBytesNoCopyFuncTy)dlsym(RTLD_DEFAULT, "CFDataCreateWithBytesNoCopy"); if (!CFDataCreateWithBytesNoCopyFunc) return; CFPropertyListCreateWithDataFuncTy CFPropertyListCreateWithDataFunc = (CFPropertyListCreateWithDataFuncTy)dlsym(RTLD_DEFAULT, "CFPropertyListCreateWithData"); // CFPropertyListCreateWithData was introduced only in macOS 10.6+, so it // will be NULL on earlier OS versions. #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" CFPropertyListCreateFromXMLDataFuncTy CFPropertyListCreateFromXMLDataFunc = (CFPropertyListCreateFromXMLDataFuncTy)dlsym( RTLD_DEFAULT, "CFPropertyListCreateFromXMLData"); #pragma clang diagnostic pop // CFPropertyListCreateFromXMLDataFunc is deprecated in macOS 10.10, so it // might be NULL in future OS versions. if (!CFPropertyListCreateWithDataFunc && !CFPropertyListCreateFromXMLDataFunc) return; CFStringCreateWithCStringNoCopyFuncTy CFStringCreateWithCStringNoCopyFunc = (CFStringCreateWithCStringNoCopyFuncTy)dlsym( RTLD_DEFAULT, "CFStringCreateWithCStringNoCopy"); if (!CFStringCreateWithCStringNoCopyFunc) return; CFDictionaryGetValueFuncTy CFDictionaryGetValueFunc = (CFDictionaryGetValueFuncTy)dlsym(RTLD_DEFAULT, "CFDictionaryGetValue"); if (!CFDictionaryGetValueFunc) return; CFGetTypeIDFuncTy CFGetTypeIDFunc = (CFGetTypeIDFuncTy)dlsym(RTLD_DEFAULT, "CFGetTypeID"); if (!CFGetTypeIDFunc) return; CFStringGetTypeIDFuncTy CFStringGetTypeIDFunc = (CFStringGetTypeIDFuncTy)dlsym(RTLD_DEFAULT, "CFStringGetTypeID"); if (!CFStringGetTypeIDFunc) return; CFStringGetCStringFuncTy CFStringGetCStringFunc = (CFStringGetCStringFuncTy)dlsym(RTLD_DEFAULT, "CFStringGetCString"); if (!CFStringGetCStringFunc) return; CFReleaseFuncTy CFReleaseFunc = (CFReleaseFuncTy)dlsym(RTLD_DEFAULT, "CFRelease"); if (!CFReleaseFunc) return; char *PListPath = "/System/Library/CoreServices/SystemVersion.plist"; #if TARGET_OS_SIMULATOR char *PListPathPrefix = getenv("IPHONE_SIMULATOR_ROOT"); if (!PListPathPrefix) return; char FullPath[strlen(PListPathPrefix) + strlen(PListPath) + 1]; strcpy(FullPath, PListPathPrefix); strcat(FullPath, PListPath); PListPath = FullPath; #endif FILE *PropertyList = fopen(PListPath, "r"); if (!PropertyList) return; // Dynamically allocated stuff. CFDictionaryRef PListRef = NULL; CFDataRef FileContentsRef = NULL; UInt8 *PListBuf = NULL; fseek(PropertyList, 0, SEEK_END); long PListFileSize = ftell(PropertyList); if (PListFileSize < 0) goto Fail; rewind(PropertyList); PListBuf = malloc((size_t)PListFileSize); if (!PListBuf) goto Fail; size_t NumRead = fread(PListBuf, 1, (size_t)PListFileSize, PropertyList); if (NumRead != (size_t)PListFileSize) goto Fail; // Get the file buffer into CF's format. We pass in a null allocator here * // because we free PListBuf ourselves FileContentsRef = (*CFDataCreateWithBytesNoCopyFunc)( NULL, PListBuf, (CFIndex)NumRead, AllocatorNull); if (!FileContentsRef) goto Fail; if (CFPropertyListCreateWithDataFunc) PListRef = (*CFPropertyListCreateWithDataFunc)( NULL, FileContentsRef, CF_PROPERTY_LIST_IMMUTABLE, NULL, NULL); else PListRef = (*CFPropertyListCreateFromXMLDataFunc)( NULL, FileContentsRef, CF_PROPERTY_LIST_IMMUTABLE, NULL); if (!PListRef) goto Fail; CFStringRef ProductVersion = (*CFStringCreateWithCStringNoCopyFunc)( NULL, "ProductVersion", CF_STRING_ENCODING_ASCII, AllocatorNull); if (!ProductVersion) goto Fail; CFTypeRef OpaqueValue = (*CFDictionaryGetValueFunc)(PListRef, ProductVersion); (*CFReleaseFunc)(ProductVersion); if (!OpaqueValue || (*CFGetTypeIDFunc)(OpaqueValue) != (*CFStringGetTypeIDFunc)()) goto Fail; char VersionStr[32]; if (!(*CFStringGetCStringFunc)((CFStringRef)OpaqueValue, VersionStr, sizeof(VersionStr), CF_STRING_ENCODING_UTF8)) goto Fail; sscanf(VersionStr, "%d.%d.%d", &GlobalMajor, &GlobalMinor, &GlobalSubminor); Fail: if (PListRef) (*CFReleaseFunc)(PListRef); if (FileContentsRef) (*CFReleaseFunc)(FileContentsRef); free(PListBuf); fclose(PropertyList); } int32_t __isOSVersionAtLeast(int32_t Major, int32_t Minor, int32_t Subminor) { // Populate the global version variables, if they haven't already. dispatch_once_f(&DispatchOnceCounter, NULL, parseSystemVersionPList); if (Major < GlobalMajor) return 1; if (Major > GlobalMajor) return 0; if (Minor < GlobalMinor) return 1; if (Minor > GlobalMinor) return 0; return Subminor <= GlobalSubminor; } #else // Silence an empty translation unit warning. typedef int unused; #endif
Upload File
Create Folder