Skip to content

Commit 368adc4

Browse files
committed
Initial commit of compatibility patch
Applying the patch is not yet automated.
1 parent 3c442ab commit 368adc4

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ build/
22
downloads/
33
env/
44
llvm/
5+
llvm.orig/
56
**/__pycache__/

patches/llvm-3.9.1.patch

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
diff -ur llvm.orig/include/llvm/Analysis/TargetLibraryInfo.h llvm/include/llvm/Analysis/TargetLibraryInfo.h
2+
--- llvm.orig/include/llvm/Analysis/TargetLibraryInfo.h 2016-07-13 15:09:16.000000000 -0400
3+
+++ llvm/include/llvm/Analysis/TargetLibraryInfo.h 2017-02-18 14:35:19.172195900 -0500
4+
@@ -18,6 +18,19 @@
5+
#include "llvm/IR/PassManager.h"
6+
#include "llvm/Pass.h"
7+
8+
+// Emscripten handles large file support by providing #defines from 64-bit
9+
+// versions to 32-bit versions, but that breaks LLVM's use of those functions
10+
+// as distinct symbols
11+
+#ifdef __EMSCRIPTEN__
12+
+#undef fopen64
13+
+#undef fseeko64
14+
+#undef fstat64
15+
+#undef ftello64
16+
+#undef lstat64
17+
+#undef stat64
18+
+#undef tmpfile64
19+
+#endif
20+
+
21+
namespace llvm {
22+
template <typename T> class ArrayRef;
23+
24+
diff -ur llvm.orig/tools/clang/include/clang/Basic/LangOptions.h llvm/tools/clang/include/clang/Basic/LangOptions.h
25+
--- llvm.orig/tools/clang/include/clang/Basic/LangOptions.h 2016-05-18 05:06:38.000000000 -0400
26+
+++ llvm/tools/clang/include/clang/Basic/LangOptions.h 2017-02-18 10:31:12.868636900 -0500
27+
@@ -29,8 +29,15 @@
28+
/// this large collection of bitfields is a trivial class type.
29+
class LangOptionsBase {
30+
public:
31+
+ // Large bitfields cause problems for Emscripten.
32+
+ // See https://github.com/kripken/emscripten/issues/4540
33+
+ // As a workaround, use less efficient non-bitfield representations.
34+
+ typedef uint8_t OptWith1Bit;
35+
+ typedef uint8_t OptWith2Bit;
36+
+ typedef uint32_t OptWith32Bit;
37+
+
38+
// Define simple language options (with no accessors).
39+
-#define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits;
40+
+#define LANGOPT(Name, Bits, Default, Description) OptWith ## Bits ## Bit Name;
41+
#define ENUM_LANGOPT(Name, Type, Bits, Default, Description)
42+
#include "clang/Basic/LangOptions.def"
43+
44+
diff -ur llvm.orig/tools/clang/include/clang/Basic/VersionTuple.h llvm/tools/clang/include/clang/Basic/VersionTuple.h
45+
--- llvm.orig/tools/clang/include/clang/Basic/VersionTuple.h 2016-07-11 16:00:48.000000000 -0400
46+
+++ llvm/tools/clang/include/clang/Basic/VersionTuple.h 2017-02-18 12:02:36.792630200 -0500
47+
@@ -31,6 +31,9 @@
48+
unsigned Minor : 31;
49+
unsigned HasMinor : 1;
50+
51+
+ // See https://github.com/kripken/emscripten/issues/4540
52+
+ unsigned char :0;
53+
+
54+
unsigned Subminor : 31;
55+
unsigned HasSubminor : 1;
56+
57+
diff -ur llvm.orig/tools/clang/tools/c-index-test/CMakeLists.txt llvm/tools/clang/tools/c-index-test/CMakeLists.txt
58+
--- llvm.orig/tools/clang/tools/c-index-test/CMakeLists.txt 2016-02-20 15:34:55.000000000 -0500
59+
+++ llvm/tools/clang/tools/c-index-test/CMakeLists.txt 2017-02-18 14:18:33.390434200 -0500
60+
@@ -1,6 +1,7 @@
61+
-set(LLVM_LINK_COMPONENTS
62+
- support
63+
-)
64+
+# Omit for Emscripten - it's included in libclang below.
65+
+# set(LLVM_LINK_COMPONENTS
66+
+# support
67+
+# )
68+
69+
add_clang_executable(c-index-test
70+
c-index-test.c

0 commit comments

Comments
 (0)