-mtocdata
Purpose
Applies TOC data transformation to suitable variables with static storage duration, including static data members of classes and block-scope static variables. The TOC data transformation results in placing the variables in the TOC, enabling them to be accessed directly from functions within the same load module.
Syntax
Defaults
-mno-tocdata
Parameters
- variable_name
- The name of a variable for the compiler to consider whether or not to apply the TOC data
transformation to, depending on the option specified.
Names must be specified using their mangled names. To obtain C++ mangled names, compile your source to object files only using the -c compiler option, and then use the nm operating system command on the resulting object file. Alternatively, you can use the ibm-llvm-cxxfilt utility provided by the compiler for a side-by-side listing of source names and mangled names.
Usage
- Have complete types.
- Be at most as large as a pointer.
- Not be aligned more strictly than a pointer.
- Not be structures that contain flexible array members.
- Not have internal linkage.
- Not have aliases.
- Not have section attributes.
If you need to exclude multiple variables from the TOC data transformation, you can place them in a file and specify this file using the -mno-tocdata-file=<importfile> option instead of listing all variables separated by commas with -mno-tocdata. The format of this file is the same as the format used in the import file for the ld command. The -mno-tocdata-file=<importfile> option is available starting from IBM® Open XL C/C++ for AIX® 17.1.2.5.
- If the TOC data transformation is applied to a variable whose definition is imported, the linker generates fix-up code to read or write the variable.
- If internal linkage variables are specified with -mtocdata or -mno-tocdata, the option specification is ignored.
- If you specify -mtocdata or -mno-tocdata with no variables, the last specified option wins. If you specify the same variable name in multiple options, the last one wins.
- Specifying -mtocdata with no variables is equivalent to applying TOC data transformation to all suitable variables, except those explicitly specified with -mno-tocdata. Similarly, specifying -mno-tocdata with no variables is equivalent to not applying TOC data transformation to any variables, except those explicitly specified with -mtocdata.
Predefined macros
None.