Skip to content

Commit

Permalink
Allow users to overwrite ld with environment variable in linker optim…
Browse files Browse the repository at this point in the history
…ization script (pytorch#137331)

This should help in the case of cross compilation.

xref: conda-forge/pytorch-cpu-feedstock#261

Fixes #ISSUE_NUMBER

Pull Request resolved: pytorch#137331
Approved by: https://github.com/isuruf, https://github.com/seemethere
  • Loading branch information
hmaarrfk authored and pytorchmergebot committed Nov 26, 2024
1 parent 23793cf commit 43afaa4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/setup_helpers/generate_linker_script.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import subprocess


Expand All @@ -9,8 +10,8 @@ def gen_linker_script(
prioritized_text = [
line.replace("\n", "") for line in prioritized_text if line != "\n"
]

linker_script_lines = subprocess.check_output(["ld", "-verbose"], text=True).split(
ld = os.environ.get("LD", "ld")
linker_script_lines = subprocess.check_output([ld, "-verbose"], text=True).split(
"\n"
)

Expand Down

0 comments on commit 43afaa4

Please sign in to comment.