Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 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 | |
| 4 * found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 #include <stdio.h> | |
| 8 #include <stdlib.h> | |
| 9 | |
| 10 #include "native_client/src/trusted/validator/ncvalidate.h" | |
| 11 | |
| 12 int NaClUseDfaValidator() { | |
| 13 if (getenv("NACL_DANGEROUS_USE_DFA_VALIDATOR") != NULL) { | |
| 14 return 1; | |
| 15 } | |
| 16 return 0; | |
| 17 } | |
| 18 | |
| 19 const struct NaClValidatorInterface* NaClCreateValidator() { | |
| 20 #if defined(__arm__) | |
| 21 return NaClValidatorCreateArm(); | |
| 22 #elif NACL_ARCH(NACL_TARGET_ARCH) != NACL_x86 | |
| 23 #error("No validator available for this architecture!") | |
| 24 #elif NACL_TARGET_SUBARCH == 32 && defined(NACL_STANDALONE) | |
|
Nick Bray
2012/05/22 23:46:31
I don't like splitting the ARCH/SUBARCH check - it
pasko-google - do not use
2012/05/23 14:28:11
huh, that was funny. The macro __i386__ is not def
Nick Bray
2012/05/24 01:17:15
OK, I see why you split the ARCH from the SUBARCH
pasko-google - do not use
2012/05/24 10:16:57
When writing I thought you'd like this because it
| |
| 25 if (NaClUseDfaValidator()) { | |
| 26 fprintf(stderr, "DANGER! USING THE EXPERIMENTAL DFA VALIDATOR!\n"); | |
| 27 return NaClDfaValidatorCreate_x86_32(); | |
| 28 } else { | |
| 29 return NaClValidatorCreate_x86_32(); | |
| 30 } | |
| 31 #elif NACL_TARGET_SUBARCH == 32 | |
| 32 return NaClValidatorCreate_x86_32(); | |
| 33 #elif NACL_TARGET_SUBARCH == 64 && defined(NACL_STANDALONE) | |
| 34 if (NaClUseDfaValidator()) { | |
| 35 fprintf(stderr, "DANGER! USING THE EXPERIMENTAL DFA VALIDATOR!\n"); | |
| 36 return NaClDfaValidatorCreate_x86_64(); | |
| 37 } else { | |
| 38 return NaClValidatorCreate_x86_64(); | |
| 39 } | |
| 40 #elif NACL_TARGET_SUBARCH == 64 | |
| 41 return NaClValidatorCreate_x86_64(); | |
| 42 #endif | |
| 43 } | |
| OLD | NEW |