OLD | NEW |
1 /* | 1 /* |
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 | 6 |
7 /* | 7 /* |
8 * This tool rewrites ELF files to replace instructions that will be | 8 * This tool rewrites ELF files to replace instructions that will be |
9 * rejected by the validator with safe HLT instructions. This is | 9 * rejected by the validator with safe HLT instructions. This is |
10 * useful if you have a large library in which many functions do not | 10 * useful if you have a large library in which many functions do not |
(...skipping 22 matching lines...) Expand all Loading... |
33 NaClCPUFeatures cpu_features; | 33 NaClCPUFeatures cpu_features; |
34 /* Pretend that the CPU supports every feature so that we will only stub out | 34 /* Pretend that the CPU supports every feature so that we will only stub out |
35 * instructions that NaCl will never allow under any condition. | 35 * instructions that NaCl will never allow under any condition. |
36 */ | 36 */ |
37 NaClSetAllCPUFeatures(&cpu_features); | 37 NaClSetAllCPUFeatures(&cpu_features); |
38 | 38 |
39 status = NACL_SUBARCH_NAME(ApplyValidator, | 39 status = NACL_SUBARCH_NAME(ApplyValidator, |
40 NACL_TARGET_ARCH, | 40 NACL_TARGET_ARCH, |
41 NACL_TARGET_SUBARCH) | 41 NACL_TARGET_SUBARCH) |
42 (sb_kind, NaClApplyValidationDoStubout, load_address, code, | 42 (sb_kind, NaClApplyValidationDoStubout, load_address, code, |
43 code_size, bundle_size, &cpu_features); | 43 code_size, bundle_size, &cpu_features, NULL); |
44 if (status == NaClValidationSucceeded) { | 44 if (status == NaClValidationSucceeded) { |
45 /* Now run the validator again, so that we report any errors | 45 /* Now run the validator again, so that we report any errors |
46 * that were not fixed by stubbing out. This is done so that | 46 * that were not fixed by stubbing out. This is done so that |
47 * the user knows that stubout doesn't fix all errors. | 47 * the user knows that stubout doesn't fix all errors. |
48 */ | 48 */ |
49 status = NACL_SUBARCH_NAME(ApplyValidatorVerbosely, | 49 status = NACL_SUBARCH_NAME(ApplyValidatorVerbosely, |
50 NACL_TARGET_ARCH, | 50 NACL_TARGET_ARCH, |
51 NACL_TARGET_SUBARCH) | 51 NACL_TARGET_SUBARCH) |
52 (sb_kind, NaClApplyCodeValidation, load_address, code, code_size, | 52 (sb_kind, NaClApplyCodeValidation, load_address, code, code_size, |
53 bundle_size, &cpu_features); | 53 bundle_size, &cpu_features); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 fprintf(stderr, "Usage: %s <input-file> -o <output-file>\n\n", argv[0]); | 202 fprintf(stderr, "Usage: %s <input-file> -o <output-file>\n\n", argv[0]); |
203 fprintf(stderr, | 203 fprintf(stderr, |
204 "This tool rewrites ELF objects to replace instructions that are\n" | 204 "This tool rewrites ELF objects to replace instructions that are\n" |
205 "rejected by the NaCl validator with safe HLT instructions.\n"); | 205 "rejected by the NaCl validator with safe HLT instructions.\n"); |
206 GioFileDtor((struct Gio*) &err); | 206 GioFileDtor((struct Gio*) &err); |
207 return 1; | 207 return 1; |
208 } | 208 } |
209 GioFileDtor((struct Gio*) &err); | 209 GioFileDtor((struct Gio*) &err); |
210 return FixUpELFFile(argv[1], argv[3]) ? 0 : 1; | 210 return FixUpELFFile(argv[1], argv[3]) ? 0 : 1; |
211 } | 211 } |
OLD | NEW |