error: unresolved symbols remain when using -flto

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • Code Generation Tools
    • CODEGEN-15973
    • Hide
      C29_1.0.2.LTS
      C29_2.2.0.LTS
      Show
      C29_1.0.2.LTS C29_2.2.0.LTS
    • Hide
      C29_2.2.2.LTS*
      C29_3.0.0.LTS*
      C29_1.0.3.LTS*
      Show
      C29_2.2.2.LTS* C29_3.0.0.LTS* C29_1.0.3.LTS*
    • 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.

            Assignee:
            TI User
            Reporter:
            TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Connection: Intermediate to External PROD System
                EXTSYNC-6921 - error: unresolved symbols remain wh...
                SYNCHRONIZED
                • Last Sync Date: