diff options
Diffstat (limited to 'main/llvm/llvm-musl.patch')
-rw-r--r-- | main/llvm/llvm-musl.patch | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/main/llvm/llvm-musl.patch b/main/llvm/llvm-musl.patch new file mode 100644 index 0000000000..b5a1c09ed9 --- /dev/null +++ b/main/llvm/llvm-musl.patch @@ -0,0 +1,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()) + |