I am compiling mplayer with llvm-gcc-4.2.1.
With '-O1' (which disables link time optimization), the program successfully compiles and links. With '-O2' or '-O1 -flto', ld complains of undefined symbols:
Undefined symbols for architecture x86_64: "_MM_FIX_0_707106781", referenced from: _filter in vf_fspp.o "_MM_FIX_0_541196100", referenced from: _filter in vf_fspp.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status
fyi, my version of ld:
@(#)PROGRAM:ld PROJECT:ld64-123.2
llvm version 2.9svn, from Apple Clang 2.0 (build 137)
I'll focus just on MM_FIX_0_707106781, as the other constants all follow the same procedure.
MM_FIX_0_707106781 is initialized with the macro:
DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_707106781)=FIX64(0.707106781, 14);
which evaluates to:
static const uint64_t __attribute__((used, aligned (8))) MM_FIX_0_707106781=0x2d412d412d412d41;
These constants are used in asm code:
#define MANGLE(a) "_" #a "(%%rip)" __asm__ volatile( ... "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm7 \n\t" ... );
I had a similar (the same?) problem with asm functions that I was able to resolve by adding:".globl "LABLE_MANGLE(functionnamehere)"\n\t"
before each label, but that knowledge has not helped me with these ASM constants.
That is as much information as I can provide, I'm afraid. Once again, with -O1 the code compiles, links, and runs. With -O2 the linker fails to find these asm constants.
Can anyone offer a solution to this problem? Thanks.