Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: pydir/build-runtime.py

Issue 1409863006: Subzero. ARM32. Refactors atomic intrinsics lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python2 1 #!/usr/bin/env python2
2 2
3 import argparse 3 import argparse
4 import os 4 import os
5 import shutil 5 import shutil
6 import tempfile 6 import tempfile
7 7
8 import targets 8 import targets
9 from utils import shellcmd 9 from utils import shellcmd
10 from utils import FindBaseNaCl 10 from utils import FindBaseNaCl
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 ['-mtriple=' + target_info.triple] + target_info.llc_flags, 58 ['-mtriple=' + target_info.triple] + target_info.llc_flags,
59 TmpFile('{dir}/szrt_native_{target}.tmp.o'), 59 TmpFile('{dir}/szrt_native_{target}.tmp.o'),
60 verbose) 60 verbose)
61 # Compile srcdir/szrt_profiler.c to 61 # Compile srcdir/szrt_profiler.c to
62 # tempdir/szrt_profiler_native_{target}.o. 62 # tempdir/szrt_profiler_native_{target}.o.
63 shellcmd(['clang', 63 shellcmd(['clang',
64 '-O2', 64 '-O2',
65 '-target=' + target_info.triple, 65 '-target=' + target_info.triple,
66 '-c', 66 '-c',
67 '{srcdir}/szrt_profiler.c'.format(srcdir=srcdir), 67 '{srcdir}/szrt_profiler.c'.format(srcdir=srcdir),
68 '-o', TmpFile('{dir}/szrt_profiler_native_{target}.o') 68 '-o', TmpFile('{dir}/szrt_native_profiler_{target}.o')
69 ], echo=verbose)
70 # Assemble srcdir/szrt_asm_{target}.s to tempdir/szrt_asm_{target}.o.
71 shellcmd(['llvm-mc',
72 '-triple=' + target_info.triple, '--defsym NATIVE=1',
73 '-filetype=obj',
74 '-o', TmpFile('{dir}/szrt_native_asm_{target}.o'),
75 '{srcdir}/szrt_asm_{target}.s'.format(
76 srcdir=srcdir, target=target_info.target)
69 ], echo=verbose) 77 ], echo=verbose)
70 # Write full szrt_native_{target}.o. 78 # Write full szrt_native_{target}.o.
71 PartialLink([TmpFile('{dir}/szrt_native_{target}.tmp.o'), 79 PartialLink([TmpFile('{dir}/szrt_native_{target}.tmp.o'),
72 TmpFile('{dir}/szrt_profiler_native_{target}.o')], 80 TmpFile('{dir}/szrt_native_asm_{target}.o'),
81 TmpFile('{dir}/szrt_native_profiler_{target}.o')],
73 ['-m {ld_emu}'.format(ld_emu=target_info.ld_emu)], 82 ['-m {ld_emu}'.format(ld_emu=target_info.ld_emu)],
74 OutFile('{rtdir}/szrt_native_{target}.o'), 83 OutFile('{rtdir}/szrt_native_{target}.o'),
75 verbose) 84 verbose)
85 shellcmd(['le32-nacl-objcopy',
86 '--strip-symbol=NATIVE',
87 OutFile('{rtdir}/szrt_native_{target}.o')])
88
76 # Helper function for building the sandboxed runtime. 89 # Helper function for building the sandboxed runtime.
77 def MakeSandboxedRuntime(): 90 def MakeSandboxedRuntime():
78 """Builds just the sandboxed runtime.""" 91 """Builds just the sandboxed runtime."""
79 # Translate tempdir/szrt.ll and tempdir/szrt_ll.ll to szrt_sb_{target}.o. 92 # Translate tempdir/szrt.ll and tempdir/szrt_ll.ll to szrt_sb_{target}.o.
80 # The sandboxed library does not get the profiler helper function as the 93 # The sandboxed library does not get the profiler helper function as the
81 # binaries are linked with -nostdlib. 94 # binaries are linked with -nostdlib.
82 Translate(ll_files, 95 Translate(ll_files,
83 ['-mtriple=' + targets.ConvertTripleToNaCl(target_info.triple)] + 96 ['-mtriple=' + targets.ConvertTripleToNaCl(target_info.triple)] +
84 target_info.llc_flags, 97 target_info.llc_flags,
85 OutFile('{rtdir}/szrt_sb_{target}.o'), 98 TmpFile('{dir}/szrt_sb_{target}.tmp.o'),
86 verbose) 99 verbose)
100 # Assemble srcdir/szrt_asm_{target}.s to tempdir/szrt_asm_{target}.o.
101 shellcmd(['llvm-mc',
102 '-triple=' + targets.ConvertTripleToNaCl(target_info.triple),
103 '--defsym NACL=1',
104 '-filetype=obj',
105 '-o', TmpFile('{dir}/szrt_sb_asm_{target}.o'),
106 '{srcdir}/szrt_asm_{target}.s'.format(
107 srcdir=srcdir, target=target_info.target)
108 ], echo=verbose)
109 PartialLink([TmpFile('{dir}/szrt_sb_{target}.tmp.o'),
110 TmpFile('{dir}/szrt_sb_asm_{target}.o')],
111 ['-m {ld_emu}'.format(ld_emu=target_info.sb_emu)],
112 OutFile('{rtdir}/szrt_sb_{target}.o'),
113 verbose)
114 shellcmd(['le32-nacl-objcopy',
115 '--strip-symbol=NACL',
116 OutFile('{rtdir}/szrt_sb_{target}.o')])
117
87 # Helper function for building the Non-SFI runtime. 118 # Helper function for building the Non-SFI runtime.
88 def MakeNonsfiRuntime(): 119 def MakeNonsfiRuntime():
89 """Builds just the nonsfi runtime.""" 120 """Builds just the nonsfi runtime."""
90 # Translate tempdir/szrt.ll and tempdir/szrt_ll.ll to 121 # Translate tempdir/szrt.ll and tempdir/szrt_ll.ll to
91 # szrt_nonsfi_{target}.tmp.o. 122 # szrt_nonsfi_{target}.tmp.o.
92 Translate(ll_files, 123 Translate(ll_files,
93 ['-mtriple=' + target_info.triple] + target_info.llc_flags + 124 ['-mtriple=' + target_info.triple] + target_info.llc_flags +
94 ['-relocation-model=pic', '-force-tls-non-pic', '-malign-double'], 125 ['-relocation-model=pic', '-force-tls-non-pic', '-malign-double'],
95 TmpFile('{dir}/szrt_nonsfi_{target}.tmp.o'), 126 TmpFile('{dir}/szrt_nonsfi_{target}.tmp.o'),
96 verbose) 127 verbose)
97 # Assemble srcdir/szrt_asm_{target}.s to tempdir/szrt_asm_{target}.o. 128 # Assemble srcdir/szrt_asm_{target}.s to tempdir/szrt_asm_{target}.o.
98 shellcmd(['llvm-mc', 129 shellcmd(['llvm-mc',
99 '-triple=' + target_info.triple, 130 '-triple=' + target_info.triple, '--defsym NONSFI=1',
100 '-filetype=obj', 131 '-filetype=obj',
101 '-o', TmpFile('{dir}/szrt_asm_{target}.o'), 132 '-o', TmpFile('{dir}/szrt_nonsfi_asm_{target}.o'),
102 '{srcdir}/szrt_asm_{target}.s'.format( 133 '{srcdir}/szrt_asm_{target}.s'.format(
103 srcdir=srcdir, target=target_info.target) 134 srcdir=srcdir, target=target_info.target)
104 ], echo=verbose) 135 ], echo=verbose)
105 # Write full szrt_nonsfi_{target}.o. 136 # Write full szrt_nonsfi_{target}.o.
106 PartialLink([TmpFile('{dir}/szrt_nonsfi_{target}.tmp.o'), 137 PartialLink([TmpFile('{dir}/szrt_nonsfi_{target}.tmp.o'),
107 TmpFile('{dir}/szrt_asm_{target}.o')], 138 TmpFile('{dir}/szrt_nonsfi_asm_{target}.o')],
108 ['-m {ld_emu}'.format(ld_emu=target_info.ld_emu)], 139 ['-m {ld_emu}'.format(ld_emu=target_info.ld_emu)],
109 OutFile('{rtdir}/szrt_nonsfi_{target}.o'), 140 OutFile('{rtdir}/szrt_nonsfi_{target}.o'),
110 verbose) 141 verbose)
142 shellcmd(['le32-nacl-objcopy',
143 '--strip-symbol=NONSFI',
144 OutFile('{rtdir}/szrt_nonsfi_{target}.o')])
145
111 146
112 # Run the helper functions. 147 # Run the helper functions.
113 MakeNativeRuntime() 148 MakeNativeRuntime()
114 MakeSandboxedRuntime() 149 MakeSandboxedRuntime()
115 MakeNonsfiRuntime() 150 MakeNonsfiRuntime()
116 151
117 152
118 def main(): 153 def main():
119 """Build the Subzero runtime support library for all architectures. 154 """Build the Subzero runtime support library for all architectures.
120 """ 155 """
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 207
173 finally: 208 finally:
174 try: 209 try:
175 shutil.rmtree(tempdir) 210 shutil.rmtree(tempdir)
176 except OSError as exc: 211 except OSError as exc:
177 if exc.errno != errno.ENOENT: # ENOENT - no such file or directory 212 if exc.errno != errno.ENOENT: # ENOENT - no such file or directory
178 raise # re-raise exception 213 raise # re-raise exception
179 214
180 if __name__ == '__main__': 215 if __name__ == '__main__':
181 main() 216 main()
OLDNEW
« no previous file with comments | « crosstest/test_sync_atomic.cpp ('k') | pydir/targets.py » ('j') | src/IceTargetLoweringARM32.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698