mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
GH-134273: Allow setting JIT compiler flags at build time with CFLAGS_JIT (GH134276)
Some checks failed
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
JIT / Interpreter (Debug) (push) Has been cancelled
JIT / aarch64-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / aarch64-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / i686-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / i686-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / aarch64-apple-darwin/clang (Release) (push) Has been cancelled
JIT / aarch64-unknown-linux-gnu/gcc (Release) (push) Has been cancelled
JIT / aarch64-apple-darwin/clang (Debug) (push) Has been cancelled
JIT / aarch64-unknown-linux-gnu/gcc (Debug) (push) Has been cancelled
JIT / x86_64-apple-darwin/clang (Debug) (push) Has been cancelled
JIT / x86_64-unknown-linux-gnu/gcc (Debug) (push) Has been cancelled
JIT / x86_64-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / x86_64-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / x86_64-apple-darwin/clang (Release) (push) Has been cancelled
JIT / x86_64-unknown-linux-gnu/gcc (Release) (push) Has been cancelled
Some checks failed
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
JIT / Interpreter (Debug) (push) Has been cancelled
JIT / aarch64-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / aarch64-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / i686-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / i686-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / aarch64-apple-darwin/clang (Release) (push) Has been cancelled
JIT / aarch64-unknown-linux-gnu/gcc (Release) (push) Has been cancelled
JIT / aarch64-apple-darwin/clang (Debug) (push) Has been cancelled
JIT / aarch64-unknown-linux-gnu/gcc (Debug) (push) Has been cancelled
JIT / x86_64-apple-darwin/clang (Debug) (push) Has been cancelled
JIT / x86_64-unknown-linux-gnu/gcc (Debug) (push) Has been cancelled
JIT / x86_64-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / x86_64-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / x86_64-apple-darwin/clang (Release) (push) Has been cancelled
JIT / x86_64-unknown-linux-gnu/gcc (Release) (push) Has been cancelled
This commit is contained in:
parent
73431356d3
commit
2b0c684e07
5 changed files with 12 additions and 2 deletions
|
@ -0,0 +1 @@
|
|||
Add support for configuring compiler flags for the JIT with ``CFLAGS_JIT``
|
|
@ -10,6 +10,7 @@ import re
|
|||
import sys
|
||||
import tempfile
|
||||
import typing
|
||||
import shlex
|
||||
|
||||
import _llvm
|
||||
import _schema
|
||||
|
@ -46,6 +47,7 @@ class _Target(typing.Generic[_S, _R]):
|
|||
stable: bool = False
|
||||
debug: bool = False
|
||||
verbose: bool = False
|
||||
cflags: str = ""
|
||||
known_symbols: dict[str, int] = dataclasses.field(default_factory=dict)
|
||||
pyconfig_dir: pathlib.Path = pathlib.Path.cwd().resolve()
|
||||
|
||||
|
@ -62,6 +64,7 @@ class _Target(typing.Generic[_S, _R]):
|
|||
hasher = hashlib.sha256()
|
||||
hasher.update(self.triple.encode())
|
||||
hasher.update(self.debug.to_bytes())
|
||||
hasher.update(self.cflags.encode())
|
||||
# These dependencies are also reflected in _JITSources in regen.targets:
|
||||
hasher.update(PYTHON_EXECUTOR_CASES_C_H.read_bytes())
|
||||
hasher.update((self.pyconfig_dir / "pyconfig.h").read_bytes())
|
||||
|
@ -155,6 +158,8 @@ class _Target(typing.Generic[_S, _R]):
|
|||
f"{o}",
|
||||
f"{c}",
|
||||
*self.args,
|
||||
# Allow user-provided CFLAGS to override any defaults
|
||||
*shlex.split(self.cflags),
|
||||
]
|
||||
await _llvm.run("clang", args, echo=self.verbose)
|
||||
return await self._parse(o)
|
||||
|
|
|
@ -39,11 +39,15 @@ if __name__ == "__main__":
|
|||
parser.add_argument(
|
||||
"-v", "--verbose", action="store_true", help="echo commands as they are run"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--cflags", help="additional flags to pass to the compiler", default=""
|
||||
)
|
||||
args = parser.parse_args()
|
||||
for target in args.target:
|
||||
target.debug = args.debug
|
||||
target.force = args.force
|
||||
target.verbose = args.verbose
|
||||
target.cflags = args.cflags
|
||||
target.pyconfig_dir = args.pyconfig_dir
|
||||
target.build(
|
||||
comment=comment,
|
||||
|
|
2
configure
generated
vendored
2
configure
generated
vendored
|
@ -10863,7 +10863,7 @@ then :
|
|||
|
||||
else case e in #(
|
||||
e) as_fn_append CFLAGS_NODIST " $jit_flags"
|
||||
REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir ."
|
||||
REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir . --cflags=\"$CFLAGS_JIT\""
|
||||
JIT_STENCILS_H="jit_stencils.h"
|
||||
if test "x$Py_DEBUG" = xtrue
|
||||
then :
|
||||
|
|
|
@ -2776,7 +2776,7 @@ AS_VAR_IF([jit_flags],
|
|||
[],
|
||||
[AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
|
||||
AS_VAR_SET([REGEN_JIT_COMMAND],
|
||||
["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir ."])
|
||||
["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir . --cflags=\"$CFLAGS_JIT\""])
|
||||
AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
|
||||
AS_VAR_IF([Py_DEBUG],
|
||||
[true],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue