Skip to content

Commit

Permalink
Use Emscripten's llvm-readobj by default (#73)
Browse files Browse the repository at this point in the history
Co-authored-by: Joe Marshall <[email protected]>
Co-authored-by: Hood Chatham <[email protected]>
  • Loading branch information
3 people authored Dec 20, 2024
1 parent 0cbdce2 commit 4c0b872
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions pyodide_build/pywasmcross.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,21 @@ def _calculate_object_exports_readobj_parse(output: str) -> list[str]:
def calculate_object_exports_readobj(objects: list[str]) -> list[str] | None:
import shutil

readobj_path = shutil.which("llvm-readobj")
# This works for bootstrapped Emscripten via GitHub sources.
# llvm-readobj might not be available this way with Homebrew
# or conda-forge distributions of Emscripten.
which_emcc = shutil.which("emcc")
assert which_emcc
emcc = Path(which_emcc)
readobj = (emcc / "../../bin/llvm-readobj").resolve()
if readobj.exists():
readobj_path = str(readobj)
else:
readobj_path = shutil.which("llvm-readobj")
if not readobj_path:
which_emcc = shutil.which("emcc")
assert which_emcc
emcc = Path(which_emcc)
readobj_path = str((emcc / "../../bin/llvm-readobj").resolve())
print("Failed to find llvm-readobj, quitting", file=sys.stdout)
sys.exit(1)

args = [
readobj_path,
"--section-details",
Expand Down

0 comments on commit 4c0b872

Please sign in to comment.