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 # This script is a replacement for llvm-gcc and llvm-g++ driver. | 6 # This script is a replacement for llvm-gcc and llvm-g++ driver. |
7 # It detects automatically which role it is supposed to assume. | 7 # It detects automatically which role it is supposed to assume. |
8 # The point of the script is to redirect builds through our own tools, | 8 # The point of the script is to redirect builds through our own tools, |
9 # while making these tools appear like gnu tools. | 9 # while making these tools appear like gnu tools. |
10 # | 10 # |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 if env.has('FORCE_MC'): | 586 if env.has('FORCE_MC'): |
587 env.set('MC_DIRECT', '1') | 587 env.set('MC_DIRECT', '1') |
588 env.set('USE_MC_ASM', '1') | 588 env.set('USE_MC_ASM', '1') |
589 | 589 |
590 # Only enable direct object emission for ARM | 590 # Only enable direct object emission for ARM |
591 if env.has('FORCE_MC_DIRECT'): | 591 if env.has('FORCE_MC_DIRECT'): |
592 env.set('MC_DIRECT', '1') | 592 env.set('MC_DIRECT', '1') |
593 | 593 |
594 # Copy LD flags related to stripping over to OPT to have the analogous | 594 # Copy LD flags related to stripping over to OPT to have the analogous |
595 # actions be done to the bitcode. | 595 # actions be done to the bitcode. |
596 linkflags = env.get('LD_FLAGS') | 596 linkflags = shell.split(env.get('LD_FLAGS')) |
597 if '-s' in linkflags or '--strip-all' in linkflags: | 597 if '-s' in linkflags or '--strip-all' in linkflags: |
598 env.append('OPT_FLAGS', '-strip') | 598 env.append('OPT_FLAGS', '-strip') |
599 if '-S' in linkflags or '--strip-debug' in linkflags: | 599 if '-S' in linkflags or '--strip-debug' in linkflags: |
600 env.append('OPT_FLAGS', '-strip-debug') | 600 env.append('OPT_FLAGS', '-strip-debug') |
601 | 601 |
602 if env.getbool('SHARED'): | 602 if env.getbool('SHARED'): |
603 env.append('LD_FLAGS', '-shared') | 603 env.append('LD_FLAGS', '-shared') |
604 env.clear('STDLIB_BC_PREFIX') | 604 env.clear('STDLIB_BC_PREFIX') |
605 env.clear('STDLIB_BC_SUFFIX') | 605 env.clear('STDLIB_BC_SUFFIX') |
606 env.clear('STDLIB_NATIVE_PREFIX') | 606 env.clear('STDLIB_NATIVE_PREFIX') |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1946 signal.signal(signal.SIGINT, signal_handler) | 1946 signal.signal(signal.SIGINT, signal_handler) |
1947 signal.signal(signal.SIGHUP, signal_handler) | 1947 signal.signal(signal.SIGHUP, signal_handler) |
1948 signal.signal(signal.SIGTERM, signal_handler) | 1948 signal.signal(signal.SIGTERM, signal_handler) |
1949 | 1949 |
1950 def RunWithLog(args, stdin = None, silent = False, errexit = True): | 1950 def RunWithLog(args, stdin = None, silent = False, errexit = True): |
1951 "Run the commandline give by the list args system()-style" | 1951 "Run the commandline give by the list args system()-style" |
1952 | 1952 |
1953 if isinstance(args, str): | 1953 if isinstance(args, str): |
1954 args = shell.split(env.eval(args)) | 1954 args = shell.split(env.eval(args)) |
1955 | 1955 |
| 1956 Log.Info('\n' + StringifyCommand(args, stdin)) |
| 1957 |
1956 if env.getbool('DRY_RUN'): | 1958 if env.getbool('DRY_RUN'): |
1957 return | 1959 return |
1958 | 1960 |
1959 Log.Info('\n' + StringifyCommand(args, stdin)) | |
1960 try: | 1961 try: |
1961 p = subprocess.Popen(args, stdin=subprocess.PIPE, | 1962 p = subprocess.Popen(args, stdin=subprocess.PIPE, |
1962 stdout=subprocess.PIPE, | 1963 stdout=subprocess.PIPE, |
1963 stderr=subprocess.PIPE ) | 1964 stderr=subprocess.PIPE ) |
1964 CleanupProcesses.append(p) | 1965 CleanupProcesses.append(p) |
1965 buf_stdout, buf_stderr = p.communicate(input = stdin) | 1966 buf_stdout, buf_stderr = p.communicate(input = stdin) |
1966 CleanupProcesses.pop() | 1967 CleanupProcesses.pop() |
1967 ret = p.returncode | 1968 ret = p.returncode |
1968 except SystemExit, e: | 1969 except SystemExit, e: |
1969 raise e | 1970 raise e |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2182 fp.close() | 2183 fp.close() |
2183 | 2184 |
2184 ###################################################################### | 2185 ###################################################################### |
2185 # Invocation | 2186 # Invocation |
2186 ###################################################################### | 2187 ###################################################################### |
2187 | 2188 |
2188 if __name__ == "__main__": | 2189 if __name__ == "__main__": |
2189 # uncomment to force noisy output | 2190 # uncomment to force noisy output |
2190 # sys.argv = [sys.argv[0], '--pnacl-driver-verbose'] + sys.argv[1:] | 2191 # sys.argv = [sys.argv[0], '--pnacl-driver-verbose'] + sys.argv[1:] |
2191 NiceExit(main(sys.argv)) | 2192 NiceExit(main(sys.argv)) |
OLD | NEW |