Skip to content

Commit 88fc9f0

Browse files
authored
Create wrappers for llvm-dwp and llvm-nm (emscripten-core#14659)
Fixes: emscripten-core#14533
1 parent dfa2a40 commit 88fc9f0

12 files changed

Lines changed: 177 additions & 16 deletions

File tree

em-dwp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
# Copyright 2020 The Emscripten Authors. All rights reserved.
3+
# Emscripten is available under two separate licenses, the MIT license and the
4+
# University of Illinois/NCSA Open Source License. Both these licenses can be
5+
# found in the LICENSE file.
6+
#
7+
# Entry point for running python scripts on UNIX systems.
8+
#
9+
# Automatically generated by `create_entry_points.py`; DO NOT EDIT.
10+
#
11+
# To make modifications to this file, edit `tools/run_python.sh` and then run
12+
# `tools/create_entry_points.py`
13+
14+
if [ -z "$PYTHON" ]; then
15+
PYTHON=$EMSDK_PYTHON
16+
fi
17+
18+
if [ -z "$PYTHON" ]; then
19+
PYTHON=$(which python3 2> /dev/null)
20+
fi
21+
22+
if [ -z "$PYTHON" ]; then
23+
PYTHON=$(which python 2> /dev/null)
24+
fi
25+
26+
if [ -z "$PYTHON" ]; then
27+
echo 'unable to find python in $PATH'
28+
exit 1
29+
fi
30+
31+
exec "$PYTHON" "$0.py" "$@"

em-dwp.bat

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:: Entry point for running python scripts on windows systems.
2+
::
3+
:: Automatically generated by `create_entry_points.py`; DO NOT EDIT.
4+
::
5+
:: To make modifications to this file, edit `tools/run_python.bat` and then run
6+
:: `tools/create_entry_points.py`
7+
8+
@setlocal
9+
@set EM_PY=%EMSDK_PYTHON%
10+
@if "%EM_PY%"=="" (
11+
set EM_PY=python
12+
)
13+
14+
@"%EM_PY%" "%~dp0\%~n0.py" %*

emar.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,11 @@
44
# University of Illinois/NCSA Open Source License. Both these licenses can be
55
# found in the LICENSE file.
66

7-
"""Archive helper script
8-
9-
This script acts as a frontend replacement for `llvm-ar`.
7+
"""Wrapper scripte around `llvm-ar`.
108
"""
119

1210
import sys
13-
1411
from tools import shared
1512

16-
17-
#
18-
# Main run() function
19-
#
20-
def run():
21-
cmd = [shared.LLVM_AR] + sys.argv[1:]
22-
return shared.run_process(cmd, stdin=sys.stdin, check=False).returncode
23-
24-
25-
if __name__ == '__main__':
26-
sys.exit(run())
13+
cmd = [shared.LLVM_AR] + sys.argv[1:]
14+
sys.exit(shared.run_process(cmd, stdin=sys.stdin, check=False).returncode)

emdwp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
# Copyright 2020 The Emscripten Authors. All rights reserved.
3+
# Emscripten is available under two separate licenses, the MIT license and the
4+
# University of Illinois/NCSA Open Source License. Both these licenses can be
5+
# found in the LICENSE file.
6+
#
7+
# Entry point for running python scripts on UNIX systems.
8+
#
9+
# Automatically generated by `create_entry_points.py`; DO NOT EDIT.
10+
#
11+
# To make modifications to this file, edit `tools/run_python.sh` and then run
12+
# `tools/create_entry_points.py`
13+
14+
if [ -z "$PYTHON" ]; then
15+
PYTHON=$EMSDK_PYTHON
16+
fi
17+
18+
if [ -z "$PYTHON" ]; then
19+
PYTHON=$(which python3 2> /dev/null)
20+
fi
21+
22+
if [ -z "$PYTHON" ]; then
23+
PYTHON=$(which python 2> /dev/null)
24+
fi
25+
26+
if [ -z "$PYTHON" ]; then
27+
echo 'unable to find python in $PATH'
28+
exit 1
29+
fi
30+
31+
exec "$PYTHON" "$(dirname $0)/tools/emdwp.py" "$@"

emdwp.bat

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:: Entry point for running python scripts on windows systems.
2+
::
3+
:: Automatically generated by `create_entry_points.py`; DO NOT EDIT.
4+
::
5+
:: To make modifications to this file, edit `tools/run_python.bat` and then run
6+
:: `tools/create_entry_points.py`
7+
8+
@setlocal
9+
@set EM_PY=%EMSDK_PYTHON%
10+
@if "%EM_PY%"=="" (
11+
set EM_PY=python
12+
)
13+
14+
@"%EM_PY%" "%~dp0\tools\emdwp.py" %*

emnm

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
# Copyright 2020 The Emscripten Authors. All rights reserved.
3+
# Emscripten is available under two separate licenses, the MIT license and the
4+
# University of Illinois/NCSA Open Source License. Both these licenses can be
5+
# found in the LICENSE file.
6+
#
7+
# Entry point for running python scripts on UNIX systems.
8+
#
9+
# Automatically generated by `create_entry_points.py`; DO NOT EDIT.
10+
#
11+
# To make modifications to this file, edit `tools/run_python.sh` and then run
12+
# `tools/create_entry_points.py`
13+
14+
if [ -z "$PYTHON" ]; then
15+
PYTHON=$EMSDK_PYTHON
16+
fi
17+
18+
if [ -z "$PYTHON" ]; then
19+
PYTHON=$(which python3 2> /dev/null)
20+
fi
21+
22+
if [ -z "$PYTHON" ]; then
23+
PYTHON=$(which python 2> /dev/null)
24+
fi
25+
26+
if [ -z "$PYTHON" ]; then
27+
echo 'unable to find python in $PATH'
28+
exit 1
29+
fi
30+
31+
exec "$PYTHON" "$(dirname $0)/tools/emnm.py" "$@"

emnm.bat

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:: Entry point for running python scripts on windows systems.
2+
::
3+
:: Automatically generated by `create_entry_points.py`; DO NOT EDIT.
4+
::
5+
:: To make modifications to this file, edit `tools/run_python.bat` and then run
6+
:: `tools/create_entry_points.py`
7+
8+
@setlocal
9+
@set EM_PY=%EMSDK_PYTHON%
10+
@if "%EM_PY%"=="" (
11+
set EM_PY=python
12+
)
13+
14+
@"%EM_PY%" "%~dp0\tools\emnm.py" %*

tests/test_other.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6771,7 +6771,7 @@ def test_disable_inlining(self):
67716771

67726772
# To this test to be successful, foo() shouldn't have been inlined above and
67736773
# foo() should be in the function list
6774-
output = self.run_process([shared.LLVM_NM, 'test2.o'], stdout=PIPE).stdout
6774+
output = self.run_process([shared.EM_NM, 'test2.o'], stdout=PIPE).stdout
67756775
self.assertContained('foo', output)
67766776

67776777
def test_output_eol(self):

tools/create_entry_points.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
emsize
3636
emdump
3737
emprofile
38+
emdwp
39+
emnm
3840
tools/file_packager
3941
tools/webidl_binder
4042
tests/runner
@@ -46,6 +48,8 @@
4648
entry_remap = {
4749
'emdump': 'tools/emdump',
4850
'emprofile': 'tools/emprofile',
51+
'emdwp': 'tools/emdwp',
52+
'emnm': 'tools/emnm',
4953
}
5054

5155
tools_dir = os.path.dirname(os.path.abspath(__file__))

tools/emdwp.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python3
2+
# Copyright 2016 The Emscripten Authors. All rights reserved.
3+
# Emscripten is available under two separate licenses, the MIT license and the
4+
# University of Illinois/NCSA Open Source License. Both these licenses can be
5+
# found in the LICENSE file.
6+
7+
"""Wrapper scripte around `llvm-dwp`.
8+
"""
9+
10+
import sys
11+
import os
12+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
13+
from tools import shared
14+
15+
cmd = [shared.LLVM_DWP] + sys.argv[1:]
16+
sys.exit(shared.run_process(cmd, stdin=sys.stdin, check=False).returncode)

0 commit comments

Comments
 (0)