Skip to content
Browse files

Add two functions recent clang uses

- It seems seekg is used only by nVidia's backend
- This arc4random might be not secure, but LLVM does use rand() as
  the fallback of arc4random so this might be OK for LLVM's purpose.
  • Loading branch information...
1 parent fca4318 commit 97cb8c244766d6b7012fc27b6ed809b4961993cc Shinichiro Hamaji committed
Showing with 14 additions and 0 deletions.
  1. +14 −0 libmac/mac.c
View
14 libmac/mac.c
@@ -1177,6 +1177,11 @@ void _ZNSt13basic_filebufIcSt11char_traitsIcEE7seekoffExSt12_Ios_SeekdirSt13_Ios
abort();
}
+void _ZNSi5seekgExSt12_Ios_Seekdir() {
+ fprintf(stderr, "_ZNSi5seekgExSt12_Ios_Seekdir called\n");
+ abort();
+}
+
void* (*ld_mac_dlopen)(const char* filename, int flag);
int (*ld_mac_dlclose)(void* handle);
char* (*ld_mac_dlerror)(void);
@@ -1241,6 +1246,15 @@ void __darwin_qsort_r(void* base, size_t nel, size_t width, void* thunk,
qsort_r(base, nel, width, &__darwin_qsort_r_helper, &ctx);
}
+unsigned int arc4random() {
+ static int initialized = 0;
+ if (!initialized) {
+ srand(time(NULL));
+ initialized = 1;
+ }
+ return rand();
+}
+
__attribute__((constructor)) void initMac() {
__darwin_stdin = __init_darwin_FILE(stdin);
__darwin_stdout = __init_darwin_FILE(stdout);

0 comments on commit 97cb8c2

Please sign in to comment.
Something went wrong with that request. Please try again.