1 1.3 skrll /* $NetBSD: features.c,v 1.3 2020/10/11 16:22:02 skrll Exp $ */ 2 1.1 matt /*- 3 1.1 matt * Copyright (c) 2014 The NetBSD Foundation, Inc. 4 1.1 matt * All rights reserved. 5 1.1 matt * 6 1.1 matt * This code is derived from software contributed to The NetBSD Foundation 7 1.1 matt * by Matt Thomas of 3am Software Foundry. 8 1.1 matt * 9 1.1 matt * Redistribution and use in source and binary forms, with or without 10 1.1 matt * modification, are permitted provided that the following conditions 11 1.1 matt * are met: 12 1.1 matt * 1. Redistributions of source code must retain the above copyright 13 1.1 matt * notice, this list of conditions and the following disclaimer. 14 1.1 matt * 2. Redistributions in binary form must reproduce the above copyright 15 1.1 matt * notice, this list of conditions and the following disclaimer in the 16 1.1 matt * documentation and/or other materials provided with the distribution. 17 1.1 matt * 18 1.1 matt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 1.1 matt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 1.1 matt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 1.1 matt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 1.1 matt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 1.1 matt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 1.1 matt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 1.1 matt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 1.1 matt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 1.1 matt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 1.1 matt * POSSIBILITY OF SUCH DAMAGE. 29 1.1 matt */ 30 1.1 matt 31 1.1 matt /* 32 1.1 matt * This file is used to have the compiler check for feature and then 33 1.1 matt * have make set a variable based on that test. 34 1.1 matt * 35 1.1 matt * FEAT_EABI!=if ${COMPILE.c} -fsyntax-only -DEABI_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi 36 1.1 matt * FEAT_LDREX!=if ${COMPILE.c} -fsyntax-only -DLDREX_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi 37 1.1 matt * FEAT_LDRD!=if ${COMPILE.c} -fsyntax-only -DLDRD_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi 38 1.1 matt * FEAT_THUMB2!=if ${COMPILE.c} -fsyntax-only -DTHUMB2_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi 39 1.1 matt */ 40 1.1 matt 41 1.3 skrll #if defined(__ARM_ARCH_8A) || defined (__ARM_ARCH_8A__) || \ 42 1.3 skrll defined (__ARM_ARCH_7__) || \ 43 1.1 matt defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__) || \ 44 1.1 matt defined (__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__) || \ 45 1.1 matt defined (__ARM_ARCH_6T2__) 46 1.1 matt #define HAVE_THUMB2 47 1.1 matt #endif 48 1.1 matt 49 1.1 matt #if defined (HAVE_THUMB2) || defined (__ARM_ARCH_6__) || \ 50 1.1 matt defined (__ARM_ARCH_6J__) || defined (__ARM_ARCH_6K__) || \ 51 1.1 matt defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__) || \ 52 1.2 joerg defined (__ARM_ARCH_6KZ__) || defined (__ARM_ARCH_6ZM__) 53 1.1 matt #define HAVE_LDREX 54 1.1 matt #endif 55 1.1 matt 56 1.1 matt #if defined (HAVE_LDREX) || defined(__ARM_ARCH_5TE__) || \ 57 1.1 matt defined (__ARM_ARCH_5TEJ__) 58 1.1 matt #define HAVE_LDRD 59 1.1 matt #endif 60 1.1 matt 61 1.1 matt #if defined(THUMB2_TEST) && !defined(HAVE_THUMB2) 62 1.1 matt #error no thumb2 63 1.1 matt #endif 64 1.1 matt 65 1.1 matt #if defined(LDREX_TEST) && !defined(HAVE_LDREX) 66 1.1 matt #error no ldrex 67 1.1 matt #endif 68 1.1 matt 69 1.1 matt #if defined(LDRD_TEST) && !defined(HAVE_LDRD) 70 1.1 matt #error no ldrd 71 1.1 matt #endif 72 1.1 matt 73 1.1 matt #if defined(EABI_TEST) && !defined(__ARM_EABI__) 74 1.1 matt #error not eabi 75 1.1 matt #endif 76