### 15.1 The Global `targetm` Variable

— Variable: struct gcc_target targetm

> The target `.c` file must define the global `targetm` variable which contains pointers to functions and data relating to the target machine. The variable is declared in `target.h`; `target-def.h` defines the macro `TARGET_INITIALIZER` which is used to initialize the variable, and macros for the default initializers for elements of the structure. The `.c` file should override those macros for which the default definition is inappropriate. For example:

>               #include "target.h"
>               #include "target-def.h"

>               /* Initialize the GCC target structure.  */

>               #undef TARGET_COMP_TYPE_ATTRIBUTES
>               #define TARGET_COMP_TYPE_ATTRIBUTES machine_comp_type_attributes

>               struct gcc_target targetm = TARGET_INITIALIZER;

Where a macro should be defined in the `.c` file in this manner to form part of the `targetm` structure, it is documented below as a “Target Hook” with a prototype. Many macros will change in future from being defined in the `.h` file to being part of the `targetm` structure.