bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/2834] New: Linker reports error "X referenced in section '.rodat


From: hniksic at xemacs dot org
Subject: [Bug ld/2834] New: Linker reports error "X referenced in section '.rodata' of foo.o: defined in discarded section X of foo.o" with g++ 3.3
Date: 23 Jun 2006 15:59:30 -0000

When I upgraded to binutils 2.16.91 20060413, I started seeing an error when
compiling legacy C++ code with GCC 3.3.  The error can be reproduced like this:

// a.cc:
#include <boost/format.hpp>
std::string f1()
{
  return boost::format("x").str();
}

// b.cc:
#include <boost/format.hpp>
std::string f2()
{
  return boost::format("y").str();
}

// main.cc:
#include <cstdio>
#include <string>
using namespace std;
string f1();
string f2();
int main()
{
  printf("%s %s\n", f1().c_str(), f2().c_str());
  return 0;
}

Then:
$ g++-3.3 a.cc b.cc main.cc
`.gnu.linkonce.t._ZN5boost2io6detail22parse_printf_directiveIcSt11char_traitsIcESaIcEN9__gnu_cxx17__normal_iteratorIPKcSsEESt5ctypeIcEEEbRT2_RKSD_PNS1_11format_itemIT_T0_T1_EERKT3_jh'
referenced in section `.rodata' of /tmp/cchMh54t.o: defined in discarded section
`.gnu.linkonce.t._ZN5boost2io6detail22parse_printf_directiveIcSt11char_traitsIcESaIcEN9__gnu_cxx17__normal_iteratorIPKcSsEESt5ctypeIcEEEbRT2_RKSD_PNS1_11format_itemIT_T0_T1_EERKT3_jh'
of /tmp/cchMh54t.o
collect2: ld returned 1 exit status

parse_printf_directive, mentioned in mangled form in the error messsage, is a
Boost function that gets called from format().

In older binutils (16.91 20060118) I could work around the bug by specifying the
-g flag, which caused the bug to go away. That workaround, however, no longer
works in 2.16.91 20060413.

-- 
           Summary: Linker reports error "X referenced in section '.rodata'
                    of foo.o: defined in discarded section X of foo.o" with
                    g++ 3.3
           Product: binutils
           Version: 2.16
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: hniksic at xemacs dot org
                CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=2834

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]