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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 'ISYSTEM_CXX_include_paths' : | 116 'ISYSTEM_CXX_include_paths' : |
117 '${BASE_USR}/include/c++/${STDLIB_IDIR} ' + | 117 '${BASE_USR}/include/c++/${STDLIB_IDIR} ' + |
118 '${BASE_USR}/include/c++/${STDLIB_IDIR}/arm-none-linux-gnueabi ' + | 118 '${BASE_USR}/include/c++/${STDLIB_IDIR}/arm-none-linux-gnueabi ' + |
119 '${BASE_USR}/include/c++/${STDLIB_IDIR}/backward', | 119 '${BASE_USR}/include/c++/${STDLIB_IDIR}/backward', |
120 | 120 |
121 | 121 |
122 # Only propagate opt level to linker if explicitly set, so that the | 122 # Only propagate opt level to linker if explicitly set, so that the |
123 # linker will know if an opt level was explicitly set or not. | 123 # linker will know if an opt level was explicitly set or not. |
124 'LD_FLAGS' : '${#OPT_LEVEL ? -O${OPT_LEVEL}} -static ' + | 124 'LD_FLAGS' : '${#OPT_LEVEL ? -O${OPT_LEVEL}} -static ' + |
125 '${PIC ? -fPIC} ${@AddPrefix:-L:SEARCH_DIRS} ' + | 125 '${PIC ? -fPIC} ${@AddPrefix:-L:SEARCH_DIRS} ' + |
126 '${ALLOW_NATIVE ? -L${LIBS_NATIVE_ARCH}} ' + | |
Mark Seaborn
2014/08/09 07:11:51
Might an alternative be to do this below:
if env.
Derek Schuff
2014/08/11 17:54:17
Done.
| |
126 '--pnacl-exceptions=${CXX_EH_MODE}', | 127 '--pnacl-exceptions=${CXX_EH_MODE}', |
127 | 128 |
128 'SEARCH_DIRS' : '', # Directories specified using -L | 129 'SEARCH_DIRS' : '', # Directories specified using -L |
129 | 130 |
130 # Library Strings | 131 # Library Strings |
131 'EMITMODE' : '${!USE_STDLIB ? nostdlib : static}', | 132 'EMITMODE' : '${!USE_STDLIB ? nostdlib : static}', |
132 | 133 |
133 # This is setup so that LD_ARGS_xxx is evaluated lazily. | 134 # This is setup so that LD_ARGS_xxx is evaluated lazily. |
134 'LD_ARGS' : '${LD_ARGS_%EMITMODE%}', | 135 'LD_ARGS' : '${LD_ARGS_%EMITMODE%}', |
135 | 136 |
136 # ${ld_inputs} signifies where to place the objects and libraries | 137 # ${ld_inputs} signifies where to place the objects and libraries |
137 # provided on the command-line. | 138 # provided on the command-line. |
138 'LD_ARGS_nostdlib': '-nostdlib ${ld_inputs}', | 139 'LD_ARGS_nostdlib': '-nostdlib ${ld_inputs}', |
139 | 140 |
140 'LD_ARGS_static': | 141 'LD_ARGS_static': |
141 '${CXX_EH_MODE==zerocost ? -l:crt1_for_eh.x : -l:crt1.x} ' + | 142 '${CXX_EH_MODE==zerocost ? -l:crt1_for_eh.x : -l:crt1.x} ' + |
142 '-l:crti.bc -l:crtbegin.bc ' | 143 '-l:crti.bc -l:crtbegin.bc ' |
143 '${CXX_EH_MODE==sjlj ? -l:sjlj_eh_redirect.bc : ' | 144 '${CXX_EH_MODE==sjlj ? -l:sjlj_eh_redirect.bc : ' |
144 '${CXX_EH_MODE==none ? -l:unwind_stubs.bc}} ' + | 145 '${CXX_EH_MODE==none ? -l:unwind_stubs.bc}} ' + |
145 '${ld_inputs} ' + | 146 '${ld_inputs} ' + |
146 '--start-group ${STDLIBS} --end-group', | 147 '--start-group ${STDLIBS} --end-group', |
147 | 148 |
148 'LLVM_PASSES_TO_DISABLE': '', | 149 'LLVM_PASSES_TO_DISABLE': '', |
149 | 150 |
150 # Flags for translating to native .o files. | 151 # Flags for translating to native .o files. |
151 'TRANSLATE_FLAGS' : '-O${#OPT_LEVEL ? ${OPT_LEVEL} : 0}', | 152 'TRANSLATE_FLAGS' : '-O${#OPT_LEVEL ? ${OPT_LEVEL} : 0}', |
152 | 153 |
153 'STDLIBS' : '${DEFAULTLIBS ? ' | 154 'STDLIBS' : '${DEFAULTLIBS ? ' |
154 '${LIBSTDCPP} ${LIBPTHREAD} ${LIBNACL} ${LIBC} ${LIBPNACLMM}}', | 155 '${LIBSTDCPP} ${LIBPTHREAD} ${LIBNACL} ${LIBC} ${LIBPNACLMM} ' |
156 '${ALLOW_NATIVE ? ${NATIVELIBS}}}', | |
155 'LIBSTDCPP' : '${IS_CXX ? -l${STDLIB_TRUNC} -lm }', | 157 'LIBSTDCPP' : '${IS_CXX ? -l${STDLIB_TRUNC} -lm }', |
156 'LIBC' : '-lc', | 158 'LIBC' : '-lc', |
157 'LIBNACL' : '-lnacl', | 159 'LIBNACL' : '-lnacl', |
158 'LIBPNACLMM': '-lpnaclmm', | 160 'LIBPNACLMM': '-lpnaclmm', |
159 # Enabled/disabled by -pthreads | 161 # Enabled/disabled by -pthreads |
160 'LIBPTHREAD': '${PTHREAD ? -lpthread}', | 162 'LIBPTHREAD': '${PTHREAD ? -lpthread}', |
163 # For native/mixed links, also bring in the native libgcc to avoid link | |
164 # failure if pre-translated native code needs functions from it. | |
165 'NATIVELIBS': '-lgcc', | |
161 | 166 |
162 # IS_CXX is set by pnacl-clang and pnacl-clang++ programmatically | 167 # IS_CXX is set by pnacl-clang and pnacl-clang++ programmatically |
163 'CC' : '${IS_CXX ? ${CLANGXX} : ${CLANG}}', | 168 'CC' : '${IS_CXX ? ${CLANGXX} : ${CLANG}}', |
164 'RUN_CC': '${CC} -emit-llvm ${mode} ${CC_FLAGS} ' + | 169 'RUN_CC': '${CC} -emit-llvm ${mode} ${CC_FLAGS} ' + |
165 '${@AddPrefix:-isystem :ISYSTEM} ' + | 170 '${@AddPrefix:-isystem :ISYSTEM} ' + |
166 '-x${typespec} "${infile}" -o ${output}', | 171 '-x${typespec} "${infile}" -o ${output}', |
167 } | 172 } |
168 | 173 |
169 def AddLLVMPassDisableFlag(*args): | 174 def AddLLVMPassDisableFlag(*args): |
170 env.append('LLVM_PASSES_TO_DISABLE', *args) | 175 env.append('LLVM_PASSES_TO_DISABLE', *args) |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 Run(env.get('CC') + env.get('CC_FLAGS')) | 495 Run(env.get('CC') + env.get('CC_FLAGS')) |
491 return 0 | 496 return 0 |
492 | 497 |
493 unmatched = env.get('UNMATCHED') | 498 unmatched = env.get('UNMATCHED') |
494 if len(unmatched) > 0: | 499 if len(unmatched) > 0: |
495 UnrecognizedOption(*unmatched) | 500 UnrecognizedOption(*unmatched) |
496 | 501 |
497 # If -arch was given, we are compiling directly to native code | 502 # If -arch was given, we are compiling directly to native code |
498 compiling_to_native = GetArch() is not None | 503 compiling_to_native = GetArch() is not None |
499 | 504 |
500 if env.getbool('ALLOW_NATIVE') and not compiling_to_native: | 505 if env.getbool('ALLOW_NATIVE') and not compiling_to_native: |
Mark Seaborn
2014/08/09 07:11:51
e.g. somewhere around here
Derek Schuff
2014/08/11 17:54:17
Done.
| |
501 Log.Fatal("--pnacl-allow-native without -arch is not meaningful.") | 506 Log.Fatal("--pnacl-allow-native without -arch is not meaningful.") |
502 | 507 |
503 if not env.get('STDLIB'): | 508 if not env.get('STDLIB'): |
504 # Default C++ Standard Library. | 509 # Default C++ Standard Library. |
505 SetStdLib('libc++') | 510 SetStdLib('libc++') |
506 | 511 |
507 inputs = env.get('INPUTS') | 512 inputs = env.get('INPUTS') |
508 output = env.getone('OUTPUT') | 513 output = env.getone('OUTPUT') |
509 | 514 |
510 if len(inputs) == 0: | 515 if len(inputs) == 0: |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
784 -g Generate complete debug information. | 789 -g Generate complete debug information. |
785 -gline-tables-only Generate debug line-information only | 790 -gline-tables-only Generate debug line-information only |
786 (allowing for stack traces). | 791 (allowing for stack traces). |
787 -flimit-debug-info Generate limited debug information. | 792 -flimit-debug-info Generate limited debug information. |
788 -save-temps Keep intermediate compilation results. | 793 -save-temps Keep intermediate compilation results. |
789 -v Verbose output / show commands. | 794 -v Verbose output / show commands. |
790 -h | --help Show this help. | 795 -h | --help Show this help. |
791 --help-full Show underlying clang driver's help message | 796 --help-full Show underlying clang driver's help message |
792 (warning: not all options supported). | 797 (warning: not all options supported). |
793 """ % (tool) | 798 """ % (tool) |
OLD | NEW |