-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Medium
-
Code Generation Tools
-
CODEGEN-15973
-
-
-
default
-
Utilize the option --symbol_map=name.<n>=name linker option to manually resolve each unresolved symbol to the original symbol.
When utilizing -flto, the error "unresolved symbols remain" may be generated due to an unresolved issue. This issue is identified through the symbols that remain unresolved: functions of the form "name.<n>" where <n> is a random integer value.
To confirm that you are affected, compile this test case with the command:
c29clang -O2 -fno-honor-nans -mfpu=f32 -flto <file>
#include <math.h> __attribute__((used)) double myfmod(double x, double y) { return fmod(x, y); } int main() { return 0; }
Compilers which are affected by this issue will fail to link with an error similar to:
undefined first referenced symbol in file --------- ---------------- ldexp.1 <temporary file> ldexp.2 <temporary file> ldexp.3 <temporary file> ldexp.4 <temporary file> ldexp.5 <temporary file> error: unresolved symbols remain
As a workaround, pass additional options to the linker to map the <name>.<n> symbols to the original <name> function. In this case:
c29clang -O2 -fno-honor-nans -mfpu=f32 -flto <file> -Wl,--symbol_map=ldexp.1=ldexp,--symbol_map=ldexp.2=ldexp,--symbol_map=ldexp.3=ldexp,--symbol_map=ldexp.4=ldexp,--symbol_map=ldexp.5=ldexp
The link will succeed, as originally expected.