-qprocimported, -qproclocal, -qprocunknown

Category

Optimization and tuning

Pragma equivalent

#pragma options proclocal, #pragma options procimported, #pragma options procunknown

Purpose

Marks functions as local, imported, or unknown.

Local functions are statically bound with the functions that call them; smaller, faster code is generated for calls to such functions. You can use the -qproclocal option or pragma to name functions that the compiler can assume to be local.

Imported functions are dynamically bound with a shared portion of a library. Code generated for calls to functions marked as imported may be larger, but is faster than the default code sequence generated for functions marked as unknown. You can use the -qprocimported option or pragma to name functions that the compiler can assume to be imported.

Unknown functions are resolved to either statically or dynamically bound objects during linking. You can use the -qprocunkown option or pragma to name functions that the compiler can assume to be unknown.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-procunknown--.                             
>>- -q--+-proclocal----+--+----------------------+-------------><
        '-procimported-'  |    .-:-------------. |   
                          |    V               | |   
                          '-=----function_name-+-'   

Defaults

-qprocunkown: The compiler assumes that all functions' definitions are unknown.

Parameters

function_name
The name of a function that the compiler should assume to be local, imported, or unknown (depending on the option specified). If you do not specify any function_name, the compiler assumes that all functions are local, imported, or unknown.

Usage

If any functions that are marked as local resolve to shared library functions, the linker will detect the error and issue warnings. If any of the functions that are marked as imported resolve to statically bound objects, the generated code may be larger and run more slowly than the default code sequence generated for unknown functions.

If a function satisfies all of the following conditions, the compiler issues a warning message to indicate that the final executable file might have a performance loss:
  • Has a local definition.
  • Is marked as imported or unknown.
  • IBM extensionHas the protected, hidden, or internal visibility attribute.IBM extension

If you specify more than one of these options with no function names, the last option specified is used. If you specify the same function name on more than one option specification, the last one is used.

Predefined macros

None.

Examples

To compile myprogram.c along with the archive library oldprogs.a so that:
  • Functions fun and sun are specified as local
  • Functions moon and stars are specified as imported
  • Function venus is specified as unknown
use the following command:
xlc myprogram.c oldprogs.a -qprolocal=fun(int):sun()
  -qprocimported=moon():stars(float) -qprocunknown=venus()
If the following example, in which a function marked as local instead resolves to a shared library function, is compiled with -qproclocal:
int main(void) 
{ 
    printf("Just in function foo1()\n"); 
    printf("Just in function foo1()\n"); 
}
a linker error will result. To correct this problem, you should explicitly mark the called routine as being imported from a shared object. In this case, you would recompile the source file and explicitly mark printf as imported by compiling with -qproclocal -qprocimported=printf.

Related information