Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-134273: Propagate CFLAGS to the JIT#134276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
zanieb wants to merge4 commits intopython:main
base:main
Choose a base branch
Loading
fromzanieb:zb/cflags-jit
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
Respect CFLAGS set during configure during JIT builds
4 changes: 4 additions & 0 deletionsTools/jit/_targets.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@
import sys
import tempfile
import typing
import shlex

import _llvm
import _schema
Expand DownExpand Up@@ -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)

def _get_nop(self) -> bytes:
Expand All@@ -61,6 +63,7 @@ def _compute_digest(self, out: pathlib.Path) -> str:
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((out / "pyconfig.h").read_bytes())
Expand DownExpand Up@@ -119,6 +122,7 @@ async def _compile(
) -> _stencils.StencilGroup:
o = tempdir / f"{opname}.o"
args = [
*shlex.split(self.cflags),
f"--target={self.triple}",
"-DPy_BUILD_CORE_MODULE",
"-D_DEBUG" if self.debug else "-DNDEBUG",
Expand Down
4 changes: 4 additions & 0 deletionsTools/jit/build.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,11 +26,15 @@
parser.add_argument(
"-v", "--verbose", action="store_true", help="echo commands as they are run"
)
parser.add_argument(
"--with-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.with_cflags
target.build(
out,
comment=comment,
Expand Down
2 changes: 1 addition & 1 deletionconfigure
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletionconfigure.ac
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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}"])
["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --with-cflags=\"\$(CONFIGURE_CFLAGS)\""])
AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
AS_VAR_IF([Py_DEBUG],
[true],
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp