1*058bd287Sskrll /* $NetBSD: features.c,v 1.3 2020/10/11 16:22:02 skrll Exp $ */ 299ca2752Smatt /*- 399ca2752Smatt * Copyright (c) 2014 The NetBSD Foundation, Inc. 499ca2752Smatt * All rights reserved. 599ca2752Smatt * 699ca2752Smatt * This code is derived from software contributed to The NetBSD Foundation 799ca2752Smatt * by Matt Thomas of 3am Software Foundry. 899ca2752Smatt * 999ca2752Smatt * Redistribution and use in source and binary forms, with or without 1099ca2752Smatt * modification, are permitted provided that the following conditions 1199ca2752Smatt * are met: 1299ca2752Smatt * 1. Redistributions of source code must retain the above copyright 1399ca2752Smatt * notice, this list of conditions and the following disclaimer. 1499ca2752Smatt * 2. Redistributions in binary form must reproduce the above copyright 1599ca2752Smatt * notice, this list of conditions and the following disclaimer in the 1699ca2752Smatt * documentation and/or other materials provided with the distribution. 1799ca2752Smatt * 1899ca2752Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1999ca2752Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2099ca2752Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2199ca2752Smatt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2299ca2752Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2399ca2752Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2499ca2752Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2599ca2752Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2699ca2752Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2799ca2752Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2899ca2752Smatt * POSSIBILITY OF SUCH DAMAGE. 2999ca2752Smatt */ 3099ca2752Smatt 3199ca2752Smatt /* 3299ca2752Smatt * This file is used to have the compiler check for feature and then 3399ca2752Smatt * have make set a variable based on that test. 3499ca2752Smatt * 3599ca2752Smatt * FEAT_EABI!=if ${COMPILE.c} -fsyntax-only -DEABI_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi 3699ca2752Smatt * FEAT_LDREX!=if ${COMPILE.c} -fsyntax-only -DLDREX_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi 3799ca2752Smatt * FEAT_LDRD!=if ${COMPILE.c} -fsyntax-only -DLDRD_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi 3899ca2752Smatt * FEAT_THUMB2!=if ${COMPILE.c} -fsyntax-only -DTHUMB2_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi 3999ca2752Smatt */ 4099ca2752Smatt 41*058bd287Sskrll #if defined(__ARM_ARCH_8A) || defined (__ARM_ARCH_8A__) || \ 42*058bd287Sskrll defined (__ARM_ARCH_7__) || \ 4399ca2752Smatt defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__) || \ 4499ca2752Smatt defined (__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__) || \ 4599ca2752Smatt defined (__ARM_ARCH_6T2__) 4699ca2752Smatt #define HAVE_THUMB2 4799ca2752Smatt #endif 4899ca2752Smatt 4999ca2752Smatt #if defined (HAVE_THUMB2) || defined (__ARM_ARCH_6__) || \ 5099ca2752Smatt defined (__ARM_ARCH_6J__) || defined (__ARM_ARCH_6K__) || \ 5199ca2752Smatt defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__) || \ 523dbc6e4cSjoerg defined (__ARM_ARCH_6KZ__) || defined (__ARM_ARCH_6ZM__) 5399ca2752Smatt #define HAVE_LDREX 5499ca2752Smatt #endif 5599ca2752Smatt 5699ca2752Smatt #if defined (HAVE_LDREX) || defined(__ARM_ARCH_5TE__) || \ 5799ca2752Smatt defined (__ARM_ARCH_5TEJ__) 5899ca2752Smatt #define HAVE_LDRD 5999ca2752Smatt #endif 6099ca2752Smatt 6199ca2752Smatt #if defined(THUMB2_TEST) && !defined(HAVE_THUMB2) 6299ca2752Smatt #error no thumb2 6399ca2752Smatt #endif 6499ca2752Smatt 6599ca2752Smatt #if defined(LDREX_TEST) && !defined(HAVE_LDREX) 6699ca2752Smatt #error no ldrex 6799ca2752Smatt #endif 6899ca2752Smatt 6999ca2752Smatt #if defined(LDRD_TEST) && !defined(HAVE_LDRD) 7099ca2752Smatt #error no ldrd 7199ca2752Smatt #endif 7299ca2752Smatt 7399ca2752Smatt #if defined(EABI_TEST) && !defined(__ARM_EABI__) 7499ca2752Smatt #error not eabi 7599ca2752Smatt #endif 76