-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 in 64-bit compilations.

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 proclocal option or pragma to name functions that the compiler can assume are 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 procimported option or pragma to name functions that the compiler can assume are imported.

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

Syntax

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

Defaults

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

Parameters

function_name
The name of a function that the compiler should assume is 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.

C++ only 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 use the nm operating system command on the resulting object file. You can also use can the c++filt utility provided by the compiler for a side-by-side listing of source names and mangled names; see Demangling compiled C++ names for details. (See also Name mangling for details on using the extern "C" linkage specifier on declarations to prevent name mangling.)

Usage

This option applies to 64-bit compilations only.

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 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