Skip to content

Commit ae2f8d8

Browse files
authored
Replace use of llvm-dis as the guessed location for LLVM root (#18310)
generate_config tries to find the location of an LLVM installation based on the presence of llvm-dis. This will likely work to locate a toolchain-developer-focused or self-built version of LLVM, but not one that is part of a Linux system package or mac SDK, because those don't include llvm-dis. This could fail in 2 ways: if there were a wasm-supporting clang and lld (which are all that's needed from LLVM for many purposes) but no llvm-dis (which is not included in emsdk); or if there were an LLVM without wasm support. We could use wasm-ld instead, which is one truly reuquired component (and the presence of which would likely indicate a wasm-supporting clang to go with it). This could still fail in some cases (e.g. sometimes a tool like objcopy is needed and might not be present) but no cases I'm aware of that are not already failure modes of the existing code.
1 parent 7c3be8e commit ae2f8d8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

test/test_sanity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def make_new_executable(name):
172172
open(os.path.join(temp_bin, name), 'w').close()
173173
make_executable(os.path.join(temp_bin, name))
174174

175-
make_new_executable('llvm-dis')
175+
make_new_executable('wasm-ld')
176176
make_new_executable('node')
177177

178178
with env_modify({'PATH': temp_bin + os.pathsep + os.environ['PATH']}):

tools/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def generate_config(path):
176176
config_data = config_data.splitlines()[3:] # remove the initial comment
177177
config_data = '\n'.join(config_data)
178178
# autodetect some default paths
179-
llvm_root = os.path.dirname(which('llvm-dis') or '/usr/bin/llvm-dis')
179+
llvm_root = os.path.dirname(which('wasm-ld') or '/usr/bin/wasm-ld')
180180
config_data = config_data.replace('\'{{{ LLVM_ROOT }}}\'', repr(llvm_root))
181181

182182
binaryen_root = os.path.dirname(os.path.dirname(which('wasm-opt') or '/usr/local/bin/wasm-opt'))

0 commit comments

Comments
 (0)