8000 Allow users to overwrite ld with environment variable in linker optim… · pytorch/pytorch@43afaa4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 43afaa4

Browse files
hmaarrfkpytorchmergebot
authored andcommitted
Allow users to overwrite ld with environment variable in linker optimization script (#137331)
This should help in the case of cross compilation. xref: conda-forge/pytorch-cpu-feedstock#261 Fixes #ISSUE_NUMBER Pull Request resolved: #137331 Approved by: https://github.com/isuruf, https://github.com/seemethere
1 parent 23793cf commit 43afaa4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/setup_helpers/generate_linker_script.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import subprocess
23

34

@@ -9,8 +10,8 @@ def gen_linker_script(
910
prioritized_text = [
1011
line.replace("\n", "") for line in prioritized_text if line != "\n"
1112
]
12-
13-
linker_script_lines = subprocess.check_output(["ld", "-verbose"], text=True).split(
13+
ld = os.environ.get("LD", "ld")
14+
linker_script_lines = subprocess.check_output([ld, "-verbose"], text=True).split(
1415
"\n"
1516
)
1617

0 commit comments

Comments
 (0)
0