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 "native_client/src/shared/platform/nacl_log.h"
8 : #include "native_client/src/trusted/validator/ncvalidate.h"
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 :
16 : const struct NaClValidatorInterface *NaClCreateValidator(void) {
17 : #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm
18 : return NaClValidatorCreateArm();
19 : #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_mips
20 : return NaClValidatorCreateMips();
21 : #elif NACL_ARCH(NACL_TARGET_ARCH) == NACL_x86
22 : # if NACL_TARGET_SUBARCH == 64
23 : # if defined(NACL_VALIDATOR_RAGEL)
24 305 : 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
30 : # if defined(NACL_VALIDATOR_RAGEL)
31 : return NaClDfaValidatorCreate_x86_32();
32 : # else
33 : EmitObsoleteValidatorWarning();
34 : return NaClValidatorCreate_x86_32();
35 : # endif /* defined(NACL_VALIDATOR_RAGEL) */
36 : # else
37 : # error "Invalid sub-architecture!"
38 : # endif
39 : #else /* NACL_x86 */
40 : # error "There is no validator for this architecture!"
41 : #endif
42 : }
|