IBM Support

ld: 0711-768 warning and shared libraries

Troubleshooting


Problem

An ld: 0711-768 warning message is generated when a call to certain functions declared in the ANSI C library is compiled with the XL C/C++ for AIX, V11.1 compiler, and an exported definition of the called functions is found in a shared object during linking.

Symptom

ld: 0711-768 WARNING: Object mytest.o, section 1, function .strcpy:
The branch at address 0x1c is not followed by a recognized no-op or TOC-reload instruction. The unrecognized instruction is 0xE8010090.

The ld: 0711-768 warning message is generated when a call is made to some functions defined in the ANSI C library.

The compiled program might produce a segmentation fault or a core dump during execution.

Cause

This problem might occur when symbols expected by the compiler to be statically linked, such as some ANSI C library routines are exported from a shared library. Some functions defined in the ANSI C library are treated by the compiler as built-in functions and are expected to be resolved locally from the static components of libc.a. Exporting these functions from a shared library, either explicitly through an export list, or implicitly through the -bexpall linker option, might result in the compiler generating code that does not function properly when they are called from outside the library.

This issue might also occur when linking a program against a shared library that exports functions with the same name as these ANSI C library routines, and it might occur with aggregate (struct, union or array) assignments or comparisons.

Environment

AIX

Resolving The Problem

UPDATE (October 2010): APAR IZ82804 has resolved this problem. Please install the latest update for the C and C++ compilers found here.

There are two different methods that you can employ to resolve this problem. These methods are listed in the order of preference.

1. Avoid using -bexpall when creating a shared library. Instead, use an export list file to explicitly identify the symbols to be exported
An export list file specifies the symbols that must be exported when building a shared library. This listing can be created using one of the following three methods:
- Use the CreateExportList utility as described in Exporting symbols with the CreateExportList utility.
- Use the -qexpfile compiler option with the -qmkshrobj option to create the basis for the export list file used in the real link step, for example:
xlc -qmkshrobj -qexpfile=exportlist foo.o
- Manually create the export list file. If necessary, in a text editor, edit the export list file to control which symbols will be exported when you create the shared library.

When dealing with an existing shared library, an import file can be used to import only the desired symbols from the shared library. For more details, see the documentation of the AIX Id command.

2. -U__STR__
If you want to redefine the ANSI C routines and potentially export them from a shared library, add the -U__STR__ compiler option to your command line. This can be done when compiling the source code for the shared library and any code that will be linked against this shared library. This option undefines the macro __STR__, informing the compiler to not create the built-in functions defined by the <string.h> library. In the mean time, make sure the -qnolibansi option is active.

[{"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Documentation","Platform":[{"code":"PF002","label":"AIX"}],"Version":"11.1","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}},{"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Documentation","Platform":[{"code":"PF002","label":"AIX"}],"Version":"11.1","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
06 December 2018

UID

swg21443810