Skip to content

Commit b8ce40c

Browse files
committed
import the already imported part of llvm-libc from HEAD
1 parent 0640db0 commit b8ce40c

File tree

48 files changed

+86
-116
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+86
-116
lines changed

system/lib/llvm-libc/readme.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
llvm's libc
22
-----------
33

4-
These files are from llvm-project based on release 20.1.4.
4+
These files are from llvm-project's HEAD.
55

66
We maintain a local fork of llvm-project that contains any emscripten
77
specific patches:
@@ -10,18 +10,23 @@ specific patches:
1010

1111
The current patch is based on the emscripten-libs-20 branch.
1212

13-
We do not use LLVM's libc directly, but libcxx uses a subset of headers from
14-
libc. So we only import these directories that libcxx depend on:
13+
Currently in producgtion, we do not use LLVM's libc directly yet, but libcxx uses a subset
14+
of headers from libc. So libcxx directly depends on the following directories:
1515
- libc/hdr
1616
- libc/include/llvm-libc-macros
1717
- libc/include/llvm-libc-types
1818
- libc/shared
1919
- libc/src/__support
2020

21+
In addition, we are experimenting with using llvm-libc in overlay mode. You can enable this
22+
by running with `EMCC_CFLAGS=-lllvmlibc`. See https://libc.llvm.org/overlay_mode.html for more
23+
details.
24+
2125
Update Instructions
2226
-------------------
2327

2428
Run `system/lib/update_libcxx.py path/to/llvm-project`
29+
Run `system/lib/update_llvm_libc.py path/to/llvm-project`
2530

2631
Modifications
2732
-------------

system/lib/update_libcxx.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@
2525
'include/llvm-libc-types',
2626
'shared',
2727
'config',
28-
'src/__support',
29-
'src/string',
30-
'src/strings',
31-
'src/errno',
32-
'src/math',
33-
'src/stdlib',
34-
'src/inttypes',
35-
'src/stdio/printf_core',
3628
]
3729

3830
def clean_dir(dirname):

system/lib/update_llvm_libc.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
import sys
99
import shutil
1010
import glob
11-
import subprocess
1211

1312
script_dir = os.path.abspath(os.path.dirname(__file__))
1413
emscripten_root = os.path.dirname(os.path.dirname(script_dir))
1514
default_llvm_dir = os.path.join(os.path.dirname(emscripten_root), 'llvm-project')
16-
emscripten_patches = os.path.join(script_dir, "llvm-libc", "patches", "*.patch")
1715

1816
preserve_files = ('readme.txt', '__assertion_handler', '__config_site')
1917
# ryu_long_double_constants.h from libc is unused (and very large)
@@ -68,30 +66,13 @@ def copy_tree(upstream_dir, local_dir):
6866
full = os.path.join(root, f)
6967
os.remove(full)
7068

71-
def apply_patch(patch_file):
72-
try:
73-
command = ["git", "apply", "-p2", "--directory=system/lib/llvm-libc/", patch_file]
74-
75-
result = subprocess.run(
76-
command,
77-
capture_output=True,
78-
text=True,
79-
check=True
80-
)
81-
82-
except subprocess.CalledProcessError as e:
83-
print(f"Error applying patch: {e}")
84-
print("STDOUT:", e.stdout)
85-
print("STDERR:", e.stderr)
8669

8770
def main():
8871
if len(sys.argv) > 1:
8972
llvm_dir = os.path.abspath(sys.argv[1])
9073
else:
9174
llvm_dir = default_llvm_dir
92-
libcxx_dir = os.path.join(llvm_dir, 'libcxx')
9375

94-
# libcxx includes headers from LLVM's libc
9576
libc_upstream_dir = os.path.join(llvm_dir, 'libc')
9677
assert os.path.exists(libc_upstream_dir)
9778
libc_local_dir = os.path.join(script_dir, 'llvm-libc')
@@ -111,9 +92,5 @@ def main():
11192
for file in files_to_exclude:
11293
os.remove(file)
11394

114-
patches_to_apply = glob.glob(emscripten_patches)
115-
for patch in patches_to_apply:
116-
apply_patch(patch)
117-
11895
if __name__ == '__main__':
11996
main()

test/code_size/audio_worklet_wasm.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"a.html.gz": 364,
44
"a.js": 3853,
55
"a.js.gz": 2050,
6-
"a.wasm": 1287,
7-
"a.wasm.gz": 859,
8-
"total": 5659,
9-
"total_gz": 3273
6+
"a.wasm": 1288,
7+
"a.wasm.gz": 867,
8+
"total": 5660,
9+
"total_gz": 3281
1010
}

test/code_size/embind_hello_wasm.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"a.html.gz": 380,
44
"a.js": 7680,
55
"a.js.gz": 3363,
6-
"a.wasm": 7290,
7-
"a.wasm.gz": 3343,
8-
"total": 15522,
9-
"total_gz": 7086
6+
"a.wasm": 7294,
7+
"a.wasm.gz": 3346,
8+
"total": 15526,
9+
"total_gz": 7089
1010
}

test/code_size/embind_val_wasm.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.html": 552,
33
"a.html.gz": 380,
4-
"a.js": 5685,
5-
"a.js.gz": 2538,
6-
"a.wasm": 9083,
7-
"a.wasm.gz": 4682,
8-
"total": 15320,
9-
"total_gz": 7600
4+
"a.js": 5748,
5+
"a.js.gz": 2563,
6+
"a.wasm": 9092,
7+
"a.wasm.gz": 4699,
8+
"total": 15392,
9+
"total_gz": 7642
1010
}

test/code_size/hello_wasm_worker_wasm.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"a.html.gz": 364,
44
"a.js": 830,
55
"a.js.gz": 530,
6-
"a.wasm": 1881,
7-
"a.wasm.gz": 1069,
8-
"total": 3230,
9-
"total_gz": 1963
6+
"a.wasm": 1885,
7+
"a.wasm.gz": 1079,
8+
"total": 3234,
9+
"total_gz": 1973
1010
}

test/code_size/hello_webgl2_wasm.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"a.html.gz": 328,
44
"a.js": 4386,
55
"a.js.gz": 2252,
6-
"a.wasm": 8286,
7-
"a.wasm.gz": 5617,
8-
"total": 13126,
9-
"total_gz": 8197
6+
"a.wasm": 8278,
7+
"a.wasm.gz": 5627,
8+
"total": 13118,
9+
"total_gz": 8207
1010
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"a.html": 346,
33
"a.html.gz": 262,
4-
"a.js": 18078,
5-
"a.js.gz": 9781,
6-
"total": 18424,
7-
"total_gz": 10043
4+
"a.js": 18103,
5+
"a.js.gz": 9771,
6+
"total": 18449,
7+
"total_gz": 10033
88
}

test/code_size/hello_webgl_wasm.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"a.html.gz": 328,
44
"a.js": 3924,
55
"a.js.gz": 2092,
6-
"a.wasm": 8286,
7-
"a.wasm.gz": 5617,
8-
"total": 12664,
9-
"total_gz": 8037
6+
"a.wasm": 8278,
7+
"a.wasm.gz": 5627,
8+
"total": 12656,
9+
"total_gz": 8047
1010
}

0 commit comments

Comments
 (0)