OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 # | 5 # |
6 # IMPORTANT NOTE: If you make local mods to this file, you must run: | 6 # IMPORTANT NOTE: If you make local mods to this file, you must run: |
7 # % pnacl/build.sh driver | 7 # % pnacl/build.sh driver |
8 # in order for them to take effect in the scons build. This command | 8 # in order for them to take effect in the scons build. This command |
9 # updates the copy in the toolchain/ tree. | 9 # updates the copy in the toolchain/ tree. |
10 # | 10 # |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 '${LIBGCC_EH}} -l:libgcc.a ${MISC_LIBS}', | 91 '${LIBGCC_EH}} -l:libgcc.a ${MISC_LIBS}', |
92 | 92 |
93 'MISC_LIBS': | 93 'MISC_LIBS': |
94 # TODO(pdox): | 94 # TODO(pdox): |
95 # Move libcrt_platform into the __pnacl namespace, | 95 # Move libcrt_platform into the __pnacl namespace, |
96 # with stubs to access it from newlib. | 96 # with stubs to access it from newlib. |
97 '${LIBMODE_NEWLIB ? -l:libcrt_platform.a} ', | 97 '${LIBMODE_NEWLIB ? -l:libcrt_platform.a} ', |
98 | 98 |
99 # Determine whether or not to use bitcode metadata to generate .so stubs | 99 # Determine whether or not to use bitcode metadata to generate .so stubs |
100 # for the final link. | 100 # for the final link. |
101 'USE_META': '0', | 101 'USE_META': '0', |
jvoung (off chromium)
2013/05/14 23:48:46
Please remove USE_META and bits related to that al
eliben
2013/05/15 15:40:41
Done.
| |
102 | 102 |
103 'TRIPLE' : '${TRIPLE_%ARCH%}', | 103 'TRIPLE' : '${TRIPLE_%ARCH%}', |
104 'TRIPLE_ARM' : 'armv7a-none-nacl-gnueabi', | 104 'TRIPLE_ARM' : 'armv7a-none-nacl-gnueabi', |
105 'TRIPLE_X8632': 'i686-none-nacl-gnu', | 105 'TRIPLE_X8632': 'i686-none-nacl-gnu', |
106 'TRIPLE_X8664': 'x86_64-none-nacl-gnu', | 106 'TRIPLE_X8664': 'x86_64-none-nacl-gnu', |
107 'TRIPLE_MIPS32': 'mipsel-none-nacl-gnu', | 107 'TRIPLE_MIPS32': 'mipsel-none-nacl-gnu', |
108 | 108 |
109 'LLC_FLAGS_COMMON': '${PIC ? -relocation-model=pic} ' + | 109 'LLC_FLAGS_COMMON': '${PIC ? -relocation-model=pic} ' + |
110 # -force-tls-non-pic makes the code generator (llc) | 110 # -force-tls-non-pic makes the code generator (llc) |
111 # do the work that would otherwise be done by | 111 # do the work that would otherwise be done by |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 # do auto feature detection based on CPUID, but constrained by what is | 160 # do auto feature detection based on CPUID, but constrained by what is |
161 # accepted by NaCl validators. | 161 # accepted by NaCl validators. |
162 'LLC_MCPU' : '-mcpu=${LLC_MCPU_%ARCH%}', | 162 'LLC_MCPU' : '-mcpu=${LLC_MCPU_%ARCH%}', |
163 'LLC_MCPU_ARM' : 'cortex-a9', | 163 'LLC_MCPU_ARM' : 'cortex-a9', |
164 'LLC_MCPU_X8632' : 'pentium4', | 164 'LLC_MCPU_X8632' : 'pentium4', |
165 'LLC_MCPU_X8664' : 'core2', | 165 'LLC_MCPU_X8664' : 'core2', |
166 'LLC_MCPU_MIPS32' : 'mips32r2', | 166 'LLC_MCPU_MIPS32' : 'mips32r2', |
167 | 167 |
168 # Note: this is only used in the unsandboxed case | 168 # Note: this is only used in the unsandboxed case |
169 'RUN_LLC' : '${LLVM_LLC} ${LLC_FLAGS} ${LLC_MCPU} ' | 169 'RUN_LLC' : '${LLVM_LLC} ${LLC_FLAGS} ${LLC_MCPU} ' |
170 '${input} -o ${output} ' + | 170 '${input} -o ${output} ', |
171 '-metadata-text ${output}.meta', | |
172 # Rate in bits/sec to stream the bitcode from sel_universal over SRPC | 171 # Rate in bits/sec to stream the bitcode from sel_universal over SRPC |
173 # for testing. Defaults to 1Gbps (effectively unlimited). | 172 # for testing. Defaults to 1Gbps (effectively unlimited). |
174 'BITCODE_STREAM_RATE' : '1000000000', | 173 'BITCODE_STREAM_RATE' : '1000000000', |
175 } | 174 } |
176 | 175 |
177 | 176 |
178 TranslatorPatterns = [ | 177 TranslatorPatterns = [ |
179 ( '-o(.+)', "env.set('OUTPUT', pathtools.normalize($0))"), | 178 ( '-o(.+)', "env.set('OUTPUT', pathtools.normalize($0))"), |
180 ( ('-o', '(.+)'), "env.set('OUTPUT', pathtools.normalize($0))"), | 179 ( ('-o', '(.+)'), "env.set('OUTPUT', pathtools.normalize($0))"), |
181 | 180 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 env.setmany(input=infile, output=outfile, filetype=filetype) | 487 env.setmany(input=infile, output=outfile, filetype=filetype) |
489 if env.getbool('SANDBOXED'): | 488 if env.getbool('SANDBOXED'): |
490 is_shared, soname, needed = RunLLCSandboxed() | 489 is_shared, soname, needed = RunLLCSandboxed() |
491 env.pop() | 490 env.pop() |
492 # soname and dt_needed libs are returned from LLC and passed to LD | 491 # soname and dt_needed libs are returned from LLC and passed to LD |
493 driver_tools.SetBitcodeMetadata(infile, is_shared, soname, needed) | 492 driver_tools.SetBitcodeMetadata(infile, is_shared, soname, needed) |
494 else: | 493 else: |
495 driver_tools.Run("${RUN_LLC}") | 494 driver_tools.Run("${RUN_LLC}") |
496 # As a side effect, this creates a temporary file | 495 # As a side effect, this creates a temporary file |
497 if not env.getbool('SAVE_TEMPS'): | 496 if not env.getbool('SAVE_TEMPS'): |
498 TempFiles.add(outfile + '.meta') | 497 TempFiles.add(outfile + '.meta') |
jvoung (off chromium)
2013/05/14 23:48:46
Without the -meta... flag, there won't be a temp .
eliben
2013/05/15 15:40:41
Done.
| |
499 env.pop() | 498 env.pop() |
500 return 0 | 499 return 0 |
501 | 500 |
502 def RunLLCSandboxed(): | 501 def RunLLCSandboxed(): |
503 driver_tools.CheckTranslatorPrerequisites() | 502 driver_tools.CheckTranslatorPrerequisites() |
504 infile = env.getone('input') | 503 infile = env.getone('input') |
505 outfile = env.getone('output') | 504 outfile = env.getone('output') |
506 if not driver_tools.IsBitcode(infile): | 505 if not driver_tools.IsBitcode(infile): |
507 Log.Fatal('Input to sandboxed translator must be bitcode') | 506 Log.Fatal('Input to sandboxed translator must be bitcode') |
508 script = MakeSelUniversalScriptForLLC(infile, outfile) | 507 script = MakeSelUniversalScriptForLLC(infile, outfile) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 | 573 |
575 ADVANCED OPTIONS: | 574 ADVANCED OPTIONS: |
576 -mattr=<+feat1,-feat2> Toggle specific cpu features on and off. | 575 -mattr=<+feat1,-feat2> Toggle specific cpu features on and off. |
577 -mcpu=<cpu-name> Target a specific cpu type. Tunes code as well as | 576 -mcpu=<cpu-name> Target a specific cpu type. Tunes code as well as |
578 turns cpu features on and off. | 577 turns cpu features on and off. |
579 -S Generate native assembly only. | 578 -S Generate native assembly only. |
580 -c Generate native object file only. | 579 -c Generate native object file only. |
581 --pnacl-sb Use the translator which runs inside the NaCl sandbox. | 580 --pnacl-sb Use the translator which runs inside the NaCl sandbox. |
582 -O[0-3] Change translation-time optimization level. | 581 -O[0-3] Change translation-time optimization level. |
583 """ | 582 """ |
OLD | NEW |