Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with Link Time Optimization causing undefined symbols with ASM constants
    primarykey
    data
    text
    <p>I am compiling mplayer with llvm-gcc-4.2.1. </p> <p>With '-O1' (which disables link time optimization), the program successfully compiles and links. With '-O2' or '-O1 -flto', ld complains of undefined symbols:</p> <pre> 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 </pre> <p>fyi, my version of ld: </p> <pre><code>@(#)PROGRAM:ld PROJECT:ld64-123.2 llvm version 2.9svn, from Apple Clang 2.0 (build 137) </code></pre> <p>I'll focus just on MM_FIX_0_707106781, as the other constants all follow the same procedure.</p> <p>MM_FIX_0_707106781 is initialized with the macro: </p> <pre><code>DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_707106781)=FIX64(0.707106781, 14); </code></pre> <p>which evaluates to: </p> <pre><code>static const uint64_t __attribute__((used, aligned (8))) MM_FIX_0_707106781=0x2d412d412d412d41; </code></pre> <p>These constants are used in asm code:</p> <pre> #define MANGLE(a) "_" #a "(%%rip)" __asm__ volatile( ... "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm7 \n\t" ... ); </pre> <p>I had a similar (the same?) problem with asm functions that I was able to resolve by adding:<br> <code>".globl "LABLE_MANGLE(functionnamehere)"\n\t"</code><br> before each label, but that knowledge has not helped me with these ASM constants.</p> <p>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. </p> <p>Can anyone offer a solution to this problem? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload