aboutsummaryrefslogtreecommitdiffstats
path: root/main/llvm/llvm-musl.patch
blob: b5a1c09ed9e01ab21ec5a6ad43b38fd37b033a8c (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
--- a/lib/Support/DynamicLibrary.cpp	(revision 170294)
+++ b/lib/Support/DynamicLibrary.cpp	(working copy)
@@ -155,7 +155,7 @@
 
 // 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
--- a/utils/unittest/googletest/gtest.cc	(revision 170294)
+++ b/utils/unittest/googletest/gtest.cc	(working copy)
@@ -120,6 +120,7 @@
 
 #if GTEST_CAN_STREAM_RESULTS_
 # include <arpa/inet.h>  // NOLINT
+# include <sys/socket.h>  // NOLINT
 # include <netdb.h>  // NOLINT
 #endif

--- a/include/llvm/Target/TargetLibraryInfo.h
+++ b/include/llvm/Target/TargetLibraryInfo.h
@@ -243,8 +243,6 @@ namespace llvm {
       fmodl,
       /// FILE *fopen(const char *filename, const char *mode);
       fopen,
-      /// FILE *fopen64(const char *filename, const char *opentype)
-      fopen64,
       /// int fprintf(FILE *stream, const char *format, ...);
       fprintf,
       /// int fputc(int c, FILE *stream);
@@ -267,8 +265,6 @@ namespace llvm {
       fseek,
       /// int fseeko(FILE *stream, off_t offset, int whence);
       fseeko,
-      /// int fseeko64(FILE *stream, off64_t offset, int whence)
-      fseeko64,
       /// int fsetpos(FILE *stream, const fpos_t *pos);
       fsetpos,
       /// int fstat(int fildes, struct stat *buf);
@@ -283,8 +279,6 @@ namespace llvm {
       ftell,
       /// off_t ftello(FILE *stream);
       ftello,
-      /// off64_t ftello64(FILE *stream)
-      ftello64,
       /// int ftrylockfile(FILE *file);
       ftrylockfile,
       /// void funlockfile(FILE *file);
@@ -588,8 +582,6 @@ namespace llvm {
       times,
       /// FILE *tmpfile(void);
       tmpfile,
-      /// FILE *tmpfile64(void)
-      tmpfile64,
       /// int toascii(int c);
       toascii,
       /// double trunc(double x);

--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -68,7 +68,7 @@ extern "C" void LLVMLinkInJIT() {
 }

 // Determine whether we can register EH tables.
-#if (defined(__GNUC__) && !defined(__ARM_EABI__) && \
+#if (defined(__GLIBC__) && !defined(__ARM_EABI__) && \
      !defined(__USING_SJLJ_EXCEPTIONS__))
 #define HAVE_EHTABLE_SUPPORT 1
 #else
--- a/lib/Support/Unix/Signals.inc
+++ b/lib/Support/Unix/Signals.inc
@@ -268,7 +268,7 @@ void llvm::sys::AddSignalHandler(void (*FnPtr)(void *), void *Cookie) {
 // 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,
--- a/lib/Target/TargetLibraryInfo.cpp
+++ b/lib/Target/TargetLibraryInfo.cpp
@@ -136,7 +136,6 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] =
     "fmodf",
     "fmodl",
     "fopen",
-    "fopen64",
     "fprintf",
     "fputc",
     "fputs",
@@ -148,7 +147,6 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] =
     "fscanf",
     "fseek",
     "fseeko",
-    "fseeko64",
     "fsetpos",
     "fstat",
     "fstat64",
@@ -156,7 +154,6 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] =
     "fstatvfs64",
     "ftell",
     "ftello",
-    "ftello64",
     "ftrylockfile",
     "funlockfile",
     "fwrite",
@@ -306,7 +303,6 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] =
     "tanl",
     "times",
     "tmpfile",
-    "tmpfile64",
     "toascii",
     "trunc",
     "truncf",
@@ -566,16 +562,12 @@ static void initialize(TargetLibraryInfo &TLI, const Triple &T,
     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);
     TLI.setUnavailable(LibFunc::open64);
     TLI.setUnavailable(LibFunc::stat64);
     TLI.setUnavailable(LibFunc::statvfs64);
-    TLI.setUnavailable(LibFunc::tmpfile64);
   }
 }

--- a/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1271,30 +1271,6 @@ bool FunctionAttrs::inferPrototypeAttributes(Function &F) {
     setDoesNotCapture(F, 1);
     setDoesNotCapture(F, 2);
     break;
-  case LibFunc::fopen64:
-    if (FTy->getNumParams() != 2 ||
-        !FTy->getReturnType()->isPointerTy() ||
-        !FTy->getParamType(0)->isPointerTy() ||
-        !FTy->getParamType(1)->isPointerTy())
-      return false;
-    setDoesNotThrow(F);
-    setDoesNotAlias(F, 0);
-    setDoesNotCapture(F, 1);
-    setDoesNotCapture(F, 2);
-    break;
-  case LibFunc::fseeko64:
-  case LibFunc::ftello64:
-    if (FTy->getNumParams() == 0 || !FTy->getParamType(0)->isPointerTy())
-      return false;
-    setDoesNotThrow(F);
-    setDoesNotCapture(F, 1);
-    break;
-  case LibFunc::tmpfile64:
-    if (!FTy->getReturnType()->isPointerTy())
-      return false;
-    setDoesNotThrow(F);
-    setDoesNotAlias(F, 0);
-    break;
   case LibFunc::fstat64:
   case LibFunc::fstatvfs64:
     if (FTy->getNumParams() != 2 || !FTy->getParamType(1)->isPointerTy())