1  /* Types shared between arm and aarch64.
       2  
       3     Copyright (C) 2009-2021 Free Software Foundation, Inc.
       4     Contributed by Arm Ltd.
       5  
       6     This file is part of GCC.
       7  
       8     GCC is free software; you can redistribute it and/or modify it
       9     under the terms of the GNU General Public License as published
      10     by the Free Software Foundation; either version 3, or (at your
      11     option) any later version.
      12  
      13     GCC is distributed in the hope that it will be useful, but WITHOUT
      14     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
      15     or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
      16     License for more details.
      17  
      18     You should have received a copy of the GNU General Public License
      19     along with GCC; see the file COPYING3.  If not see
      20     <http://www.gnu.org/licenses/>.  */
      21  
      22  #ifndef GCC_AARCH_COMMON_H
      23  #define GCC_AARCH_COMMON_H
      24  
      25  /* Enum describing the various ways that the
      26     aarch*_parse_{arch,tune,cpu,extension} functions can fail.
      27     This way their callers can choose what kind of error to give.  */
      28  
      29  enum aarch_parse_opt_result
      30  {
      31    AARCH_PARSE_OK,			/* Parsing was successful.  */
      32    AARCH_PARSE_MISSING_ARG,		/* Missing argument.  */
      33    AARCH_PARSE_INVALID_FEATURE,		/* Invalid feature modifier.  */
      34    AARCH_PARSE_INVALID_ARG		/* Invalid arch, tune, cpu arg.  */
      35  };
      36  
      37  /* Function types -msign-return-address should sign.  */
      38  enum aarch_function_type {
      39    /* Don't sign any function.  */
      40    AARCH_FUNCTION_NONE,
      41    /* Non-leaf functions.  */
      42    AARCH_FUNCTION_NON_LEAF,
      43    /* All functions.  */
      44    AARCH_FUNCTION_ALL
      45  };
      46  
      47  /* The key type that -msign-return-address should use.  */
      48  enum aarch_key_type {
      49    AARCH_KEY_A,
      50    AARCH_KEY_B
      51  };
      52  
      53  struct aarch_branch_protect_type
      54  {
      55    /* The type's name that the user passes to the branch-protection option
      56       string.  */
      57    const char* name;
      58    /* Function to handle the protection type and set global variables.
      59       First argument is the string token corresponding with this type and the
      60       second argument is the next token in the option string.
      61       Return values:
      62       * AARCH_PARSE_OK: Handling was sucessful.
      63       * AARCH_INVALID_ARG: The type is invalid in this context and the caller
      64       should print an error.
      65       * AARCH_INVALID_FEATURE: The type is invalid and the handler prints its
      66       own error.  */
      67    enum aarch_parse_opt_result (*handler)(char*, char*);
      68    /* A list of types that can follow this type in the option string.  */
      69    const struct aarch_branch_protect_type* subtypes;
      70    unsigned int num_subtypes;
      71  };
      72  
      73  #endif /* GCC_AARCH_COMMON_H */