[Bug 885927] Re: g++ fails to link when using the -flto switch

Matthias Klose doko at ubuntu.com
Fri Nov 4 15:24:47 UTC 2011


fixed in -updates

** Changed in: binutils (Ubuntu)
       Status: Confirmed => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to binutils in Ubuntu.
https://bugs.launchpad.net/bugs/885927

Title:
  g++ fails to link when using the -flto switch

Status in “binutils” package in Ubuntu:
  Fix Released

Bug description:
  Any C++ program I tried to build with GCC failed with undefined
  reference errors. As a test case, I have created a simple Hello World
  program:

  $ cat hello.cpp 
  #include <iostream>

  int main()
  {
    std::cout << "Hello world!" << std::endl;
  }

  $ g++ -o hello hello.cpp -flto
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `_Unwind_GetDataRelBase at GCC_3.0'
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `_Unwind_SetIP at GCC_3.0'
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `_Unwind_RaiseException at GCC_3.0'
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `_Unwind_GetLanguageSpecificData at GCC_3.0'
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `_Unwind_GetRegionStart at GCC_3.0'
  /lib/x86_64-linux-gnu/libc.so.6: undefined reference to `_dl_argv at GLIBC_PRIVATE'
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `_Unwind_DeleteException at GCC_3.0'
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `_Unwind_SetGR at GCC_3.0'
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `_Unwind_Resume at GCC_3.0'
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `_Unwind_GetIPInfo at GCC_4.2.0'
  /lib/x86_64-linux-gnu/libc.so.6: undefined reference to `_rtld_global_ro at GLIBC_PRIVATE'
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `__tls_get_addr at GLIBC_2.3'
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `_Unwind_Resume_or_Rethrow at GCC_3.3'
  /lib/x86_64-linux-gnu/libc.so.6: undefined reference to `_rtld_global at GLIBC_PRIVATE'
  /lib/x86_64-linux-gnu/libc.so.6: undefined reference to `__libc_enable_secure at GLIBC_PRIVATE'
  /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so: undefined reference to `_Unwind_GetTextRelBase at GCC_3.0'
  collect2: ld returned 1 exit status

  Every C++ program I tried to build with -flto failed at link stage. C
  programs compile without problems. A workaround is to add the
  -B/usr/lib/gold-ld/ switch to the command line:

  $ g++ -B/usr/lib/gold-ld/ -flto -o hello hello.cpp
  $ # Success

  ProblemType: Bug
  DistroRelease: Ubuntu 11.10
  Package: binutils 2.21.53.20110810-0ubuntu4
  ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4
  Uname: Linux 3.0.0-12-generic x86_64
  NonfreeKernelModules: fglrx
  ApportVersion: 1.23-0ubuntu4
  Architecture: amd64
  Date: Thu Nov  3 21:43:56 2011
  InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427.1)
  ProcEnviron:
   LANGUAGE=pt_BR:pt:en
   PATH=(custom, no user)
   LANG=pt_BR.UTF-8
   SHELL=/bin/bash
  SourcePackage: binutils
  UpgradeStatus: Upgraded to oneiric on 2011-10-15 (19 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/885927/+subscriptions




More information about the foundations-bugs mailing list