1/* Copyright (C) 2021 Free Software Foundation, Inc. 2 Contributed by Oracle. 3 4 This file is part of GNU Binutils. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3, or (at your option) 9 any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, 51 Franklin Street - Fifth Floor, Boston, 19 MA 02110-1301, USA. */ 20 21#ifndef _GP_DEFS_H_ 22#define _GP_DEFS_H_ 23 24/* Define the ARCH and WSIZE predicates */ 25/* 26 * The way we define and use predicates is similar to the 27 * standard #assert with one important exception: 28 * if an argument of a predicate is not known the result 29 * is 'false' and we want a compile time error to avoid 30 * silent results from typos like ARCH(INTEL), COMPILER(gnu), 31 * etc. 32 */ 33#define ARCH(x) TOK_A_##x(ARCH) 34#define TOK_A_Aarch64(x) x##_Aarch64 35#define TOK_A_SPARC(x) x##_SPARC 36#define TOK_A_Intel(x) x##_Intel 37 38#define WSIZE(x) TOK_W_##x(WSIZE) 39#define TOK_W_32(x) x##_32 40#define TOK_W_64(x) x##_64 41 42#if defined(sparc) || defined(__sparcv9) 43#define ARCH_SPARC 1 44#elif defined(__i386__) || defined(__x86_64) 45#define ARCH_Intel 1 46#elif defined(__aarch64__) 47#define ARCH_Aarch64 1 48#else 49#error "Undefined platform" 50#endif 51 52#if defined(__sparcv9) || defined(__x86_64) || defined(__aarch64__) 53#define WSIZE_64 1 54#else 55#define WSIZE_32 1 56#endif 57 58#ifndef ATTRIBUTE_FALLTHROUGH 59# if (GCC_VERSION >= 7000) 60# define ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) 61# else 62# define ATTRIBUTE_FALLTHROUGH /* Fall through */ 63# endif 64#endif 65 66#endif 67