Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b0185f3917c9
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e8943a008cdf
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Jul 30, 2015

  1. Use try..finally in compiler.targets.Target.link.

    whitequark committed Jul 30, 2015
    Copy the full SHA
    1e3911e View commit details
  2. Rename compiler/{targets/__init__.py → targets.py}.

    whitequark committed Jul 30, 2015
    Copy the full SHA
    e8943a0 View commit details
Showing with 15 additions and 16 deletions.
  1. +15 −16 artiq/compiler/{targets/__init__.py → targets.py}
31 changes: 15 additions & 16 deletions artiq/compiler/targets/__init__.py → artiq/compiler/targets.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
class Target:
"""
A description of the target environment where the binaries
generaed by the ARTIQ compiler will be deployed.
generated by the ARTIQ compiler will be deployed.
:var triple: (string)
LLVM target triple, e.g. ``"or1k"``
@@ -36,21 +36,20 @@ def make_tempfile(data=b""):
f.flush()
return f

output_file = make_tempfile()
cmdline = [self.triple + "-ld", "-shared", "--eh-frame-hdr", "-init", init_fn] + \
[make_tempfile(obj).name for obj in objects] + \
["-o", output_file.name]
linker = subprocess.Popen(cmdline, stderr=subprocess.PIPE)
stdout, stderr = linker.communicate()
if linker.returncode != 0:
raise Exception("Linker invocation failed: " + stderr.decode('utf-8'))

output = output_file.read()

for f in files:
f.close()

return output
try:
output_file = make_tempfile()
cmdline = [self.triple + "-ld", "-shared", "--eh-frame-hdr", "-init", init_fn] + \
[make_tempfile(obj).name for obj in objects] + \
["-o", output_file.name]
linker = subprocess.Popen(cmdline, stderr=subprocess.PIPE)
stdout, stderr = linker.communicate()
if linker.returncode != 0:
raise Exception("Linker invocation failed: " + stderr.decode('utf-8'))

return output_file.read()
finally:
for f in files:
f.close()

def compile(self, module):
"""Compile the module to a relocatable object for this target."""