Communication time optimization issue causing undefined characters with ASM constants

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 about undefined characters:

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 will focus only on MM_FIX_0_707106781, as the other constants 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 is rated as:

static const uint64_t __attribute__((used, aligned (8))) MM_FIX_0_707106781=0x2d412d412d412d41;

These constants are used in the asm code:

#define MANGLE(a) "_" #a "(%%rip)"

__asm__ volatile(
...
  "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm7 \n\t"
...
);

( ?) asm, , :
".globl "LABLE_MANGLE(functionnamehere)"\n\t"
, ASM.

, , . , -O1 , . -O2 asm-.

- ? .

+3
4

, , , , , .

, mplayer `cc ' , cc == gcc. ; cc gcc. cc gcc, -O4 ( mplayer script).

: . , .

: llvm-gcc -O4, (gcc-4.5.2 gcc42, Apple gcc) . -flto, - . , , , -O2, -O3 .., , , .

, llvm-gcc, ( -O1), , .

+1

llvm-link - ​​ asm. , - C. , , . LTO LLVM-, .

EDIT: static, , asm, , .

0

, . , , :

  • Apple bugtracker, , llvm-gcc, XCode
  • top-of-tree llvm llvm-gcc ( , ) (, , clang). - LLVM PR.

:)

, , . , , , . , , , ( , , ).

"static" , . ( ), .

0

ffmpeg-0.8 :

./configure --cc=i686-apple-darwin10-gcc-4.2.1 --enable-gpl --enable-nonfree
0

All Articles