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 #include "native_client/src/shared/platform/nacl_log.h" | 7 #include "native_client/src/shared/platform/nacl_log.h" |
8 #include "native_client/src/trusted/validator/ncvalidate.h" | 8 #include "native_client/src/trusted/validator/ncvalidate.h" |
9 | 9 |
10 #if !defined(NACL_VALIDATOR_RAGEL) && NACL_ARCH(NACL_TARGET_ARCH) == NACL_x86 | |
11 static INLINE void EmitObsoleteValidatorWarning(void) { | |
12 NaClLog(LOG_WARNING, "USING OBSOLETE NON-DFA-BASED VALIDATOR!\n"); | |
13 } | |
14 #endif | |
15 | 10 |
16 const struct NaClValidatorInterface *NaClCreateValidator(void) { | 11 const struct NaClValidatorInterface *NaClCreateValidator(void) { |
17 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm | 12 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
18 return NaClValidatorCreateArm(); | 13 return NaClValidatorCreateArm(); |
19 #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_mips | 14 #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_mips |
20 return NaClValidatorCreateMips(); | 15 return NaClValidatorCreateMips(); |
21 #elif NACL_ARCH(NACL_TARGET_ARCH) == NACL_x86 | 16 #elif NACL_ARCH(NACL_TARGET_ARCH) == NACL_x86 |
22 # if NACL_TARGET_SUBARCH == 64 | 17 # if NACL_TARGET_SUBARCH == 64 |
23 # if defined(NACL_VALIDATOR_RAGEL) | |
24 return NaClDfaValidatorCreate_x86_64(); | 18 return NaClDfaValidatorCreate_x86_64(); |
25 # else | |
26 EmitObsoleteValidatorWarning(); | |
27 return NaClValidatorCreate_x86_64(); | |
28 # endif /* defined(NACL_VALIDATOR_RAGEL) */ | |
29 # elif NACL_TARGET_SUBARCH == 32 | 19 # elif NACL_TARGET_SUBARCH == 32 |
30 # if defined(NACL_VALIDATOR_RAGEL) | |
31 return NaClDfaValidatorCreate_x86_32(); | 20 return NaClDfaValidatorCreate_x86_32(); |
32 # else | |
33 EmitObsoleteValidatorWarning(); | |
34 return NaClValidatorCreate_x86_32(); | |
35 # endif /* defined(NACL_VALIDATOR_RAGEL) */ | |
36 # else | 21 # else |
37 # error "Invalid sub-architecture!" | 22 # error "Invalid sub-architecture!" |
38 # endif | 23 # endif |
39 #else /* NACL_x86 */ | 24 #else /* NACL_x86 */ |
40 # error "There is no validator for this architecture!" | 25 # error "There is no validator for this architecture!" |
41 #endif | 26 #endif |
42 } | 27 } |
OLD | NEW |