When building a shared library on AIX with xlc, you see this linker warning:
ld: 0711-224 WARNING: Duplicate symbol: __fe_def_env
To reproduce, use this source file fenvtest.c
:
#include <fenv.h>
void exported_func() {
fenv_t f;
(void)fegetenv(&f);
}
Then run the following command:
$ xlc -G -o fenvtest.so -lm -Wl,-bexpfull fenvtest.c
ld: 0711-224 WARNING: Duplicate symbol: __fe_def_env
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
Generally the warning about __fe_def_env
occurs when building a shared library and the linker option -bexpfull
is used. See the linker documentation for more explanation of -bexpfull
.
The symbol __fe_def_env
is defined in /usr/include/fenv.h
:
const fenv_t __fe_def_env = { FE_TONEAREST, 0, 0, 0, 0 };
so it is included in every object that includes fenv.h
. For that reason, if when a shared object is built with -bexpfull
or another option that exports __fe_def_env
, this symbol will collide with the symbol of the same name in other files.
You can avoid the warning by:
-bexpall
instead of -bexpfull
__fe_def_env
That said, the warning is harmless and may be ignored.