aboutsummaryrefslogtreecommitdiffstats
path: root/testing/llvm/llvm-3.6-musl.patch
blob: ba3c49f785d84387d8c2d1e2be34cd8bb220a0a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
diff --git a/include/llvm/Target/TargetLibraryInfo.h b/include/llvm/Target/TargetLibraryInfo.h
index 46f87b9..41ac5fd 100644
--- a/include/llvm/Target/TargetLibraryInfo.h
+++ b/include/llvm/Target/TargetLibraryInfo.h
@@ -10,12 +10,21 @@
 #ifndef LLVM_TARGET_TARGETLIBRARYINFO_H
 #define LLVM_TARGET_TARGETLIBRARYINFO_H

 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Pass.h"

+#undef fopen64
+#undef fseeko64
+#undef fstat64
+#undef fstatvfs64
+#undef ftello64
+#undef lstat64
+#undef stat64
+#undef tmpfile64
+
 namespace llvm {
   class Triple;

   namespace LibFunc {
     enum Func {
       /// int _IO_getc(_IO_FILE * __fp);
diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp
index d2b551e..4634a13 100644
--- a/lib/Support/DynamicLibrary.cpp
+++ b/lib/Support/DynamicLibrary.cpp
@@ -135,13 +135,13 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) {

   if (void *Result = llvm::SearchForAddressOfSpecialSymbol(symbolName))
     return Result;

 // This macro returns the address of a well-known, explicit symbol
 #define EXPLICIT_SYMBOL(SYM) \
-   if (!strcmp(symbolName, #SYM)) return &SYM
+   if (!strcmp(symbolName, #SYM)) return (void *) &SYM

 // On linux we have a weird situation. The stderr/out/in symbols are both
 // macros and global variables because of standards requirements. So, we
 // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first.
 #if defined(__linux__) and !defined(__ANDROID__)
   {
diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc
index e8f4643..8a320ef 100644
--- a/lib/Support/Unix/Signals.inc
+++ b/lib/Support/Unix/Signals.inc
@@ -413,13 +413,13 @@ static bool printSymbolizedStackTrace(void **StackTrace, int Depth, FILE *FD) {
 // PrintStackTrace - In the case of a program crash or fault, print out a stack
 // trace so that the user has an indication of why and where we died.
 //
 // On glibc systems we have the 'backtrace' function, which works nicely, but
 // doesn't demangle symbols.
 void llvm::sys::PrintStackTrace(FILE *FD) {
-#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
+#if defined(__GLIBC__) && defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
   static void* StackTrace[256];
   // Use backtrace() to output a backtrace on Linux systems with glibc.
   int depth = backtrace(StackTrace,
                         static_cast<int>(array_lengthof(StackTrace)));
   if (printSymbolizedStackTrace(StackTrace, depth, FD))
     return;
diff --git a/lib/Target/TargetLibraryInfo.cpp b/lib/Target/TargetLibraryInfo.cpp
index c0abdbd..ed908f8 100644
--- a/lib/Target/TargetLibraryInfo.cpp
+++ b/lib/Target/TargetLibraryInfo.cpp
@@ -661,20 +661,21 @@ static void initialize(TargetLibraryInfo &TLI, const Triple &T,
     break;
   default:
     TLI.setUnavailable(LibFunc::ffsll);
   }

   // The following functions are available on at least Linux:
-  if (!T.isOSLinux()) {
+  if (!T.isOSLinux())
+    TLI.setUnavailable(LibFunc::memalign);
+  if (1 /*!T.isGlibc()*/) {
     TLI.setUnavailable(LibFunc::dunder_strdup);
     TLI.setUnavailable(LibFunc::dunder_strtok_r);
     TLI.setUnavailable(LibFunc::dunder_isoc99_scanf);
     TLI.setUnavailable(LibFunc::dunder_isoc99_sscanf);
     TLI.setUnavailable(LibFunc::under_IO_getc);
     TLI.setUnavailable(LibFunc::under_IO_putc);
-    TLI.setUnavailable(LibFunc::memalign);
     TLI.setUnavailable(LibFunc::fopen64);
     TLI.setUnavailable(LibFunc::fseeko64);
     TLI.setUnavailable(LibFunc::fstat64);
     TLI.setUnavailable(LibFunc::fstatvfs64);
     TLI.setUnavailable(LibFunc::ftello64);
     TLI.setUnavailable(LibFunc::lstat64);
diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
index bf850c6..9e9088c 100644
--- a/utils/unittest/googletest/src/gtest.cc
+++ b/utils/unittest/googletest/src/gtest.cc
@@ -117,12 +117,13 @@
 #if GTEST_HAS_EXCEPTIONS
 # include <stdexcept>
 #endif

 #if GTEST_CAN_STREAM_RESULTS_
 # include <arpa/inet.h>  // NOLINT
+# include <sys/socket.h>  // NOLINT
 # include <netdb.h>  // NOLINT
 #endif

 // Indicates that this translation unit is part of Google Test's
 // implementation.  It must come before gtest-internal-inl.h is
 // included, or there will be a compiler error.  This trick is to