| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 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 # % tools/llvm/utman.sh driver | 7 # % tools/llvm/utman.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 27 matching lines...) Expand all Loading... |
| 38 # This is used during pso -> so translation to set the | 38 # This is used during pso -> so translation to set the |
| 39 # correct dependencies on the generated ELF file. | 39 # correct dependencies on the generated ELF file. |
| 40 'LIBDEPS' : '', | 40 'LIBDEPS' : '', |
| 41 | 41 |
| 42 'SHARED' : '0', | 42 'SHARED' : '0', |
| 43 'STATIC' : '0', | 43 'STATIC' : '0', |
| 44 'PIC' : '0', | 44 'PIC' : '0', |
| 45 'STDLIB' : '1', | 45 'STDLIB' : '1', |
| 46 'RELOCATABLE': '0', | 46 'RELOCATABLE': '0', |
| 47 | 47 |
| 48 'BAREBONES_LINK' : '0', | |
| 49 | |
| 50 'STRIP_MODE' : 'none', | 48 'STRIP_MODE' : 'none', |
| 51 | 49 |
| 52 'STRIP_FLAGS' : '${STRIP_FLAGS_%STRIP_MODE%}', | 50 'STRIP_FLAGS' : '${STRIP_FLAGS_%STRIP_MODE%}', |
| 53 'STRIP_FLAGS_all' : '-s', | 51 'STRIP_FLAGS_all' : '-s', |
| 54 'STRIP_FLAGS_debug': '-S', | 52 'STRIP_FLAGS_debug': '-S', |
| 55 | 53 |
| 56 'PNACL_TRANSLATE_FLAGS': '${PIC ? -fPIC}', | 54 'PNACL_TRANSLATE_FLAGS': '${PIC ? -fPIC}', |
| 57 | 55 |
| 58 'OPT_FLAGS': '-O${OPT_LEVEL} ${OPT_STRIP_%STRIP_MODE%} ' + | 56 'OPT_FLAGS': '-O${OPT_LEVEL} ${OPT_STRIP_%STRIP_MODE%} ' + |
| 59 '-inline-threshold=${OPT_INLINE_THRESHOLD}', | 57 '-inline-threshold=${OPT_INLINE_THRESHOLD}', |
| 60 'OPT_INLINE_THRESHOLD': '100', | 58 'OPT_INLINE_THRESHOLD': '100', |
| 61 'OPT_LEVEL': '0', | 59 'OPT_LEVEL': '0', |
| 62 'OPT_STRIP_none': '', | 60 'OPT_STRIP_none': '', |
| 63 'OPT_STRIP_all': '-disable-opt --strip', | 61 'OPT_STRIP_all': '-disable-opt --strip', |
| 64 'OPT_STRIP_debug': '-disable-opt --strip-debug', | 62 'OPT_STRIP_debug': '-disable-opt --strip-debug', |
| 65 | 63 |
| 66 # Sandboxed LD is always BFD. | 64 # Sandboxed LD is always BFD. |
| 67 'LD' : '${SANDBOXED ? ${LD_SB} ${LD_BFD_FLAGS} ' + | 65 'LD' : '${SANDBOXED ? ${LD_SB} ${LD_BFD_FLAGS} ' + |
| 68 ' : ${LD_%WHICH_LD%} ${LD_%WHICH_LD%_FLAGS}}', | 66 ' : ${LD_%WHICH_LD%} ${LD_%WHICH_LD%_FLAGS}}', |
| 69 | 67 |
| 70 'LD_BFD_FLAGS': '-m ${LD_EMUL} ${#LD_SCRIPT ? -T ${LD_SCRIPT}}', | 68 'LD_BFD_FLAGS': '-m ${LD_EMUL} ${#LD_SCRIPT ? -T ${LD_SCRIPT}}', |
| 71 | 69 |
| 72 'LD_GOLD_FLAGS': '--native-client --oformat ${LD_GOLD_OFORMAT} ' + | 70 'LD_GOLD_FLAGS': '--native-client --oformat ${LD_GOLD_OFORMAT} ' + |
| 73 '${#LD_SCRIPT ? -T ${LD_SCRIPT} : -Ttext=0x20000}', | 71 '${#LD_SCRIPT ? -T ${LD_SCRIPT} : -Ttext=0x20000}', |
| 74 | 72 |
| 75 'GOLD_PLUGIN_ARGS': '-plugin=${GOLD_PLUGIN_SO} ' + | 73 'GOLD_PLUGIN_ARGS': '-plugin=${GOLD_PLUGIN_SO} ' + |
| 76 '-plugin-opt=emit-llvm ' + | 74 '-plugin-opt=emit-llvm', |
| 77 '${LIBMODE_NEWLIB && !BAREBONES_LINK ? ' + | |
| 78 '-plugin-opt=-add-nacl-read-tp-dependency ' + | |
| 79 '-plugin-opt=-add-libgcc-dependencies}', | |
| 80 | 75 |
| 81 # Symbols to wrap | 76 # Symbols to wrap |
| 82 'WRAP_SYMBOLS': '', | 77 'WRAP_SYMBOLS': '', |
| 83 | 78 |
| 84 # Common to both GOLD and BFD. | 79 # Common to both GOLD and BFD. |
| 85 'LD_FLAGS' : '-nostdlib ${@AddPrefix:-L:SEARCH_DIRS} ' + | 80 'LD_FLAGS' : '-nostdlib ${@AddPrefix:-L:SEARCH_DIRS} ' + |
| 86 '${SHARED ? -shared} ${STATIC ? -static} ' + | 81 '${SHARED ? -shared} ${STATIC ? -static} ' + |
| 87 '${RELOCATABLE ? -relocatable} ' + | 82 '${RELOCATABLE ? -relocatable} ' + |
| 88 '${LIBMODE_GLIBC && ' + | 83 '${LIBMODE_GLIBC && ' + |
| 89 '!STATIC ? ${@AddPrefix:-rpath-link=:SEARCH_DIRS}}', | 84 '!STATIC ? ${@AddPrefix:-rpath-link=:SEARCH_DIRS}}', |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 ( '--pnacl-add-libdep=(.+)', "env.append('LIBDEPS', $0)"), | 154 ( '--pnacl-add-libdep=(.+)', "env.append('LIBDEPS', $0)"), |
| 160 ( ('--add-translate-option=(.+)'), | 155 ( ('--add-translate-option=(.+)'), |
| 161 "env.append('PNACL_TRANSLATE_FLAGS', $0)"), | 156 "env.append('PNACL_TRANSLATE_FLAGS', $0)"), |
| 162 # todo(dschuff): get rid of this when we get closer to tip and fix bug 1941 | 157 # todo(dschuff): get rid of this when we get closer to tip and fix bug 1941 |
| 163 ( ('--add-opt-option=(.+)'), | 158 ( ('--add-opt-option=(.+)'), |
| 164 "env.append('OPT_FLAGS', $0)"), | 159 "env.append('OPT_FLAGS', $0)"), |
| 165 | 160 |
| 166 ( '-o(.+)', "env.set('OUTPUT', pathtools.normalize($0))"), | 161 ( '-o(.+)', "env.set('OUTPUT', pathtools.normalize($0))"), |
| 167 ( ('-o', '(.+)'), "env.set('OUTPUT', pathtools.normalize($0))"), | 162 ( ('-o', '(.+)'), "env.set('OUTPUT', pathtools.normalize($0))"), |
| 168 | 163 |
| 169 ( '-barebones-link', "env.set('BAREBONES_LINK', '1')"), | |
| 170 | |
| 171 ( '-shared', "env.set('SHARED', '1')"), | 164 ( '-shared', "env.set('SHARED', '1')"), |
| 172 | 165 |
| 173 ( '-static', "env.set('STATIC', '1')\n" | 166 ( '-static', "env.set('STATIC', '1')\n" |
| 174 "env.set('SHARED', '0')"), | 167 "env.set('SHARED', '0')"), |
| 175 ( '-nostdlib', "env.set('STDLIB', '0')"), | 168 ( '-nostdlib', "env.set('STDLIB', '0')"), |
| 176 | 169 |
| 177 ( '-r', "env.set('RELOCATABLE', '1')"), | 170 ( '-r', "env.set('RELOCATABLE', '1')"), |
| 178 ( '-relocatable', "env.set('RELOCATABLE', '1')"), | 171 ( '-relocatable', "env.set('RELOCATABLE', '1')"), |
| 179 | 172 |
| 180 ( ('-L', '(.+)'), | 173 ( ('-L', '(.+)'), |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 ] | 246 ] |
| 254 | 247 |
| 255 | 248 |
| 256 def main(argv): | 249 def main(argv): |
| 257 ParseArgs(argv, LDPatterns) | 250 ParseArgs(argv, LDPatterns) |
| 258 | 251 |
| 259 if env.getbool('RELOCATABLE'): | 252 if env.getbool('RELOCATABLE'): |
| 260 if env.getbool('SHARED'): | 253 if env.getbool('SHARED'): |
| 261 Log.Fatal("-r and -shared may not be used together") | 254 Log.Fatal("-r and -shared may not be used together") |
| 262 env.set('STATIC', '0') | 255 env.set('STATIC', '0') |
| 263 env.set('BAREBONES_LINK', '1') | |
| 264 | 256 |
| 265 if env.getbool('LIBMODE_NEWLIB'): | 257 if env.getbool('LIBMODE_NEWLIB'): |
| 266 if env.getbool('SHARED'): | 258 if env.getbool('SHARED'): |
| 267 Log.Fatal("Cannot generate shared objects with newlib-based toolchain") | 259 Log.Fatal("Cannot generate shared objects with newlib-based toolchain") |
| 268 env.set('STATIC', '1') | 260 env.set('STATIC', '1') |
| 269 | 261 |
| 270 inputs = env.get('INPUTS') | 262 inputs = env.get('INPUTS') |
| 271 output = env.getone('OUTPUT') | 263 output = env.getone('OUTPUT') |
| 272 | 264 |
| 273 if output == '': | 265 if output == '': |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 if IsFlag(f): | 866 if IsFlag(f): |
| 875 continue | 867 continue |
| 876 else: | 868 else: |
| 877 if not pathtools.exists(f): | 869 if not pathtools.exists(f): |
| 878 Log.Fatal("Unable to open '%s'", pathtools.touser(f)) | 870 Log.Fatal("Unable to open '%s'", pathtools.touser(f)) |
| 879 ret.append(f) | 871 ret.append(f) |
| 880 return ret | 872 return ret |
| 881 | 873 |
| 882 if __name__ == "__main__": | 874 if __name__ == "__main__": |
| 883 DriverMain(main) | 875 DriverMain(main) |
| OLD | NEW |